AnimatLab  2
Test
AnimatSim::Charting::DataColumn Class Reference

Data column class. More...

#include <DataColumn.h>

+ Inheritance diagram for AnimatSim::Charting::DataColumn:
+ Collaboration diagram for AnimatSim::Charting::DataColumn:

Public Member Functions

 DataColumn ()
 Default constructor. More...
 
virtual ~DataColumn ()
 Destructor. More...
 
virtual void Activate ()
 
virtual int AppendSpaces ()
 Gets how many spaces to append. More...
 
virtual void AppendSpaces (int iSpaces)
 Sets whether to append spaces. More...
 
virtual int ColumnCount ()
 Gets the number of columns for this DataColumn. More...
 
virtual int ColumnIndex ()
 Gets the column index. More...
 
virtual void ColumnIndex (int iIndex)
 Sets the Column index. More...
 
virtual std::string DataType ()
 Gets the data type of the variable we are collecting. This is the value passed into GetDataPointer. More...
 
virtual void DataType (std::string strType)
 Sets the Data type of the variable we are collecting. This is the value passed into GetDataPointer. More...
 
virtual float * DataValue ()
 Gets the pointer to the data value we are collecting. More...
 
virtual void Deactivate ()
 
virtual void Initialize ()
 Initializes this object. More...
 
virtual bool IsInitialized ()
 Query if this object is initialized. More...
 
virtual void IsInitialized (bool bVal)
 Sets whether this column is initialized. More...
 
virtual void Load (CStdXml &oXml)
 
virtual void Name (std::string strValue)
 Sets the name of the object. Blank is acceptable. More...
 
virtual bool operator< (DataColumn *lpColumn)
 Determines if this column has an index value less than the index value of the column being passed in. More...
 
virtual void QueryProperties (CStdPtrArray< TypeProperty > &aryProperties)
 Queries this object for a list of properties that can be changed using SetData. More...
 
virtual void ReInitialize ()
 Re-initialize this object. More...
 
virtual int RowIndex ()
 Gets the row index. More...
 
virtual void RowIndex (int iIndex)
 Sets the Row index. More...
 
virtual void SaveColumnNames (std::ofstream &oStream)
 Saves this DataColumn name to the out stream for the file. More...
 
virtual bool SetData (const std::string &strDataType, const std::string &strValue, bool bThrowError=true)
 Set a variable based on a string data type name. More...
 
virtual void SetSystemPointers (Simulator *lpSim, Structure *lpStructure, NeuralModule *lpModule, Node *lpNode, DataChart *lpChart, bool bVerify)
 Sets the system pointers. More...
 
virtual void StepSimulation ()
 Step the simulation for this object. More...
 
virtual std::string TargetID ()
 Gets the GUID ID of the item to chart. More...
 
virtual void TargetID (std::string strID)
 Sets the GUID ID of teh item to chart. More...
 
virtual void VerifySystemPointers ()
 Verify that system pointers have been set correctly. More...
 
- Public Member Functions inherited from AnimatSim::AnimatBase
 AnimatBase ()
 Constructs an AnimatBase object. More...
 
virtual ~AnimatBase ()
 Destroys the AnimatBase object.. More...
 
virtual bool AddItem (const std::string &strItemType, const std::string &strXml, bool bThrowError=true, bool bDoNotInit=false)
 Adds a new object to this parent. More...
 
virtual void AfterResetSimulation ()
 Called after a simulation reset for some objects. More...
 
virtual long CalculateSnapshotByteSize ()
 Calculates the snapshot byte size. More...
 
virtual void Copy (CStdSerialize *lpSource)
 
virtual void Enabled (bool bVal)
 Tells whether this item is enabled or not. This is not actually used for all objects, only specific ones. I am putting it in the base class though to prevent numerous duplications. More...
 
virtual bool Enabled ()
 Tells whether this item is enabled or not. This is not actually used for all objects, only specific ones. I am putting it in the base class though to prevent numerous duplications. More...
 
virtual float * GetDataPointer (const std::string &strDataType)
 Returns a float pointer to a data item of interest in this object. More...
 
virtual NeuralModuleGetNeuralModule ()
 Gets the neural module. More...
 
virtual NodeGetNode ()
 Gets the node. More...
 
virtual SimulatorGetSimulator ()
 Gets the simulator pointer. More...
 
virtual StructureGetStructure ()
 Gets the structure for this node. More...
 
virtual bool HasProperty (const std::string &strName)
 Queries this object if it has a property with the given name. More...
 
