InFact
Interpreter and factory for easily creating C++ objects at run-time
|
A sheep. More...
#include <example.h>
Public Member Functions | |
Sheep () | |
Constructs a sheep. More... | |
virtual | ~Sheep () |
Destroys a sheep. More... | |
virtual void | RegisterInitializers (Initializers &initializers) |
Registers one required and two optional inititalizers. More... | |
virtual void | PostInit (const Environment *env, const string &init_str) |
Grabs the variable named "age" from the Environment (set up by RegisterInitializers) and sets this sheep’s age to be twice that value. More... | |
virtual const string & | name () const |
Returns the name of this animal. More... | |
virtual int | age () const |
Returns the age of this animal. More... | |
const vector< int > & | counts () |
Returns the counts of this sheep. More... | |
Public Member Functions inherited from infact::Animal | |
Animal () | |
Constructs a generic animal. More... | |
virtual | ~Animal () |
Destroys this animal. More... | |
Public Member Functions inherited from infact::FactoryConstructible | |
virtual | ~FactoryConstructible () |
Destroys this instance. More... | |
A sheep.
Unlike other animals, sheep are always twice the age you specify (for the purposes of this example, anyway). Please see how we do this by looking at the implementations of the RegisterInitializers and PostInit methods.
|
inlinevirtual |
|
inlinevirtual |
Returns the age of this animal.
Implements infact::Animal.
|
inline |
|
inlinevirtual |
Returns the name of this animal.
Implements infact::Animal.
|
virtual |
Grabs the variable named "age" from the Environment (set up by RegisterInitializers) and sets this sheep’s age to be twice that value.
Reimplemented from infact::FactoryConstructible.
Definition at line 59 of file example.cc.
|
inlinevirtual |
Registers one required and two optional inititalizers.
Please note the use of a temporary variable being initialized in this method, for use inside the PostInit method.
Reimplemented from infact::FactoryConstructible.