green::Variable Class Reference

#include <Variable.h>

List of all members.

Public Types

enum  Type { FLOAT_VAR, INT_VAR }
 This represents the type of variable it is.

Public Member Functions

 Variable ()
 Variable (int copy)
 Variable (float copy)
bool operator== (const Variable &rhs) const
Variableoperator= (int value)
Variableoperator= (float value)
void Print (std::ostream &os) const
virtual ~Variable ()
Variable::Type GetType () const
void SetType (Variable::Type type)
Variable::Value GetValue () const
void SetValue (Variable::Value value)
void SetValue (int value)
void SetValue (float value)

Private Attributes

Variable::Value mValue
 the value of the variable
Variable::Type mType
 the type of the variable

Classes

union  Value


Detailed Description

This is the Variable class, which is used by the Entity class to represent custom object variables. For now, variables can either be integers or floating point values.


Constructor & Destructor Documentation

green::Variable::Variable (  )  [inline]

Variables default to INT_VAR types

green::Variable::Variable ( int  copy  )  [inline]

Copy constructor from an int

green::Variable::Variable ( float  copy  )  [inline]

Copy constructor from a float

virtual green::Variable::~Variable (  )  [inline, virtual]

Default constructor defined as virtual


Member Function Documentation

bool green::Variable::operator== ( const Variable rhs  )  const [inline]

Overloaded the == operator between Variable objects.

Parameters:
rhs This is the right hand side of the == operation.
Returns:
Returns true if the two Variable objects are the same type and have the same value.

Variable& green::Variable::operator= ( int  value  )  [inline]

Assignment to an integer. Sets the type to INT_VAR and the value appropriately.

Parameters:
value The new value of the Variable, as an integer.
Returns:
returns reference to *this, as per convention of = operator

Variable& green::Variable::operator= ( float  value  )  [inline]

Assignment to an float. Sets the type to FLOAT_VAR and the value appropriately.

Parameters:
value The new value of the Variable, as a float.
Returns:
returns reference to *this, as per convention of = operator

void green::Variable::Print ( std::ostream &  os  )  const [inline]

Print the Variable to a std::ostream. Also prints the type of the Variable for easy reading. May provide a bare print method in the future if necessary.

Parameters:
os The output stream to print the variable to.

Variable::Type green::Variable::GetType (  )  const [inline]

Get the type of variable it is

void green::Variable::SetType ( Variable::Type  type  )  [inline]

Set the type of variable this is

Parameters:
type The new type of variable

Variable::Value green::Variable::GetValue (  )  const [inline]

Get the value of the variable

void green::Variable::SetValue ( Variable::Value  value  )  [inline]

Set the value of the variable

Parameters:
value The new value of the variable

void green::Variable::SetValue ( int  value  )  [inline]

Set the value of the variable to an int

Parameters:
value The new value of the variable

void green::Variable::SetValue ( float  value  )  [inline]

Set the value of the variable to a float

Parameters:
value The new value of the variable


The documentation for this class was generated from the following file:
Generated on Fri Apr 27 10:27:39 2007 for Green Engine by  doxygen 1.5.1