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 | List of all members
infact::Sheep Class Reference

A sheep. More...

#include <example.h>

Inheritance diagram for infact::Sheep:
infact::Animal infact::FactoryConstructible

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...
 

Detailed Description

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.

Definition at line 207 of file example.h.

Constructor & Destructor Documentation

infact::Sheep::Sheep ( )
inline

Constructs a sheep.

Definition at line 210 of file example.h.

virtual infact::Sheep::~Sheep ( )
inlinevirtual

Destroys a sheep.

Definition at line 212 of file example.h.

Member Function Documentation

virtual int infact::Sheep::age ( ) const
inlinevirtual

Returns the age of this animal.

Implements infact::Animal.

Definition at line 241 of file example.h.

const vector<int>& infact::Sheep::counts ( )
inline

Returns the counts of this sheep.

Definition at line 245 of file example.h.

virtual const string& infact::Sheep::name ( ) const
inlinevirtual

Returns the name of this animal.

Implements infact::Animal.

Definition at line 239 of file example.h.

void infact::Sheep::PostInit ( const Environment env,
const string &  init_str 
)
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.

virtual void infact::Sheep::RegisterInitializers ( Initializers initializers)
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.

Definition at line 218 of file example.h.


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