InFact
Interpreter and factory for easily creating C++ objects at run-time
|
An interface simply to make it easier to implement Factory-constructible types by implementing both required methods to do nothing (use of this interface is completely optional; read more for more information). More...
#include <factory.h>
Public Member Functions | |
virtual | ~FactoryConstructible () |
Destroys this instance. More... | |
virtual void | RegisterInitializers (Initializers &initializers) |
Registers data members of this class for initialization when an instance is constructed via the Factory::CreateOrDie method. More... | |
virtual void | PostInit (const Environment *env, const string &init_str) |
Does any additional initialization after an instance of this class has been constructed, crucially giving access to the Environment that was in use and modified during construction by the Factory::CreateOrDie method. More... | |
An interface simply to make it easier to implement Factory-constructible types by implementing both required methods to do nothing (use of this interface is completely optional; read more for more information).
The Factory class simply requires its template type to have the two methods defined in this class, and so it is not a requirement that all Factory-constructible classes derive from this class; they must merely have methods with the exact signatures of the methods of this class.
|
inlinevirtual |
|
inlinevirtual |
Does any additional initialization after an instance of this class has been constructed, crucially giving access to the Environment that was in use and modified during construction by the Factory::CreateOrDie method.
env | the environment in use during construction by the Factory::CreateOrDie method |
init_str | the entire string used to initialize this object (for example, PersonImpl(name("Fred")) ) |
Reimplemented in infact::Sheep.
|
inlinevirtual |
Registers data members of this class for initialization when an instance is constructed via the Factory::CreateOrDie method.
Adding a data member for initialization is done via the templated Initializers::Add method. Please see infact::PersonImpl::RegisterInitializers for an example implementation.
initializers | an object that stores the initializers for various data members of this class that can be initialized by the Factory::CreateOrDie method |
Reimplemented in infact::HumanPetOwner, infact::Sheep, infact::Cow, infact::PersonImpl, and infact::DateImpl.