ScEng::DataTable Class Reference

Keeps the Data objects. More...

#include <datatable.h>

Inheritance diagram for ScEng::DataTable:

ScEng::Block List of all members.

Public Types

enum  CHUNKS { ID_TO_INDEX_SIZE_CHUNKID = 0x00000010, ID_TO_INDEX_CHUNKID = 0x00000015, DATA_TABLE_SIZE_CHUNKID = 0x00000020 }
 Enum Chunks. More...

Public Member Functions

 DataTable (bool create_dependencies)
 Constructor.
bool AddDataFloat (int id, float dv, int size)
 Adds a DataFloat to the data_table.
bool AddDataInt (int id, int dv, int size)
 Adds a DataInt to the data_table.
bool AddDataBool (int id, bool dv, int size)
 Adds a DataBool to the data_table.
bool AddDataPoint3F (int id, GMT::Point3F dv, int size)
 Adds a DataPoint3F to the data_table.
bool AddDataColor (int id, GMT::Color dv, int size)
 Adds a DataColor to the data_table.
void UpdateIDToIndex ()
 Updates the id_to_index table.
bool GetValue (int id, float &value, int time=0, int item=0)
 Gets the specified value.
bool GetValue (int id, int &value, int time=0, int item=0)
 Gets the specified value.
bool GetValue (int id, bool &value, int time=0, int item=0)
 Gets the specified value.
bool GetValue (int id, GMT::Point3F &value, int time=0, int item=0)
 Gets the specified value.
bool GetValue (int id, GMT::Point3I &value, int time=0, int item=0)
 Gets the specified value.
bool GetValue (int id, GMT::Color &value, int time=0, int item=0)
 Gets the specified value.
float GetFloat (int id, int time=0, int item=0)
 Returns the specified value.
int GetInt (int id, int time=0, int item=0)
 Returns the specified value.
bool GetBool (int id, int time=0, int item=0)
 Returns the specified value.
GMT::Point3F GetPoint3F (int id, int time=0, int item=0)
 Returns the specified value.
GMT::Point3I GetPoint3I (int id, int time=0, int item=0)
 Returns the specified value.
GMT::Color GetColor (int id, int time=0, int item=0)
 Returns the specified value.
std::string GetDataName (int id)
 Returns the name for the specified Data.
ControllerGetAnimationContoller (int id, int item=0)
 Returns the Controller for the specified data.
bool SetValue (int id, float &value, int time=0, int item=0)
 Sets the specified value.
bool SetValue (int id, int &value, int time=0, int item=0)
 Sets the specified value.
bool SetValue (int id, bool &value, int time=0, int item=0)
 Sets the specified value.
bool SetValue (int id, GMT::Point3F &value, int time=0, int item=0)
 Sets the specified value.
bool SetValue (int id, GMT::Point3I &value, int time=0, int item=0)
 Sets the specified value.
bool SetValue (int id, GMT::Color &value, int time=0, int item=0)
 Sets the specified value.
bool SetDataName (int id, std::string name)
 Sets the name for the specified Data.
bool SetController (int id, Controller *control, int item=0)
 Sets the Controller for the specified Data.
std::string GetClassName ()
 Returns the name for this class.
int Properties ()
 Returns the Properties for this block.
BlockType GetBlockType ()
 Returns the BlockType for this class.
int NumDependencies ()
 Returns the number of Dependencies for this class.
void SetDependency (int id, Block *dependency)
 Sets a Dependency.
BlockGetDependency (int id)
 Returns the specified dependency.
std::string GetDependencyName (int id)
 Gets the name for the specified dependency.
int GetNumDataTables ()
 This class has no DataTables.
DataTableGetDataTable (int id=0)
 This class has no DataTables.
void SetDataTable (DataTable *d, int i=0)
 Sets the i_th data table.
void UpdateDataTable (int id=0)
 This class has no DataTables.
BlockClone ()
 Creates a copy of this object and return it.
int Save (SceneSave *scene_save)
 Saves the info for this class.
int Load (SceneLoad *scene_load)
 Loads the info for this class.
void DeleteThis ()
 Deletes this class.
