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

A concrete, typed implementation of the MemberInitializer base class. More...

#include <factory.h>

Inheritance diagram for infact::TypedMemberInitializer< T >:
infact::MemberInitializer

Public Member Functions

 TypedMemberInitializer (const string &name, T *member, bool required=false)
 A concrete implementation of the MemberInitializer base class, holding a pointer to a typed member that needs to be initialized. More...
 
virtual ~TypedMemberInitializer ()
 
virtual void Init (StreamTokenizer &st, Environment *env)
 Initializes this instance based on the following tokens obtained from the specified StreamTokenizer. More...
 
- Public Member Functions inherited from infact::MemberInitializer
 MemberInitializer (const string &name, bool required)
 Initializes this base class. More...
 
virtual ~MemberInitializer ()
 Destroys this instance. More...
 
virtual string Name ()
 Returns the name of the member initialized by this instance, as it should appear in a spec string parsed by Factory::CreateOrDie. More...
 
virtual int Initialized () const
 Returns the number of times this member initializer’s Init method has been invoked. More...
 
virtual bool Required () const
 Whether this member is required to be initialized in a spec string. More...
 

Protected Attributes

T * member_
 
- Protected Attributes inherited from infact::MemberInitializer
string name_
 The name of this member. More...
 
int initialized_
 The number of times this member initializer’s Init method has been invoked. More...
 
bool required_
 Whether this member is required to be initialized. More...
 

Detailed Description

template<typename T>
class infact::TypedMemberInitializer< T >

A concrete, typed implementation of the MemberInitializer base class.

This class holds a pointer to a particular type of data member from some Factory-constructible class that it can initialize from a StreamTokenizer instance.

Template Parameters
Ta type of data member from a Factory-constructible class that this class can initialize by reading tokens from a StreamTokenizer instance

Definition at line 290 of file factory.h.

Constructor & Destructor Documentation

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

A concrete implementation of the MemberInitializer base class, holding a pointer to a typed member that needs to be initialized.

Parameters
namethe name of the member to be initialized, as it should Factory::CreateOrDie method
membera pointer to a data member of a C++ class to be initialized, or nullptr if this initializer should only modify the Environment (providing a mapping between a name a value that might be used by a class’ Init method
requiredwhether this member is required to be initialized in a spec string

Definition at line 306 of file factory.h.

template<typename T>
virtual infact::TypedMemberInitializer< T >::~TypedMemberInitializer ( )
inlinevirtual

Definition at line 308 of file factory.h.

Member Function Documentation

template<typename T>
virtual void infact::TypedMemberInitializer< T >::Init ( StreamTokenizer st,
Environment env 
)
inlinevirtual

Initializes this instance based on the following tokens obtained from the specified StreamTokenizer.

Parameters
stthe stream tokenizer whose next tokens contain the information to initialize this data member
envthe current environment, to be modified by this member’s initialization

Implements infact::MemberInitializer.

Definition at line 309 of file factory.h.

Member Data Documentation

template<typename T>
T* infact::TypedMemberInitializer< T >::member_
protected

Definition at line 328 of file factory.h.


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