AnimatLab
2
Test
|
File chart. More...
#include <FileChart.h>
Public Member Functions | |
FileChart () | |
Default constructor. More... | |
virtual | ~FileChart () |
Destructor. More... | |
virtual void | Deactivate () |
Deactivates this item. More... | |
virtual void | Initialize () |
Initializes this object. More... | |
virtual void | Load (CStdXml &oXml) |
virtual std::string | OutputFilename () |
Gets the output filename. More... | |
virtual void | OutputFilename (std::string strVal) |
Sets the Output filename. More... | |
virtual void | ResetSimulation () |
Resets the simulation back to time 0. More... | |
virtual void | SaveOutput () |
Saves the data to the specified output file in a tsv format. More... | |
virtual std::string | Type () |
returns the string type name of this object. More... | |
Public Member Functions inherited from AnimatSim::Charting::DataChart | |
DataChart () | |
Default constructor. More... | |
virtual | ~DataChart () |
Destructor. More... | |
virtual void | Activate () |
Activates this item. More... | |
virtual void | AddColumn (DataColumn *lpColumn) |
Adds a column. More... | |
virtual void | AddColumn (std::string strXml, bool bDoNotInit) |
Creates and adds a DataColumn from XML. More... | |
virtual void | AddData (int iColumn, int iRow, float fltVal) |
Adds a data element to the data buffer. 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 long | BufferByteSize () |
Gets the buffer byte size. More... | |
virtual long | BufferSize () |
Gets the buffer size. More... | |
virtual float | ChartTimeBase () |
Gets the Time base used by this data chart. More... | |
virtual int | CollectInterval () |
Gets the collect interval. More... | |
virtual void | CollectInterval (int iVal, bool bReInit=true) |
Sets the Collect interval using the time slice. More... | |
virtual void | CollectInterval (float fltVal, bool bReInit=true) |
Sets the Collect interval using the time. More... | |
virtual long | CollectTimeWindow () |
Gets the collect time window time slices. More... | |
virtual void | CollectTimeWindow (long lVal, bool bReInit=true) |
Sets the Collect time window using time slices. More... | |
virtual void | CollectTimeWindow (float fltVal, bool bReInit=true) |
Sets the collect time window in time value. More... | |
virtual long | ColumnCount () |
Gets the column count. More... | |
virtual long | CurrentRow () |
Gets the current row. More... | |
virtual void | CurrentRow (long iVal) |
Sets the Current row. More... | |
virtual float * | DataBuffer () |
Gets the data buffer. More... | |
virtual void | EndTime (float fltVal, bool bReInit=true) |
virtual DataColumn * | FindColumn (std::string strID, bool bThrowError=true) |
Searches for a column that matches the specified ID. More... | |
virtual void | Load (std::string strProjectPath, std::string strConfigFile) |
Loads a data chart from a file. More... | |
virtual bool | Lock () |
Locks this data chart buffer from being written by any other process. More... | |
virtual bool | operator< (ActivatedItem *lpItem) |
Compares the Start slice time of two data charts to tell if one is less than the other. More... | |
virtual std::string | ProjectPath () |
Gets the project path. More... | |
virtual void | ProjectPath (std::string strVal) |
Sets the Project path. 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 void | RemoveColumn (std::string strID, bool bThrowError=true) |
Removes the column with the specified ID. More... | |
virtual bool | RemoveItem (const std::string &strItemType, const std::string &strID, bool bThrowError=true) |
Removes a child item from this parent. More... | |
virtual long | RowCount () |
Gets the row count. More... | |
virtual void | SetData (int iColumn, int iRow, float fltVal) |
Sets a data element to the data buffer. 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 bool | SetStartEndTime () |
Gets whether a start/end time is set for this chart. More... | |
virtual void | SetStartEndTime (bool bVal) |
Sets whether a start/end time is specified for this chart. More... | |
virtual void | StartTime (float fltVal, bool bReInit=true) |
virtual void | StepSimulation () |
Step the simulation for this object. More... | |
virtual float * | TimeBuffer () |
Gets the time buffer. More... | |
virtual void | Unlock () |
Unlocks this data chart buffer from being written by any other process. More... | |
virtual long | UsedBufferByteSize () |
Gets the used buffer byte size. More... | |
virtual long | UsedBufferSize () |
Gets the size of buffer that is currently used. More... | |
Public Member Functions inherited from AnimatSim::ActivatedItem | |
ActivatedItem () | |
Default constructor. More... | |
virtual | ~ActivatedItem () |
Destructor. More... | |
virtual bool | AlwaysActive () |
Gets whether this item is always active. More... | |
virtual void | AlwaysActive (bool bVal) |
Sets whether this item is always active. More... | |
virtual bool | Enabled () |
Gets whether the item is enabled or not. More... | |
virtual void | Enabled (bool bVal) |
Enables the item. More... | |
virtual long | EndSlice () |
Gets the end time slice for deactivation. More... | |
virtual void | EndSlice (long lVal, bool bReInit=true) |
virtual float | EndTime () |
Gets the end simulation time for deactivation. More... | |
bool | IsActivated () |
Query if this object is activated. More... | |
bool | IsInitialized () |
Query if this object is initialized. More... | |
virtual bool | LoadedTime () |
Gets whether time was loaded or time slices. More... | |
virtual void | LoadedTime (bool bVal) |
Sets whether time was loaded. More... | |
bool | NeedToActivate () |
Determines if this item needs to be activated. More... | |
bool | NeedToDeactivate () |
Determines if this item needs to be deactivated. More... | |
virtual bool | NeedToStep () |
Tells if this item needs to call StepSimulation or not. More... | |
virtual bool | Overlaps (ActivatedItem *lpItem) |
Query if this object overlaps the time period for another ActivatedItem. More... | |
virtual long | StartSlice () |
Returns the starts slice for activation. More... | |
virtual void | StartSlice (long lVal, bool bReInit=true) |
virtual float | StartTime () |
Gets the simulation start time for activation. More... | |
virtual int | StepInterval () |
Gets the step interval. More... | |
virtual void | StepInterval (int iVal) |
Sets the step interval. More... | |
virtual int | StepIntervalCount () |
Gets the step interval count. More... | |
virtual void | StepIntervalCount (int iVal) |
Step interval count. More... | |
virtual void | TimeStepModified () |
Notification method that the time step modified has been modified. Objects should recalculate any slice times as needed. More... | |
Public Member Functions inherited from AnimatSim::AnimatBase | |
AnimatBase () | |
Constructs an AnimatBase object. More... | |
virtual | ~AnimatBase () |
Destroys the AnimatBase object.. 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 float * | GetDataPointer (const std::string &strDataType) |
Returns a float pointer to a data item of interest in this object. More... | |
virtual NeuralModule * | GetNeuralModule () |
Gets the neural module. More... | |
virtual Node * | GetNode () |
Gets the node. More... | |
virtual Simulator * | GetSimulator () |
Gets the simulator pointer. More... | |
virtual Structure * | GetStructure () |
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 void | Name (std::string strValue) |
Sets the name of the object. Blank is acceptable. More... | |
virtual AnimatPropertyType | PropertyType (const std::string &strName) |
virtual void | Reset () |
Resets this object. 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 | Type (std::string strValue) |
Sets the class type for this object. More... | |
virtual void | VerifySystemPointers () |
Verify that system pointers have been set correctly. More... | |
virtual void | VisualSelectionModeChanged (int iNewMode) |
Visual selection mode changed. More... | |
Static Public Member Functions | |
static FileChart * | CastToDerived (AnimatBase *lpBase) |
Static Public Member Functions inherited from AnimatSim::Charting::DataChart | |
static DataChart * | CastToDerived (AnimatBase *lpBase) |
Static Public Member Functions inherited from AnimatSim::ActivatedItem | |
static ActivatedItem * | CastToDerived (AnimatBase *lpBase) |
Protected Attributes | |
std::string | m_strOutputFilename |
Filename of the output file. | |
std::ofstream | oStream |
The file stream. | |
Protected Attributes inherited from AnimatSim::Charting::DataChart | |
CStdMap< std::string, DataColumn * > | m_aryColumnsMap |
The array of datacolumns columns. This is a sorted map that is used to get columns based on their ID. | |
float * | m_aryDataBuffer |
Buffer for data variable points. | |
CStdPtrArray< DataColumn > | m_aryDataColumns |
The primary array of data columns. This array deletes the columns when destructed. | |
float * | m_aryTimeBuffer |
Buffer for time data points. | |
bool | m_bSetStartEndTime |
true to set the start and end time. If false then the chart collects continuously. | |
float | m_fltCollectInterval |
Tells what the time slice step interval to use when collecting data. This is. | |
float | m_fltCollectTimeWindow |
The time duration where we will collect data. | |
short | m_iCollectInterval |
Tells what the time slice step interval to use when collecting data. This is. | |
long | m_lCollectTimeWindow |
The number of time slices where we will collect data. | |
long | m_lColumnCount |
Number of data columns. | |
int | m_lCurrentCol |
The currently selected column. | |
int | m_lCurrentRow |
The currently selected row. | |
long | m_lRowCount |
Number of rows in the buffer. | |
std::string | m_strConfigFilename |
Filename of the configuration file. | |
std::string | m_strProjectPath |
Full pathname of the project file. | |
Protected Attributes inherited from AnimatSim::ActivatedItem | |
bool | m_bAlwaysActive |
Determines whether this item is always active during simulation. | |
bool | m_bInitialized |
true if item has been initialized | |
bool | m_bIsActivated |
true if item has been activated | |
bool | m_bLoadedTime |
float | m_fltEndTime |
float | m_fltStartTime |
int | m_iStepInterval |
int | m_iStepIntervalCount |
Keeps track of how many time steps have occured since it was zeroed again. | |
long | m_lEndSlice |
The time slice where this item is deactived. | |
long | m_lStartSlice |
The time slice where this item becomes active. | |
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::NeuralModule * | m_lpModule |
The pointer to this items parentNeuralModule. If this is not relevant for this object then this is NULL. | |
Node * | m_lpNode |
The pointer to this items parent Node. If this is not relevant for this object then this is NULL. | |
Simulator * | m_lpSim |
The pointer to a Simulation. | |
AnimatSim::Environment::Structure * | m_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.. | |
Additional Inherited Members | |
Protected Member Functions inherited from AnimatSim::Charting::DataChart | |
virtual long | CalculateChartColumnCount () |
Calculates the chart column count. More... | |
virtual DataColumn * | FindColumn (std::string strID, int &iIndex, bool bThrowError) |
Searches for a column that matches the specified ID. More... | |
DataColumn * | LoadDataColumn (CStdXml &oXml) |
Loads a data column. More... | |
Protected Member Functions inherited from AnimatSim::ActivatedItem | |
virtual void | SetSliceData () |
File chart.
This class is derived from DataChart, and its purpose is to save out the data into a tab seperated value (tsv) file when the chart reaches its end time and is deactivated. It rights the data columns out using the uer specified Index for each column. This class is primarily used when running the simulation in stand-alone mode without any GUI. The GUI uses the MemoryChart instead.
Definition at line 24 of file FileChart.h.
AnimatSim::Charting::FileChart::FileChart | ( | ) |
|
virtual |
Destructor.
Definition at line 64 of file FileChart.cpp.
References StdUtils::Std_TraceMsg().
|
virtual |
Deactivates this item.
Reimplemented from AnimatSim::Charting::DataChart.
Definition at line 111 of file FileChart.cpp.
References AnimatSim::Charting::DataChart::Deactivate(), and SaveOutput().
|
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.
Reimplemented from AnimatSim::Charting::DataChart.
Definition at line 102 of file FileChart.cpp.
References AnimatSim::Charting::DataChart::Initialize(), m_strOutputFilename, AnimatSim::Charting::DataChart::m_strProjectPath, and oStream.
|
virtual |
Gets the output filename.
Definition at line 84 of file FileChart.cpp.
References m_strOutputFilename.
|
virtual |
Sets the Output filename.
strVal | The new name. |
Definition at line 94 of file FileChart.cpp.
References m_strOutputFilename, and StdUtils::Std_IsBlank().
|
virtual |
Resets the simulation back to time 0.
This method calls the ResetSimulation method on all subitems in order to reset the simulation back to the beginning.
Reimplemented from AnimatSim::Charting::DataChart.
Definition at line 121 of file FileChart.cpp.
References m_strOutputFilename, AnimatSim::Charting::DataChart::m_strProjectPath, oStream, and AnimatSim::Charting::DataChart::ResetSimulation().
|
virtual |
Saves the data to the specified output file in a tsv format.
Definition at line 146 of file FileChart.cpp.
References AnimatSim::Charting::DataChart::m_aryDataBuffer, AnimatSim::Charting::DataChart::m_aryDataColumns, AnimatSim::Charting::DataChart::m_iCollectInterval, AnimatSim::Charting::DataChart::m_lColumnCount, AnimatSim::AnimatBase::m_lpSim, AnimatSim::Charting::DataChart::m_lRowCount, AnimatSim::ActivatedItem::m_lStartSlice, oStream, and AnimatSim::Simulator::TimeStep().
Referenced by Deactivate().
|
virtual |
returns the string type name of this object.
Gets the string type description of this object. This is basically just another type of tag that can be applied by the developer of a class to differentiate it. An example of where this is used is in the synaptic types class. I use it to specify the synapse type as gated, modulatory, etc.. They still have different classes, but this gives a string description of that type. It is not mandatory and can be used how the class developer requires.
Reimplemented from AnimatSim::Charting::DataChart.
Definition at line 74 of file FileChart.cpp.