AnimatLab
2
Test
|
Saves the data in memory. More...
#include <MemoryChart.h>
Public Member Functions | |
MemoryChart () | |
Default constructor. More... | |
virtual | ~MemoryChart () |
Destructor. More... | |
virtual void | Initialize () |
Initializes this object. More... | |
virtual void | Load (CStdXml &oXml) |
virtual bool | Lock () |
Locks this data chart buffer from being written by any other process. More... | |
virtual void | StepSimulation () |
Step the simulation for this object. More... | |
virtual std::string | Type () |
returns the string type name of this object. More... | |
virtual void | Unlock () |
Unlocks this data chart buffer from being written by any other process. 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 | Deactivate () |
Deactivates this item. 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 | 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 void | ResetSimulation () |
Resets the simulation back to time 0. 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 float * | TimeBuffer () |
Gets the time buffer. 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 MemoryChart * | 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 | |
CStdCriticalSection * | m_oRowCountLock |
Critical section to lock access to the data buffer for writing. | |
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 () |
Saves the data in memory.
This chart is primarily used by the GUI It keeps the data buffer filled up. If the buffer starts to run over it zeros out the data and starts back at the beginning. This allows the AnimatGUI::Tools::DataChart to poll the MemoryChart on a regular bases so it can suck the data up. When it does this it transfers the stored data from the MemoryChart to the GUI chart and erases it from the MemoryChart and starts collecting all over again. If for some reason the GUI chart does not retrieve the data before the buffer is about to fill up, then we start the collection over so we do not get a buffer overrun, and that data would be lost to the GUI chart.
Definition at line 27 of file MemoryChart.h.
AnimatSim::Charting::MemoryChart::MemoryChart | ( | ) |
Default constructor.
Definition at line 54 of file MemoryChart.cpp.
References m_oRowCountLock.
|
virtual |
Destructor.
Definition at line 65 of file MemoryChart.cpp.
References m_oRowCountLock, and StdUtils::Std_TraceMsg().
|
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 93 of file MemoryChart.cpp.
References AnimatSim::Charting::DataChart::Initialize().
|
virtual |
Locks this data chart buffer from being written by any other process.
This is for multi-threaded environments. It is called just before data is added to the buffer to prevent any other process from modifying the buffer while we are doing so.
Reimplemented from AnimatSim::Charting::DataChart.
Definition at line 79 of file MemoryChart.cpp.
References m_oRowCountLock.
|
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.
Reimplemented from AnimatSim::Charting::DataChart.
Definition at line 102 of file MemoryChart.cpp.
References AnimatSim::Charting::DataChart::m_bSetStartEndTime, AnimatSim::Charting::DataChart::m_iCollectInterval, AnimatSim::Charting::DataChart::m_lCurrentRow, AnimatSim::AnimatBase::m_lpSim, AnimatSim::Charting::DataChart::m_lRowCount, m_oRowCountLock, AnimatSim::Charting::DataChart::StepSimulation(), and AnimatSim::Simulator::TimeSlice().
|
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 77 of file MemoryChart.cpp.
|
virtual |
Unlocks this data chart buffer from being written by any other process.
This is for multi-threaded environments. It is called just after data is added to the buffer to remove the lock so that other process can modify the buffer.
Reimplemented from AnimatSim::Charting::DataChart.
Definition at line 87 of file MemoryChart.cpp.
References m_oRowCountLock.