virtual std::string ID ()
 Gets the unique GUID ID of this object. More...
 
virtual void ID (std::string strValue)
 Sets the unique GUID ID of the object. More...
 
virtual void Kill (bool bState=true)
 Kills. More...
 
virtual void Load (StdUtils::CStdXml &oXml)
 Loads the item using an XML data packet. More...
 
virtual void LoadKeyFrameSnapshot (byte *aryBytes, long &lIndex)
 Loads a key frame snapshot. More...
 
virtual std::string Name ()
 Gets the name of this object. More...
 
virtual AnimatPropertyType PropertyType (const std::string &strName)
 
virtual bool RemoveItem (const std::string &strItemType, const std::string &strID, bool bThrowError=true)
 Removes a child item from this parent. More...
 
virtual void Reset ()
 Resets this object. More...
 
virtual void ResetSimulation ()
 Resets the simulation back to time 0. More...
 
virtual void RigidBodyAdded (std::string strID)
 
virtual void RigidBodyRemoved (std::string strID)
 
virtual void SaveKeyFrameSnapshot (byte *aryBytes, long &lIndex)
 Saves a key frame snapshot. More...
 
virtual bool Selected ()
 Tells if this items is selected or not. More...
 
virtual void Selected (bool bValue, bool bSelectMultiple)
 Selects this object. More...
 
virtual bool SetData (const std::string &strDataType, const float fltValue, bool bThrowError=true)
 Set a variable based on a string data type name. More...
 
virtual bool SetData (const std::string &strDataType, const long lValue, bool bThrowError=true)
 Set a variable based on a string data type name. More...
 
virtual void SetSystemPointers (Simulator *lpSim, Structure *lpStructure, NeuralModule *lpModule, Node *lpNode, bool bVerify)
 Sets the system pointers. More...
 
virtual void SimPausing ()
 Called just before the simulation pauses. More...
 
virtual void SimStarting ()
 Called just before the simulation starts. More...
 
virtual void SimStopping ()
 Called just before the simulation stops. More...
 
virtual void TimeStepModified ()
 Notification method that the time step modified has been modified. Objects should recalculate any slice times as needed. More...
 
virtual std::string Type ()
 returns the string type name of this object. More...
 
virtual void Type (std::string strValue)
 Sets the class type for this object. More...
 
virtual void VisualSelectionModeChanged (int iNewMode)
 Visual selection mode changed. More...
 

Static Public Member Functions

static DataColumnCastToDerived (AnimatBase *lpBase)
 

Protected Attributes

bool m_bInitialized
 true it this chart has been initialized
 
int m_iAppendSpaces
 Determines whether how many other tabs are added after this data is written to the file.
 
int m_iColumnIndex
 
int m_iRowIndex
 
DataChartm_lpChart
 Pointer to the parent DataChart.
 
float * m_lpDataValue
 Pointer to the data variable we are collecting.
 
AnimatBasem_lpTarget
 Pointer to the target object that contains the data variable we will be collecting.
 
std::string m_strDataType
 The Data type of the variable we will be collecting. This is passed into the GetDataPointer method of the object.
 
std::string m_strTargetID
 GUID ID of the target object that contains the variable we will be collecting.
 
- Protected Attributes inherited from AnimatSim::AnimatBase
bool m_bEnabled
 Tells if this item is enabled or not. If it is not enabled then it is not run.
 
bool m_bSelected
 Tells whether the object is selected or not.
 
AnimatSim::Behavior::NeuralModulem_lpModule
 The pointer to this items parentNeuralModule. If this is not relevant for this object then this is NULL.
 
Nodem_lpNode
 The pointer to this items parent Node. If this is not relevant for this object then this is NULL.
 
Simulatorm_lpSim
 The pointer to a Simulation.
 
AnimatSim::Environment::Structurem_lpStructure
 The pointer to this items parent Structure. If this is not relevant for this object then this is NULL.
 
std::string m_strID
 The unique Id for this object.
 
std::string m_strName
 The name for this object.
 
std::string m_strType
 The type for this object. Examples are Box, Plane, Neuron, etc..
 

Detailed Description

Data column class.

The data column class is responsible for collecting data from an object within the simulation and then adding that to the data chart. You typically will not need to derive a new class from this to specialize the data columnn. It is capable of getting any object in the system using its ID, and then you can specify the DataType in a call to GetDataPointer for that object to get a pointer to variable you need to chart.