void ActionBegin (int time, int action)
void ActionEnd (int time, int action)
void Update (int time)
void DependancyChanged (Block *dependancy, unsigned int message=0, unsigned int parameters=0)
int GetLastDataChanged ()
 Returns the id of the last data that changed in this DataTable.

Public Attributes

std::vector< Data * > data_table
 The table of Data.
std::vector< int > id_to_index
 Keeps the relationship between the ids and the indexes.

Static Public Attributes

static BlockType block_type

Detailed Description

Keeps the Data objects.

All the Data objects must be in this class.


Member Enumeration Documentation

enum ScEng::DataTable::CHUNKS

Enum Chunks.

Enums the chunks used for this class.

Enumerator:
ID_TO_INDEX_SIZE_CHUNKID  id_to_index size chunk
ID_TO_INDEX_CHUNKID  id_to_index chunk
DATA_TABLE_SIZE_CHUNKID  data_table size chunk


Member Function Documentation

bool ScEng::DataTable::AddDataFloat ( int  id,
float  dv,
int  size 
)

Adds a DataFloat to the data_table.

Parameters:
id the id for the data to be added
dv the default value for this data
size the size for the DataFloat
Returns:
Returns false if there is a Data with the same id
See also:
DataFloat

bool ScEng::DataTable::AddDataInt ( int  id,
int  dv,
int  size 
)

Adds a DataInt to the data_table.

Parameters:
id the id for the data to be added
dv the default value for this data
size the size for the DataInt
Returns:
Returns false if there is a Data with the same id
See also:
DataInt

bool ScEng::DataTable::AddDataBool ( int  id,
bool  dv,
int  size 
)

Adds a DataBool to the data_table.

Parameters:
id the id for the data to be added
dv the default value for this data
size the size for the DataBool
Returns:
Returns false if there is a Data with the same id
See also:
DataBool

bool ScEng::DataTable::AddDataPoint3F ( int  id,
GMT::Point3F  dv,
int  size 
)

Adds a DataPoint3F to the data_table.

Parameters:
id the id for the data to be added
dv the default value for this data
size the size for the DataPoint3F
Returns:
Returns false if there is a Data with the same id
See also:
DataPoint3F

bool ScEng::DataTable::AddDataColor ( int  id,
GMT::Color  dv,
int  size 
)

Adds a DataColor to the data_table.

Parameters:
id the id for the data to be added
dv the default value for this data
size the size for the DataColor
Returns:
Returns false if there is a Data with the same id
See also:
DataColor

bool ScEng::DataTable::GetValue ( int  id,
float &  value,
int  time = 0,
int  item = 0 
)

Gets the specified value.

Parameters:
id the id for the requested value
value here will be stored the data
time the time to get the value
item the specified item in the DataFloat
Returns:
Returns True if the id exists, if not returns false

bool ScEng::DataTable::GetValue ( int  id,
int &  value,
int  time = 0,
int  item = 0 
)

Gets the specified value.

Parameters:
id the id for the requested value
value here will be stored the data
time the time to get the value
item the specified item in the DataInt
Returns:
Returns True if the id exists, if not returns false

bool ScEng::DataTable::GetValue ( int  id,
bool &  value,
int  time = 0,
int  item = 0 
)

Gets the specified value.

Parameters:
id the id for the requested value
value here will be stored the data
time the time to get the value
item the specified item in the DataBool
Returns:
Returns True if the id exists, if not returns false

bool ScEng::DataTable::GetValue ( int  id,
GMT::Point3F &  value,
int  time = 0,
int  item = 0 
)

Gets the specified value.

Parameters:
id the id for the requested value
value here will be stored the data
time the time to get the value
item the specified item in the DataPoint3F
Returns:
Returns True if the id exists, if not returns false

bool ScEng::DataTable::GetValue ( int  id,
GMT::Point3I &  value,
int  time = 0,
int  item = 0 
)

Gets the specified value.

Parameters:
id the id for the requested value
value here will be stored the data
time the time to get the value
item the specified item in the DataPoint3I
Returns:
Returns True if the id exists, if not returns false

