Jpp  18.0.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
JTOOLS::JAutoMap< JKey_t, JValue_t > Class Template Reference

Wrapper class around std::map for automatic insertion of elements based on data types. More...

#include <JAutoMap.hh>

Inheritance diagram for JTOOLS::JAutoMap< JKey_t, JValue_t >:
std::map< JKey_t, JValue_t > JSUPPORT::JAutoTreeWriter< JNET::JTag > JSUPPORT::JAutoTreeScanner< JBase_t, JEvaluator_t > JSUPPORT::JAutoTreeWriter< JKey_t >

Public Types

typedef std::map< JKey_t,
JValue_t > 
map_type
 
typedef map_type::value_type value_type
 

Public Member Functions

 JAutoMap ()
 Default constructor. More...
 
template<class T >
void insert ()
 Insert list of data types. More...
 
template<class T , class JElement_t >
void insert (const JAutomate< JElement_t > &automate)
 Insert list of data types. More...
 

Static Public Member Functions

template<class T >
static value_type getAutoElement (JType< T > type)
 Creation of a map element for given data type. More...
 

Protected Member Functions

template<class T , class JElement_t >
void insert (JType< T > type, const JAutomate< JElement_t > &automate)
 Insertion of single data type. More...
 
template<class JHead_t , class JTail_t , class JElement_t >
void insert (JType< JTypeList< JHead_t, JTail_t > > typelist, const JAutomate< JElement_t > &automate)
 Recursive insertion of data types. More...
 
template<class JElement_t >
void insert (JType< JNullType > type, const JAutomate< JElement_t > &automate)
 Template specialisation to terminate insertion of data types. More...
 

Detailed Description

template<class JKey_t, class JValue_t>
class JTOOLS::JAutoMap< JKey_t, JValue_t >

Wrapper class around std::map for automatic insertion of elements based on data types.

Definition at line 31 of file JAutoMap.hh.

Member Typedef Documentation

template<class JKey_t, class JValue_t>
typedef std::map<JKey_t, JValue_t> JTOOLS::JAutoMap< JKey_t, JValue_t >::map_type

Definition at line 96 of file JAutoMap.hh.

template<class JKey_t, class JValue_t>
typedef map_type::value_type JTOOLS::JAutoMap< JKey_t, JValue_t >::value_type

Definition at line 97 of file JAutoMap.hh.

Constructor & Destructor Documentation

template<class JKey_t, class JValue_t>
JTOOLS::JAutoMap< JKey_t, JValue_t >::JAutoMap ( )
inline

Default constructor.

Definition at line 104 of file JAutoMap.hh.

105  {}

Member Function Documentation

template<class JKey_t, class JValue_t>
template<class T >
static value_type JTOOLS::JAutoMap< JKey_t, JValue_t >::getAutoElement ( JType< T type)
static

Creation of a map element for given data type.

This method should be overloaded for the requested data types if the method insert() is used without argument.

Parameters
typedata type
Returns
element
template<class JKey_t, class JValue_t>
template<class T >
void JTOOLS::JAutoMap< JKey_t, JValue_t >::insert ( )
inline

Insert list of data types.

Definition at line 125 of file JAutoMap.hh.

126  {
127  insert(JType<T>(), JAutomate<JAutoMap>());
128  }
Auxiliary class for automatic element creation.
Definition: JAutoMap.hh:46
void insert()
Insert list of data types.
Definition: JAutoMap.hh:125
template<class JKey_t, class JValue_t>
template<class T , class JElement_t >
void JTOOLS::JAutoMap< JKey_t, JValue_t >::insert ( const JAutomate< JElement_t > &  automate)
inline

Insert list of data types.

Parameters
automatetype defined element

Definition at line 137 of file JAutoMap.hh.

138  {
139  insert(JType<T>(), automate);
140  }
void insert()
Insert list of data types.
Definition: JAutoMap.hh:125
template<class JKey_t, class JValue_t>
template<class T , class JElement_t >
void JTOOLS::JAutoMap< JKey_t, JValue_t >::insert ( JType< T type,
const JAutomate< JElement_t > &  automate 
)
inlineprotected

Insertion of single data type.

Parameters
typedata type
automateelement automate by data type

Definition at line 150 of file JAutoMap.hh.

152  {
153  map_type::insert(automate.getElement(type));
154  }
static JElement_t getElement(JType< T > type)
Get element.
Definition: JAutoMap.hh:54
template<class JKey_t, class JValue_t>
template<class JHead_t , class JTail_t , class JElement_t >
void JTOOLS::JAutoMap< JKey_t, JValue_t >::insert ( JType< JTypeList< JHead_t, JTail_t > >  typelist,
const JAutomate< JElement_t > &  automate 
)
inlineprotected

Recursive insertion of data types.

Parameters
typelisttype list
automateelement automate by data type

Definition at line 164 of file JAutoMap.hh.

166  {
167  insert(JType<JHead_t>(), automate);
168  insert(JType<JTail_t>(), automate);
169  }
void insert()
Insert list of data types.
Definition: JAutoMap.hh:125
template<class JKey_t, class JValue_t>
template<class JElement_t >
void JTOOLS::JAutoMap< JKey_t, JValue_t >::insert ( JType< JNullType type,
const JAutomate< JElement_t > &  automate 
)
inlineprotected

Template specialisation to terminate insertion of data types.

Parameters
typenull type
automateelement automate by data type

Definition at line 179 of file JAutoMap.hh.

181  {}

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