Author
dcofer
Date
3/18/2011

Definition at line 24 of file DataColumn.h.

Constructor & Destructor Documentation

AnimatSim::Charting::DataColumn::DataColumn ( )

Default constructor.

Author
dcofer
Date
3/18/2011

Definition at line 49 of file DataColumn.cpp.

References m_bInitialized, m_iAppendSpaces, m_iColumnIndex, m_iRowIndex, and m_lpDataValue.

AnimatSim::Charting::DataColumn::~DataColumn ( )
virtual

Destructor.

Author
dcofer
Date
3/18/2011

Definition at line 64 of file DataColumn.cpp.

References m_lpDataValue.

Member Function Documentation

int AnimatSim::Charting::DataColumn::AppendSpaces ( )
virtual

Gets how many spaces to append.

Author
dcofer
Date
3/26/2011
Returns
Number of appends spaces.

Definition at line 147 of file DataColumn.cpp.

References m_iAppendSpaces.

void AnimatSim::Charting::DataColumn::AppendSpaces ( int  iSpaces)
virtual

Sets whether to append spaces.

Author
dcofer
Date
3/26/2011
Parameters
iSpacesThe spaces to append.

Definition at line 157 of file DataColumn.cpp.

References m_iAppendSpaces, and StdUtils::Std_InValidRange().

+ Here is the call graph for this function:

int AnimatSim::Charting::DataColumn::ColumnCount ( )
virtual

Gets the number of columns for this DataColumn.

Author
dcofer
Date
3/18/2011
Returns
Number of columns in the data buffer.

Definition at line 78 of file DataColumn.cpp.

int AnimatSim::Charting::DataColumn::ColumnIndex ( )
virtual

Gets the column index.

Author
dcofer
Date
3/26/2011
Returns
Column index.

Definition at line 171 of file DataColumn.cpp.

References m_iColumnIndex.

Referenced by SetData().

+ Here is the caller graph for this function:

void AnimatSim::Charting::DataColumn::ColumnIndex ( int  iIndex)
virtual

Sets the Column index.

Author
dcofer
Date
3/26/2011
Parameters
iIndexZero-based index of the column.

Definition at line 181 of file DataColumn.cpp.

References m_iColumnIndex, and StdUtils::Std_IsAboveMin().

+ Here is the call graph for this function:

std::string AnimatSim::Charting::DataColumn::DataType ( )
virtual

Gets the data type of the variable we are collecting. This is the value passed into GetDataPointer.

Author
dcofer
Date
3/18/2011
Returns
name of the data type to collect.

Definition at line 96 of file DataColumn.cpp.

References m_strDataType.

Referenced by SetData().

+ Here is the caller graph for this function:

void AnimatSim::Charting::DataColumn::DataType ( std::string  strType)
virtual

Sets the Data type of the variable we are collecting. This is the value passed into GetDataPointer.

Author
dcofer
Date
3/18/2011
Parameters
strTypeData Type of the data to collect.

Reimplemented in AnimatCarlSim::CsNeuronDataColumn.

Definition at line 106 of file DataColumn.cpp.

References m_strDataType, and StdUtils::Std_IsBlank().

+ Here is the call graph for this function:

float * AnimatSim::Charting::DataColumn::DataValue ( )
virtual

Gets the pointer to the data value we are collecting.

Author
dcofer
Date
3/18/2011
Returns
Pointer.

Definition at line 239 of file DataColumn.cpp.

References m_lpDataValue.

void AnimatSim::Charting::DataColumn::Initialize ( )
virtual

Initializes this object.

After an object is loaded in it must be initialized before it can be used. This allows the object to retrieve any pointers or setup memory that it will need during execution. Each object is responsible for initializing any of its child objects, so you simply need to call this method on the containing class to init all child objects. It also calls VerifySystemPointers to make sure that the system pointers have been setup correctly.

Author
dcofer
Date
3/1/2011

Reimplemented from AnimatSim::AnimatBase.

Reimplemented in AnimatCarlSim::CsNeuronDataColumn.

Definition at line 241 of file DataColumn.cpp.

References AnimatSim::Simulator::FindByID(), AnimatSim::AnimatBase::GetDataPointer(), AnimatSim::AnimatBase::Initialize(), m_bInitialized, m_lpDataValue, AnimatSim::AnimatBase::m_lpSim, m_lpTarget, m_strDataType, AnimatSim::AnimatBase::m_strID, and m_strTargetID.