bool ScEng::DataTable::GetValue ( int  id,
GMT::Color &  value,
int  time = 0,
int  item = 0 
)

Gets the specified value.

Parameters:
id the id for the requested value
value here will be stored the data
time the time to get the value
item the specified item in the DataColor
Returns:
Returns True if the id exists, if not returns false

float ScEng::DataTable::GetFloat ( int  id,
int  time = 0,
int  item = 0 
)

Returns the specified value.

Parameters:
id the id for the requested value
time the time to get the value
item the specified item in the DataFloat
Returns:
Returns the value if the id exists, if not returns -1

int ScEng::DataTable::GetInt ( int  id,
int  time = 0,
int  item = 0 
)

Returns the specified value.

Parameters:
id the id for the requested value
time the time to get the value
item the specified item in the DataInt
Returns:
Returns the value if the id exists, if not returns -1

bool ScEng::DataTable::GetBool ( int  id,
int  time = 0,
int  item = 0 
)

Returns the specified value.

Parameters:
id the id for the requested value
time the time to get the value
item the specified item in the DataBool
Returns:
Returns the value if the id exists, if not returns -1

GMT::Point3F ScEng::DataTable::GetPoint3F ( int  id,
int  time = 0,
int  item = 0 
)

Returns the specified value.

Parameters:
id the id for the requested value
time the time to get the value
item the specified item in the DataPoint3F
Returns:
Returns the value if the id exists, if not returns -1

GMT::Point3I ScEng::DataTable::GetPoint3I ( int  id,
int  time = 0,
int  item = 0 
)

Returns the specified value.

Parameters:
id the id for the requested value
time the time to get the value
item the specified item in the DataPoint3I
Returns:
Returns the value if the id exists, if not returns -1

GMT::Color ScEng::DataTable::GetColor ( int  id,
int  time = 0,
int  item = 0 
)

Returns the specified value.

Parameters:
id the id for the requested value
time the time to get the value
item the specified item in the DataColor
Returns:
Returns the value if the id exists, if not returns -1

std::string ScEng::DataTable::GetDataName ( int  id  ) 

Returns the name for the specified Data.

Parameters:
id the id for the requested value
Returns:
Id the Data exists returns his name if not returns "Error"

Controller * ScEng::DataTable::GetAnimationContoller ( int  id,
int  item = 0 
)

Returns the Controller for the specified data.

Parameters:
id the id for the requested Controller
Returns:
Id the Data exists returns his Control if not returns NULL

bool ScEng::DataTable::SetValue ( int  id,
float &  value,
int  time = 0,
int  item = 0 
)

Sets the specified value.

Parameters:
id the id for the DataFloat to be set
value this is the data that will be set
time the time to set the value
item the specified item in the DataFloat
Returns:
Returns True if the id exists, if not returns NULL

bool ScEng::DataTable::SetValue ( int  id,
int &  value,
int  time = 0,
int  item = 0 
)

Sets the specified value.

Parameters:
id the id for the DataInt to be set
value this is the data that will be set
time the time to set the value
item the specified item in the DataInt
Returns:
Returns True if the id exists, if not returns NULL

bool ScEng::DataTable::SetValue ( int  id,
bool &  value,
int  time = 0,
int  item = 0 
)

Sets the specified value.

Parameters:
id the id for the DataBool to be set
value this is the data that will be set
time the time to set the value
item the specified item in the DataBool
Returns:
Returns True if the id exists, if not returns NULL

bool ScEng::DataTable::SetValue ( int  id,
GMT::Point3F &  value,
int  time = 0,
int  item = 0 
)

Sets the specified value.

Parameters:
id the id for the DataPoint3F to be set
value this is the data that will be set
time the time to set the value
item the specified item in the DataPoint3F
Returns:
Returns True if the id exists, if not returns NULL

bool ScEng::DataTable::SetValue ( int  id,
GMT::Point3I &  value,
int  time = 0,
int  item = 0 
)

Sets the specified value.

Parameters:
id the id for the DataPoint3I to be set
value this is the data that will be set
time the time to set the value
item the specified item in the DataPoint3I
Returns:
Returns True if the id exists, if not returns NULL

