Namespace

A namespace of variables that can be accessed from formulas attached to it.

Members

Methods

int lookup( string& name, bool create = true )

Lookup the index of a variable in the namespace. Returns int : Index of the variable. -1 if it does not exist and was not created.

double get( string& name )

Get or calculate the value of a variable by name. Returns double : Value of that variable.

double get( int index )

Get or calculate the value of a variable by index. Returns double : Value of that variable.

bool has( string& name )

Returns bool : True if a variable with this name exists.

void setConstant( string& name, double value )

Set a constant value for a variable.

void setConstant( int index, double value )

Set a constant value for a variable.

void modConstant( int index, double value )

Modify a constant value for a variable by adding a new value.

void setFormula( string& name, string& formula )

Set a formula to evaluate for a variable. Formula is evaluated in this namespace.

void setFormula( int index, string& formula )

Set a formula to evaluate for a variable. Formula is evaluated in this namespace.

void write( Message& msg )

Write the namespace to a message.

void read( Message& msg )

Read the namespace from a message.

void save( SaveFile& file )

Write the namespace to a save file.

void load( SaveFile& file )

Read the namespace from a save file.