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

Public Member Functions | List of all members
GitTpl::Enum< LookupClass, EnumType > Class Template Reference

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

#include <gittpl.h>

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

Public Member Functions

 Enum ()
 Default contructor for the object. More...
 
 Enum (EnumType InitialValue)
 Constructor with initial value supplied. More...
 
 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. More...
 
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. More...
 
 operator EnumType () const
 Return the underlying value of this object. More...
 
 operator const char * () const
 Return the underlying value of this object as a string. More...
 
virtual ~Enum ()
 Destructor. More...
 

Additional Inherited Members

- Public Types inherited from Git
enum  {
  Upper =GIT_M_ARG_UPPER, Lower =GIT_M_ARG_UPPER, KeepErr =GIT_M_ARG_KEEPERR, Abbrev = GIT_M_ARG_ABBREV,
  LastBit =GIT_M_ARG_LASTBIT
}
 

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
LookupClassA sub-class of GitTpl::EnumLookupClass with GetMaxValue() and GetStringArray() implemented.
EnumTypeThe underlyting enumerated value. Must be possible to cast to and from an int. Must have values for 0 through to LookupClass->GetMaxValue()+1 inclusive.

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
InitialValueThe 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
IdThe SDS structure.
NameThe name of the item within the structure.
PositionIf the item does not exist by the name, then presume this position.
statusInherited status
DefaultThe default value.
FlagsWhich GIT Flags to apply
template<typename LookupClass , typename EnumType >
virtual GitTpl::Enum< LookupClass, EnumType >::~Enum ( )
inlinevirtual

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
IdThe SDS structure.
NameThe name of the item within the structure.
PositionIf the item does not exist by the name, then presume this position.
statusInherited status
DefaultThe default value. If not specified use 0 (first enum val)
FlagsWhich 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@aao.gov.au 

Generated on Mon Feb 22 2016 13:58:31 for AAO DRAMA C++ Interfaces by doxygen 1.8.10