Referenced by ReInitialize(), and SetData().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool AnimatSim::Charting::DataColumn::IsInitialized ( )
virtual

Query if this object is initialized.

Author
dcofer
Date
3/18/2011
Returns
true if initialized, false if not.

Definition at line 219 of file DataColumn.cpp.

References m_bInitialized.

void AnimatSim::Charting::DataColumn::IsInitialized ( bool  bVal)
virtual

Sets whether this column is initialized.

Author
dcofer
Date
3/18/2011
Parameters
bValtrue to set that it is initialized.

Definition at line 229 of file DataColumn.cpp.

References m_bInitialized.

void AnimatSim::Charting::DataColumn::Name ( std::string  strValue)
virtual

Sets the name of the object. Blank is acceptable.

Author
dcofer
Date
2/22/2011
Parameters
strValueThe name value.

Reimplemented from AnimatSim::AnimatBase.

Definition at line 81 of file DataColumn.cpp.

References AnimatSim::AnimatBase::m_strName, and StdUtils::Std_IsBlank().

+ Here is the call graph for this function:

bool AnimatSim::Charting::DataColumn::operator< ( DataColumn lpColumn)
virtual

Determines if this column has an index value less than the index value of the column being passed in.

This is used to sort the columns based on the index value.

Returns
true if this objects index value is less than the object passed in, false otherwise.

Definition at line 352 of file DataColumn.cpp.

References m_iColumnIndex.

void AnimatSim::Charting::DataColumn::QueryProperties ( CStdPtrArray< TypeProperty > &  aryProperties)
virtual

Queries this object for a list of properties that can be changed using SetData.

The method provides a list of the properties that can be set using the SetData method. It gives the property name and the type of data that should be passed to it. Valid date types are Boolean, Float, Integer, and Xml.

Author
dcofer
Date
2/22/2011
Parameters
aryNamesArray list of the property names.
strTypesArray list of the type that is associated with the cooresponding name in the list.
Returns
Nothing.

Reimplemented from AnimatSim::AnimatBase.

Definition at line 296 of file DataColumn.cpp.

References AnimatSim::AnimatBase::QueryProperties().

+ Here is the call graph for this function:

void AnimatSim::Charting::DataColumn::ReInitialize ( )
virtual

Re-initialize this object.

Some objects like data charts need to be re-initialized some times. An example of when that would be needed is when the simulation is re-started.

Author
dcofer
Date
3/1/2011

Reimplemented from AnimatSim::AnimatBase.

Definition at line 255 of file DataColumn.cpp.

References Initialize(), and m_bInitialized.

+ Here is the call graph for this function:

int AnimatSim::Charting::DataColumn::RowIndex ( )
virtual

Gets the row index.

Author
dcofer
Date
3/26/2011
Returns
row index.

Definition at line 195 of file DataColumn.cpp.

References m_iRowIndex.

void AnimatSim::Charting::DataColumn::RowIndex ( int  iIndex)
virtual

Sets the Row index.

Author
dcofer
Date
3/26/2011
Parameters
iIndexZero-based index of the row.

Definition at line 205 of file DataColumn.cpp.

References m_iRowIndex, and StdUtils::Std_IsAboveMin().

+ Here is the call graph for this function:

void AnimatSim::Charting::DataColumn::SaveColumnNames ( std::ofstream &  oStream)
virtual

Saves this DataColumn name to the out stream for the file.

Author
dcofer
Date
3/18/2011
Parameters
[in,out]oStreamThe file stream.

Definition at line 312 of file DataColumn.cpp.

References m_iAppendSpaces, and AnimatSim::AnimatBase::m_strName.

bool AnimatSim::Charting::DataColumn::SetData ( const std::string &  strDataType,
const std::string &  strValue,
bool  bThrowError = true 
)
virtual

Set a variable based on a string data type name.

This is a generic method that can be used to set any variable in an AnimatBase object by specifying the name of the variable and a string representation of that data. The GUI uses this method to set data into variables in the simulation when the user changes them in the UI. The value string can be as simple as a float or int, or as complex as an xml packet. It is the developers responsibilty to know what type of data is needed and to process it accordingly.

Author
dcofer
Date
2/22/2011
Parameters
strDataTypestring name of the data type to set.
strValueThe string value of the data. It is up to the developer to determine what this should be. For example, in most cases it is simply a float and you just have to convert it to a float and make the appropriate mutator method call. However, it can be any type of string, including an entire xml packet. It is the developers responsibility to know how to set and process the data as required.
bThrowErrortrue to throw error if there is a problem. If false then it will not return an error, just return false.
Returns
true if it succeeds, false if it fails.