bool ScEng::DataTable::SetValue ( int  id,
GMT::Color &  value,
int  time = 0,
int  item = 0 
)

Sets the specified value.

Parameters:
id the id for the DataColor to be set
value this is the data that will be set
time the time to set the value
item the specified item in the DataColor
Returns:
Returns True if the id exists, if not returns NULL

bool ScEng::DataTable::SetDataName ( int  id,
std::string  name 
)

Sets the name for the specified Data.

Parameters:
id the id for the Data
name the name to be assigned to the specified Data
Returns:
Returns True if the id exists, if not returns False

bool ScEng::DataTable::SetController ( int  id,
Controller control,
int  item = 0 
)

Sets the Controller for the specified Data.

Parameters:
id the id for the Data
Returns:
Returns True if the id exists, if not returns False

std::string ScEng::DataTable::GetClassName (  )  [virtual]

Returns the name for this class.

Returns:
Returns "DataTable"

Implements ScEng::Block.

int ScEng::DataTable::Properties (  )  [inline, virtual]

Returns the Properties for this block.

Returns:
Return the property

Implements ScEng::Block.

BlockType ScEng::DataTable::GetBlockType (  )  [virtual]

Returns the BlockType for this class.

Returns:
Returns SE_DATA_TABLE_BLOCK_TYPE

Implements ScEng::Block.

int ScEng::DataTable::NumDependencies (  )  [virtual]

Returns the number of Dependencies for this class.

Returns:
Returns the size of the data_table
See also:
data_table

Implements ScEng::Block.

void ScEng::DataTable::SetDependency ( int  id,
Block dependency 
) [virtual]

Sets a Dependency.

Sets the specified data.

Parameters:
id the ID for data in the data_table
dependency the dependency
See also:
enum data_table

Implements ScEng::Block.

Block * ScEng::DataTable::GetDependency ( int  id  )  [virtual]

Returns the specified dependency.

Parameters:
id the ID for the data.
Returns:
If the ID is correct returns the correspondent Data. If not returns NULL

Implements ScEng::Block.

DataTable* ScEng::DataTable::GetDataTable ( int  id = 0  )  [inline, virtual]

This class has no DataTables.

Returns:
Returns NULL

Reimplemented from ScEng::Block.

Block * ScEng::DataTable::Clone (  )  [virtual]

Creates a copy of this object and return it.

The caller of this function is responsible to add this block to the DAG or to delete it.

Implements ScEng::Block.

void ScEng::DataTable::ActionBegin ( int  time,
int  action 
) [inline, virtual]

Informs the block that an action will begin

Parameters:
time the time at which the action begins. more details about the action, for example, it can be a RENDER_ACTION, or a SAVE_ACTION.

Reimplemented from ScEng::Block.

void ScEng::DataTable::ActionEnd ( int  time,
int  action 
) [inline, virtual]

Informs the block that an action will end.

Parameters:
time the time at which the action ends. more details about the action, for example, it can be a RENDER_ACTION, or a SAVE_ACTION.

Reimplemented from ScEng::Block.

void ScEng::DataTable::Update ( int  time  )  [inline, virtual]

Informs the block that it needs to update its data. For example, texture and material blocks usually move all their animated parameters from the data_table to int or float variables. This is specially useful when rendering, so there is no need to interpolate a data_value every time.

Parameters:
time the time at which the block needs to update its data.

Reimplemented from ScEng::Block.

void ScEng::DataTable::DependancyChanged ( Block dependancy,
unsigned int  message = 0,
unsigned int  parameters = 0 
) [inline, virtual]

A block receives this message when one of its dependencies has changed.

Parameters:
dependency The dependancy that changed
message A message about the change

Reimplemented from ScEng::Block.


Member Data Documentation

BlockType ScEng::DataTable::block_type [static]

The type of this block BlockType DataTable::block_type( BlockType::DATA, 0x01000000,0x00000020 )


The documentation for this class was generated from the following files:
Generated on Thu Sep 6 10:49:22 2007 for SceneEngine by  doxygen 1.5.1-p1