InFact
Interpreter and factory for easily creating C++ objects at run-time
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Types | Public Member Functions | List of all members
infact::Initializers Class Reference

A container for all the member initializers for a particular Factory-constructible instance. More...

#include <factory.h>

Public Types

typedef unordered_map< string,
MemberInitializer * >
::const_iterator 
const_iterator
 Forward the const_iterator typedef of the internal data structure, to make code compact and readable. More...
 
typedef unordered_map< string,
MemberInitializer * >
::iterator 
iterator
 Forward the iterator typedef of the internal data structure, to make code compact and readable. More...
 

Public Member Functions

 Initializers ()
 Constructs a new instance. More...
 
virtual ~Initializers ()
 Destroys this instance. More...
 
template<typename T >
void Add (const string &name, T *member, bool required=false)
 This method is the raison d'etre of this class: a method to make it easy to add all supported types of members of a class to be initialized upon construction by its Factory. More...
 
const_iterator begin () const
 Returns a const iterator pointing to the beginning of the map from member names to pointers to TypedMemberInitializer instances. More...
 
const_iterator end () const
 Returns a const iterator pointing to the end of the map from member names to pointers to TypedMemberInitializer instances. More...
 
iterator begin ()
 Returns an iterator pointing to the beginning of the map from member names to pointers to TypedMemberInitializer instances. More...
 
iterator end ()
 Returns an iterator pointing to the end of the map from member names to pointers to TypedMemberInitializer instances. More...
 
const_iterator find (const string &name) const
 Returns a const_iterator pointing to the MemberInitializer associated with the specified name, or else end if no such TypedMemberInitializer exists. More...
 
iterator find (const string &name)
 Returns an iterator pointing to the MemberInitializer associated with the specified name, or else end if no such TypedMemberInitializer exists. More...
 

Detailed Description

A container for all the member initializers for a particular Factory-constructible instance.

This class provides an easy, consistent syntax for Factory-constructible classes to specify which members they want/need initialized by the Factory based on the specification string.

Definition at line 337 of file factory.h.

Member Typedef Documentation

Forward the const_iterator typedef of the internal data structure, to make code compact and readable.

Definition at line 342 of file factory.h.

typedef unordered_map<string, MemberInitializer *>::iterator infact::Initializers::iterator

Forward the iterator typedef of the internal data structure, to make code compact and readable.

Definition at line 345 of file factory.h.

Constructor & Destructor Documentation

infact::Initializers::Initializers ( )
inline

Constructs a new instance.

Definition at line 348 of file factory.h.

virtual infact::Initializers::~Initializers ( )
inlinevirtual

Destroys this instance.

Definition at line 350 of file factory.h.

Member Function Documentation

template<typename T >
void infact::Initializers::Add ( const string &  name,
T *  member,
bool  required = false 
)
inline

This method is the raison d'etre of this class: a method to make it easy to add all supported types of members of a class to be initialized upon construction by its Factory.

Parameters
namethe name of the member to be initialized (as it should appear in the initialization spec string; note that this string does not have to be identical to the actual member name in the C++ class definition, but the convention is to make it identical but without an underscore character)
membera pointer to the class instance's member that is to be initialized based on tokens in a spec string parsed by the Factory::CreateOrDie method
requiredwhether this member must be specified in a spec string

Definition at line 376 of file factory.h.

const_iterator infact::Initializers::begin ( ) const
inline

Returns a const iterator pointing to the beginning of the map from member names to pointers to TypedMemberInitializer instances.

Definition at line 389 of file factory.h.

iterator infact::Initializers::begin ( )
inline

Returns an iterator pointing to the beginning of the map from member names to pointers to TypedMemberInitializer instances.

Definition at line 400 of file factory.h.

const_iterator infact::Initializers::end ( ) const
inline

Returns a const iterator pointing to the end of the map from member names to pointers to TypedMemberInitializer instances.

Definition at line 394 of file factory.h.

iterator infact::Initializers::end ( )
inline

Returns an iterator pointing to the end of the map from member names to pointers to TypedMemberInitializer instances.

Definition at line 404 of file factory.h.

const_iterator infact::Initializers::find ( const string &  name) const
inline

Returns a const_iterator pointing to the MemberInitializer associated with the specified name, or else end if no such TypedMemberInitializer exists.

Definition at line 411 of file factory.h.

iterator infact::Initializers::find ( const string &  name)
inline

Returns an iterator pointing to the MemberInitializer associated with the specified name, or else end if no such TypedMemberInitializer exists.

Definition at line 419 of file factory.h.


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