AnimatLab  2
Test
DataChart.h
Go to the documentation of this file.
1 
7 #pragma once
8 
9 namespace AnimatSim
10 {
11 
17  namespace Charting
18  {
31  class ANIMAT_PORT DataChart : public ActivatedItem
32  {
33  protected:
35  std::string m_strProjectPath;
36 
38  std::string m_strConfigFilename;
39 
42 
45 
48 
51 
54 
56  // The columns added to this map are copies of the pointer. They are <b>not</b> deleted.
57  CStdMap<std::string, DataColumn *> m_aryColumnsMap;
58 
60  CStdPtrArray<DataColumn> m_aryDataColumns;
61 
64 
67 
70 
73 
76 
79 
80  virtual long CalculateChartColumnCount();
81  DataColumn *LoadDataColumn(CStdXml &oXml);
82  virtual DataColumn *FindColumn(std::string strID, int &iIndex, bool bThrowError);
83 
84  public:
85  DataChart();
86  virtual ~DataChart();
87 
88  static DataChart *CastToDerived(AnimatBase *lpBase) {return static_cast<DataChart*>(lpBase);}
89 
90  virtual std::string Type();
91 
92  virtual void StartTime(float fltVal, bool bReInit = true);
93  virtual void EndTime(float fltVal, bool bReInit = true);
94 
95  virtual bool SetStartEndTime();
96  virtual void SetStartEndTime(bool bVal);
97 
98  virtual long BufferSize();
99  virtual long UsedBufferSize();
100 
101  virtual long BufferByteSize();
102  virtual long UsedBufferByteSize();
103 
104  virtual float *TimeBuffer();
105  virtual float *DataBuffer();
106 
107  virtual int CollectInterval();
108  virtual void CollectInterval(int iVal, bool bReInit = true);
109  virtual void CollectInterval(float fltVal, bool bReInit = true);
110 
111  virtual float ChartTimeBase();
112 
113  virtual long CollectTimeWindow();
114  virtual void CollectTimeWindow(long lVal, bool bReInit = true);
115  virtual void CollectTimeWindow(float fltVal, bool bReInit = true);
116 
117  virtual std::string ProjectPath();
118  virtual void ProjectPath(std::string strVal);
119 
120  virtual long ColumnCount();
121  virtual long RowCount();
122 
123  virtual long CurrentRow();
124  virtual void CurrentRow(long iVal);
125 
126  virtual bool Lock();
127  virtual void Unlock();
128 
129  virtual void AddData(int iColumn, int iRow, float fltVal);
130  virtual void SetData(int iColumn, int iRow, float fltVal);
131 
132  virtual void Load(std::string strProjectPath, std::string strConfigFile);
133  virtual void Load(CStdXml &oXml);
134 
135  virtual void AddColumn(DataColumn *lpColumn);
136  virtual void AddColumn(std::string strXml, bool bDoNotInit);
137  virtual void RemoveColumn(std::string strID, bool bThrowError = true);
138  virtual DataColumn *FindColumn(std::string strID, bool bThrowError = true);
139 
140  virtual void Activate();
141  virtual void Deactivate();
142 
143 #pragma region DataAccesMethods
144  virtual bool SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError = true);
145  virtual void QueryProperties(CStdPtrArray<TypeProperty> &aryProperties);
146  virtual bool AddItem(const std::string &strItemType, const std::string &strXml, bool bThrowError = true, bool bDoNotInit = false);
147  virtual bool RemoveItem(const std::string &strItemType, const std::string &strID, bool bThrowError = true);
148 #pragma endregion
149 
150  virtual bool operator<(ActivatedItem *lpItem);
151  virtual void Initialize();
152  virtual void ReInitialize();
153  virtual void ResetSimulation();
154  virtual void StepSimulation();
155  };
156 
157  } //Charting
158 } //AnimatSim
std::string m_strConfigFilename
Filename of the configuration file.
Definition: DataChart.h:38
bool m_bSetStartEndTime
true to set the start and end time. If false then the chart collects continuously.
Definition: DataChart.h:41
Root namespace for the base simulation library for AnimatLab.
int m_lCurrentCol
The currently selected column.
Definition: DataChart.h:75
float * m_aryDataBuffer
Buffer for data variable points.
Definition: DataChart.h:66
long m_lCollectTimeWindow
The number of time slices where we will collect data.
Definition: DataChart.h:50
Data column class.
Definition: DataColumn.h:24
float m_fltCollectTimeWindow
The time duration where we will collect data.
Definition: DataChart.h:53
Base class for all activated items.
Definition: ActivatedItem.h:27
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...
Definition: DataChart.h:57
Data chart base class.
Definition: DataChart.h:31
long m_lColumnCount
Number of data columns.
Definition: DataChart.h:69
float m_fltCollectInterval
Tells what the time slice step interval to use when collecting data. This is.
Definition: DataChart.h:47
Animat base class.
Definition: AnimatBase.h:36
std::string m_strProjectPath
Full pathname of the project file.
Definition: DataChart.h:35
CStdPtrArray< DataColumn > m_aryDataColumns
The primary array of data columns. This array deletes the columns when destructed.
Definition: DataChart.h:60
long m_lRowCount
Number of rows in the buffer.
Definition: DataChart.h:72
float * m_aryTimeBuffer
Buffer for time data points.
Definition: DataChart.h:63
int m_lCurrentRow
The currently selected row.
Definition: DataChart.h:78
short m_iCollectInterval
Tells what the time slice step interval to use when collecting data. This is.
Definition: DataChart.h:44