Reimplemented from AnimatSim::AnimatBase.

Reimplemented in AnimatCarlSim::CsNeuronDataColumn.

Definition at line 269 of file DataColumn.cpp.

References ColumnIndex(), DataType(), Initialize(), AnimatSim::AnimatBase::SetData(), and StdUtils::Std_CheckString().

+ Here is the call graph for this function:

virtual void AnimatSim::Charting::DataColumn::SetSystemPointers ( Simulator lpSim,
Structure *  lpStructure,
NeuralModule *  lpModule,
Node lpNode,
DataChart lpChart,
bool  bVerify 
)
virtual

Sets the system pointers.

Author
dcofer
Date
3/18/2011
Parameters
[in,out]lpSimThe pointer to a simulation.
[in,out]lpStructureThe pointer to a structure.
[in,out]lpModuleThe pointer to a NeuralModule.
[in,out]lpNodeThe pointer to a node.
[in,out]lpChartThe pointer to the parent chart.
bVerifytrue to verify.

Referenced by AnimatSim::Charting::DataChart::LoadDataColumn().

+ Here is the caller graph for this function:

void AnimatSim::Charting::DataColumn::StepSimulation ( )
virtual

Step the simulation for this object.

This is called on an object each time it is stepped in the simulation. this is where its simulation code is processed. However, StepSimulation is not necessarily called every single time that the simulation as a whole is stepped. A good example of this is that neural modules can have different integration time steps. So a firing rate module may have a DT of 0.5 ms, while an integrate and fire model may have one of 0.1 ms. So the firing rate module would only get its StepSimulation method called every 5th time that the other module was called. This is all handed in the StepSimulation method of the Simulator and NervousSystem.

Author
dcofer
Date
3/1/2011

Reimplemented from AnimatSim::AnimatBase.

Definition at line 340 of file DataColumn.cpp.

References AnimatSim::Charting::DataChart::AddData(), m_iColumnIndex, m_iRowIndex, m_lpChart, and m_lpDataValue.

+ Here is the call graph for this function:

std::string AnimatSim::Charting::DataColumn::TargetID ( )
virtual

Gets the GUID ID of the item to chart.

Author
dcofer
Date
3/26/2011
Returns
ID of item to chart.

Definition at line 122 of file DataColumn.cpp.

References m_strTargetID.

void AnimatSim::Charting::DataColumn::TargetID ( std::string  strID)
virtual

Sets the GUID ID of teh item to chart.

Author
dcofer
Date
3/26/2011
Parameters
strIDID of the item to chart.

Definition at line 132 of file DataColumn.cpp.

References m_strTargetID, and StdUtils::Std_IsBlank().

+ Here is the call graph for this function:

void AnimatSim::Charting::DataColumn::VerifySystemPointers ( )
virtual

Verify that system pointers have been set correctly.

The system pointers should be set just after an object is created. However, if for some reason it was not then this could cause read/write memory access errors later on because we would be using NULL pointers. This method is called during SetSystemPointers, Load, and Initialize to verify that the pointers for that type of object have been set correctly. We are calling three different places to ensure that it is checked before use. For example, if you are doing a Load call then you want to check it before attempting the load, but there may be an object that does not Load, but only does Initialize. So we need to check it there as well.

Author
dcofer
Date
3/4/2011

Reimplemented from AnimatSim::AnimatBase.

Definition at line 332 of file DataColumn.cpp.

References m_lpChart, AnimatSim::AnimatBase::m_strName, and AnimatSim::AnimatBase::VerifySystemPointers().

+ Here is the call graph for this function:

Member Data Documentation

int AnimatSim::Charting::DataColumn::m_iColumnIndex
protected

This index is used to determine where in the array buffer that the data is stored. This is direclty related to the index in the array that is used in the GUI to retrieve the data, so they must match or the data plotted in the GUI will be for a different variable.

Definition at line 51 of file DataColumn.h.

Referenced by ColumnIndex(), DataColumn(), operator<(), and StepSimulation().

int AnimatSim::Charting::DataColumn::m_iRowIndex
protected

This index is only used for 3D Array type charts. For normal line charts it is simply -1. However, if it is not -1 then that means we want to specify the column and row where we should add the data for this column

Definition at line 55 of file DataColumn.h.

Referenced by DataColumn(), RowIndex(), and StepSimulation().


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