DRAMA C++ Intro   Class Hierarchy   Alphabetical List of types   List of Classes   File List   Class Member Index   File Members Index   Related Pages  

GitTpl::Enum< LookupClass, EnumType > Class Template Reference

#include <gittpl.h>

Inheritance diagram for GitTpl::Enum< LookupClass, EnumType >:

Git List of all members.

Detailed Description

template<typename LookupClass, typename EnumType>
class GitTpl::Enum< LookupClass, EnumType >

A class which reads Enumerated values from a SDS argument structures.

This is an template class used for cases where we want to fetch a STRING action argument which must then be converted to an enum type.

This is an alternative approach to GitEnum. GitTpl::Enum is a template class. Two template arguments are required - "LookupClass" and "EnumType". The former must be a sub-class of Git::EnumLookupClass. The later is a normally simple enum type - it mus be possible to cast this class from an integer and cast back to an integer from this class.

See also:
GitArgGetS()
Parameters:
LookupClass  A sub-class of GitTpl::EnumLookupClass with GetMaxValue() and GetStringArray() implemented.
EnumType  The underlyting enumerated value. Must be possible to cast to and from an int. Must have values for 0 through to LookupClass->GetMaxValue()+1 inclusive.


Public Methods

 Enum ()
 Default contructor for the object.

 Enum (EnumType InitialValue)
 Constructor with initial value supplied.

 Enum (const SdsId &Id, const char *const Name, const int Position, StatusType *status, const char *Default=0, const int Flags=Git::Upper|Git::Abbrev)
 Constructor which contructs the values from an SDS type.

void Get (const SdsId &Id, const char *const Name, const int Position, StatusType *status, const char *Default=0, const int Flags=Git::Upper|Git::Abbrev|Git::KeepErr)
 Get the value of the object from an SDS struture.

 operator EnumType () const
 Return the underlying value of this object.

 operator const char * () const
 Return the underlying value of this object as a string.

virtual ~Enum ()
 Destructor.


Constructor & Destructor Documentation

template<typename LookupClass, typename EnumType>
GitTpl::Enum< LookupClass, EnumType >::Enum   [inline]
 

Default contructor for the object.

This will set the value of the object to be the invalid value, obtained by setting the value to the lookup class's GetMaxValue() value + 1.

template<typename LookupClass, typename EnumType>
GitTpl::Enum< LookupClass, EnumType >::Enum EnumType    InitialValue [inline]
 

Constructor with initial value supplied.

The initial value must be one of the values in the enum type.

Parameters:
InitialValue  The initial value for the objects.

template<typename LookupClass, typename EnumType>
GitTpl::Enum< LookupClass, EnumType >::Enum const SdsId   Id,
const char *const    Name,
const int    Position,
StatusType *    status,
const char *    Default = 0,
const int    Flags = Git::Upper|Git::Abbrev
[inline]
 

Constructor which contructs the values from an SDS type.

Parameters:
Id  The SDS structure.
Name  The name of the item within the structure.
Position  If the item does not exist by the name, then presume this position.
status  Inherited status
Default  The default value.
Flags  Which GIT Flags to apply

template<typename LookupClass, typename EnumType>
virtual GitTpl::Enum< LookupClass, EnumType >::~Enum   [inline, virtual]
 

Destructor.


Member Function Documentation

template<typename LookupClass, typename EnumType>
void GitTpl::Enum< LookupClass, EnumType >::Get const SdsId   Id,
const char *const    Name,
const int    Position,
StatusType *    status,
const char *    Default = 0,
const int    Flags = Git::Upper|Git::Abbrev|Git::KeepErr
[inline]
 

Get the value of the object from an SDS struture.

This is the function which is used to set the value of the object. It is passed an SDS structure and looks for the item within that structure.

Parameters:
Id  The SDS structure.
Name  The name of the item within the structure.
Position  If the item does not exist by the name, then presume this position.
status  Inherited status
Default  The default value. If not specified use 0 (first enum val)
Flags  Which GIT Flags to apply. If not specified, then Git::Upper|Git::Abbrev|Git::KeepErr is specified.

template<typename LookupClass, typename EnumType>
GitTpl::Enum< LookupClass, EnumType >::operator const char *   const [inline]
 

Return the underlying value of this object as a string.

template<typename LookupClass, typename EnumType>
GitTpl::Enum< LookupClass, EnumType >::operator EnumType   const [inline]
 

Return the underlying value of this object.


The documentation for this class was generated from the following file:

Click here for the DRAMA home page and here for the AAO home page.

For more information, contact tjf@aaoepp.aao.gov.au 

Generated on Tue Nov 3 09:09:56 2009 for AAO DRAMA C++ Interfaces by doxygen 1.2.18