#include <bsObjectDefinition.h>
Classes | |
struct | MemberVariable |
Member variable compile information. More... | |
struct | State |
State compile information. More... | |
Public Member Functions | |
ObjectDefinition (const String &name, const String &type) | |
Constructor. | |
virtual | ~ObjectDefinition () |
Destructor. | |
const String & | getName () const |
Get the name of this ObjectDefinition. | |
const String & | getType () const |
Get the type of this ObjectDefinition. | |
void | appendConstructionCode (const BytecodeBlock &code) |
Add code onto the scripted constructor: this will typically be for setting member variables. | |
void | finaliseConstructor () |
Finalises the constructor. | |
void | setMaxLocalVariables (int count) |
Set the maximum number of local variables that any state, function or event uses. | |
int | getMaxLocalVariables () const |
Get the maximum number of local variables that any state, function or event uses. | |
int | addMemberVariable (const String &name, bool readOnly, bstype initialValue=bsvalue0) |
Add a member variable. | |
MemberVariable & | getMemberVariable (int index) |
Get a member variable. | |
int | getMemberVariableIndex (const String &name) const |
Get the index that the named variable uses. | |
int | getNumMemberVariables () const |
Get the number of member variables. | |
void | setNumUserMembers (int count) |
Set the number of user member variable. | |
int | getNumUserMembers () const |
Get the number of user member variable. | |
State & | addState (const String &name) |
Add the named state. | |
State & | getState (int index) |
Get a state. | |
int | getStateIndex (const String &name) const |
Get the index that the named state uses. | |
int | getNumStates () const |
Get the number of states. | |
void | setInitialState (int state) |
Set the index of the initial state. | |
ScriptRecord * | createScriptRecord (ScriptMachine *machine) |
Create a ScriptRecord for an instance to use. | |
Protected Attributes | |
int | mMaxLocals |
Maximum number of local variables. | |
BytecodeBlock | mConstructor |
Temporary storage for constructor for setting member variables. | |
uint32 * | mConstructCode |
Constructor code. | |
size_t | mConstructSize |
Constructor code size. | |
std::vector< MemberVariable > | mMemberVariables |
Member variables. | |
int | mNumUserMembers |
Number of user variables. | |
std::vector< State > | mStates |
States. | |
int | mInitialState |
Starting state for this ObjectDefinition. |
BS_NMSP::ObjectDefinition::ObjectDefinition | ( | const String & | name, | |
const String & | type | |||
) |
Constructor.
name | name of definition. | |
type | type, will generally be either "Emitter" or "Controller". |
int BS_NMSP::ObjectDefinition::addMemberVariable | ( | const String & | name, | |
bool | readOnly, | |||
bstype | initialValue = bsvalue0 | |||
) |
Add a member variable.
name | variable name. | |
readOnly | whether the variable can be modified in script, or not. | |
initialValue | initial value. |
State& BS_NMSP::ObjectDefinition::addState | ( | const String & | name | ) |
Add the named state.
This function does not check to see if the state already exists.
name | name of the state. |
void BS_NMSP::ObjectDefinition::appendConstructionCode | ( | const BytecodeBlock & | code | ) |
Add code onto the scripted constructor: this will typically be for setting member variables.
code | bytecode. |
ScriptRecord* BS_NMSP::ObjectDefinition::createScriptRecord | ( | ScriptMachine * | machine | ) |
Create a ScriptRecord for an instance to use.
machine | pointer to an active ScriptMachine. |
int BS_NMSP::ObjectDefinition::getMaxLocalVariables | ( | ) | const |
Get the maximum number of local variables that any state, function or event uses.
MemberVariable& BS_NMSP::ObjectDefinition::getMemberVariable | ( | int | index | ) |
Get a member variable.
This function assumes that the index is valid!
index | variable index. |
int BS_NMSP::ObjectDefinition::getMemberVariableIndex | ( | const String & | name | ) | const |
Get the index that the named variable uses.
name | name of the variable. |
const String& BS_NMSP::ObjectDefinition::getName | ( | ) | const |
int BS_NMSP::ObjectDefinition::getNumMemberVariables | ( | ) | const |
Get the number of member variables.
int BS_NMSP::ObjectDefinition::getNumStates | ( | ) | const |
Get the number of states.
int BS_NMSP::ObjectDefinition::getNumUserMembers | ( | ) | const |
Get the number of user member variable.
State& BS_NMSP::ObjectDefinition::getState | ( | int | index | ) |
Get a state.
This function assumes that the index is valid!
index | state index. |
int BS_NMSP::ObjectDefinition::getStateIndex | ( | const String & | name | ) | const |
Get the index that the named state uses.
name | name of the state. |
const String& BS_NMSP::ObjectDefinition::getType | ( | ) | const |
void BS_NMSP::ObjectDefinition::setInitialState | ( | int | state | ) |
Set the index of the initial state.
state | initial state. |
void BS_NMSP::ObjectDefinition::setMaxLocalVariables | ( | int | count | ) |
Set the maximum number of local variables that any state, function or event uses.
count | number of variables. |
void BS_NMSP::ObjectDefinition::setNumUserMembers | ( | int | count | ) |
Set the number of user member variable.
count | number of variables. |