AnimatLab  2
Test
DataChart.cpp
Go to the documentation of this file.
1 
7 #include "StdAfx.h"
8 #include "IMovableItemCallback.h"
9 #include "ISimGUICallback.h"
10 #include "AnimatBase.h"
11 
12 #include "Gain.h"
13 #include "Node.h"
14 #include "Link.h"
15 #include "IPhysicsMovableItem.h"
16 #include "IPhysicsBody.h"
17 #include "BoundingBox.h"
18 #include "MovableItem.h"
19 #include "BodyPart.h"
20 #include "Joint.h"
21 #include "ReceptiveField.h"
22 #include "ContactSensor.h"
23 #include "RigidBody.h"
24 #include "Structure.h"
25 #include "NeuralModule.h"
26 #include "Adapter.h"
27 #include "NervousSystem.h"
28 #include "Organism.h"
29 #include "ActivatedItem.h"
30 #include "ActivatedItemMgr.h"
31 #include "DataColumn.h"
32 #include "DataChart.h"
33 #include "DataChartMgr.h"
34 #include "ExternalStimuliMgr.h"
35 #include "KeyFrame.h"
36 #include "SimulationRecorder.h"
37 #include "OdorType.h"
38 #include "Odor.h"
39 #include "Light.h"
40 #include "LightManager.h"
41 #include "Simulator.h"
42 
43 namespace AnimatSim
44 {
45  namespace Charting
46  {
47 
55 {
60  m_aryDataBuffer = NULL;
61  m_aryTimeBuffer = NULL;
62  m_lRowCount = 0;
63  m_lColumnCount = 0;
64  m_lCurrentCol = 0;
65  m_lCurrentRow = 0;
66 }
67 
75 {
76 
77 try
78 {
79  if(m_aryDataBuffer) delete[] m_aryDataBuffer;
80  if(m_aryTimeBuffer) delete[] m_aryTimeBuffer;
81  m_aryDataColumns.RemoveAll();
82 }
83 catch(...)
84 {Std_TraceMsg(0, "Caught Error in desctructor of DataChart\r\n", "", -1, false, true);}
85 }
86 
95 {
96  DataChart *lpChart = dynamic_cast<DataChart *>(lpItem);
97 
98  if(!lpChart)
99  THROW_ERROR(Al_Err_lItemNotDataChartType, Al_Err_strItemNotDataChartType);
100 
101  if(m_lStartSlice < lpChart->m_lStartSlice)
102  return true;
103 
104  if( (m_lStartSlice == lpChart->m_lStartSlice) && (m_lEndSlice < lpChart->m_lEndSlice))
105  return true;
106 
107  return false;
108 }
109 
110 std::string DataChart::Type() {return "DataChart";}
111 
112 void DataChart::StartTime(float fltVal, bool bReInit)
113 {
114  ActivatedItem::StartTime(fltVal, bReInit);
115 
116  if(bReInit)
117  ReInitialize();
118 }
119 
120 void DataChart::EndTime(float fltVal, bool bReInit)
121 {
122  ActivatedItem::EndTime(fltVal, bReInit);
123 
124  if(bReInit)
125  ReInitialize();
126 }
127 
137 
147 {
148  m_bSetStartEndTime = bVal;
150  ReInitialize();
151 }
152 
162 
172 
181 long DataChart::BufferByteSize() {return BufferSize()*sizeof(float);}
182 
191 long DataChart::UsedBufferByteSize() {return UsedBufferSize()*sizeof(float);}
192 
202 
212 
225 
234 void DataChart::CollectInterval(int iVal, bool bReInit)
235 {
236  m_iCollectInterval = iVal;
238 
239  if(bReInit)
240  ReInitialize();
241 }
242 
254 void DataChart::CollectInterval(float fltVal, bool bReInit)
255 {
256  Std_IsAboveMin((float) 0, fltVal, true, "CollectInterval");
257 
258  //Find min time step.
259  float fltMin = m_lpSim->MinTimeStep();
260 
261  m_iCollectInterval = (int) ((fltVal / fltMin) + 0.5f);
262 
263  //Lets calculate the number of slices for the collect interval.
266 
267  if(bReInit)
268  ReInitialize();
269 }
270 
280 {
281  float fltTimeBase = 0;
282  if(m_lpSim)
283  {
284  float fltMin = m_lpSim->MinTimeStep();
285  fltTimeBase = fltMin*m_iCollectInterval;
286  }
287 
288  return fltTimeBase;
289 }
290 
300 
309 void DataChart::CollectTimeWindow(long lVal, bool bReInit)
310 {
311  m_lCollectTimeWindow = lVal;
312 
313  if(bReInit)
314  ReInitialize();
315 }
316 
325 void DataChart::CollectTimeWindow(float fltVal, bool bReInit)
326 {
327  m_fltCollectTimeWindow = fltVal;
328 
329  if(m_fltCollectTimeWindow <= 0)
331  else
333 
334  if(bReInit)
335  ReInitialize();
336 }
337 
347 
356 void DataChart::ProjectPath(std::string strVal) {m_strProjectPath = strVal;}
357 
367 
377 
387 
396 void DataChart::CurrentRow(long iVal) {m_lCurrentRow = iVal;}
397 
409 bool DataChart::Lock() {return true;}
410 
421 
423 {
425 
426  if(m_fltCollectTimeWindow <= 0)
428  else
430 
431  //First lets determine the buffer space that will be required for this chart.
433  //We add 10 because we want the buffer to be bigger than the actual amount of data that is collected.
435 
436  long lBuffSize = m_lColumnCount * m_lRowCount;
437 
438  if(lBuffSize > MAX_DATA_CHART_BUFFER)
439  THROW_PARAM_ERROR(Al_Err_lExceededMaxBuffer, Al_Err_strExceededMaxBuffer, "Buffer Size", lBuffSize);
440 
441  if(m_aryDataBuffer) delete[] m_aryDataBuffer;
442  m_aryDataBuffer = NULL;
443 
444  if(m_aryTimeBuffer) delete[] m_aryTimeBuffer;
445  m_aryTimeBuffer = NULL;
446 
447  //Create the buffer and initialize it.
448  m_aryDataBuffer = new float[lBuffSize];
449  memset(m_aryDataBuffer, 0, (sizeof(float) * lBuffSize));
450 
451  m_aryTimeBuffer = new float[m_lRowCount];
452  memset(m_aryTimeBuffer, 0, (sizeof(float) * m_lRowCount));
453 
454  //Now sort the data columns based on their ID value.
455  stable_sort(m_aryDataColumns.begin(), m_aryDataColumns.end(), LessThanDataColumnCompare);
456 
457  //Now initialize the data columns.
458  int iCount = m_aryDataColumns.GetSize();
459  for(int iCol=0; iCol<iCount; iCol++)
460  m_aryDataColumns[iCol]->Initialize();
461 }
462 
464 {
465  if(!m_bInitialized)
466  Initialize();
467  else
468  {
469  //Re-init the end and start and collect interval slices based on the time and current timestep values.
470  StartTime(m_fltStartTime, false);
471  EndTime(m_fltEndTime, false);
473 
474  if(m_fltCollectTimeWindow <= 0)
476  else
478 
479  long lColumnCount = CalculateChartColumnCount();
480  //We add 10 because we want the buffer to be bigger than the actual amount of data that is collected.
481  long lRowCount = (m_lCollectTimeWindow/m_iCollectInterval) + 10;
482 
483  if(!m_aryDataBuffer || !m_aryTimeBuffer || lColumnCount != m_lColumnCount || lRowCount != m_lRowCount)
484  {
485  m_lColumnCount = lColumnCount;
486  m_lRowCount = lRowCount;
487 
488  long lBuffSize = m_lColumnCount * m_lRowCount;
489 
490  if(lBuffSize > MAX_DATA_CHART_BUFFER)
491  THROW_PARAM_ERROR(Al_Err_lExceededMaxBuffer, Al_Err_strExceededMaxBuffer, "Buffer Size", lBuffSize);
492 
493  if(m_aryDataBuffer) delete[] m_aryDataBuffer;
494  m_aryDataBuffer = NULL;
495 
496  if(m_aryTimeBuffer) delete[] m_aryTimeBuffer;
497  m_aryTimeBuffer = NULL;
498 
499  //Create the buffer and initialize it.
500  m_aryDataBuffer = new float[lBuffSize];
501  memset(m_aryDataBuffer, 0, (sizeof(float) * lBuffSize));
502 
503  m_aryTimeBuffer = new float[m_lRowCount];
504  memset(m_aryTimeBuffer, 0, (sizeof(float) * m_lRowCount));
505 
506  //Start the current row back over at 0 again.
507  m_lCurrentRow = 0;
508  }
509 
510  //Now sort the data columns based on their ID value.
511  stable_sort(m_aryDataColumns.begin(), m_aryDataColumns.end(), LessThanDataColumnCompare);
512 
513  //Now initialize the data columns.
514  int iCount = m_aryDataColumns.GetSize();
515  for(int iCol=0; iCol<iCount; iCol++)
516  {
517  //If initialization fails then we need to remove the one that failed.
518  try
519  {
520  m_aryDataColumns[iCol]->ReInitialize();
521  }
522  catch(CStdErrorInfo oError)
523  {
524  m_aryDataColumns.RemoveAt(iCol);
525  RELAY_ERROR(oError);
526  }
527  catch(...)
528  {
529  m_aryDataColumns.RemoveAt(iCol);
530  THROW_ERROR(Std_Err_lUnspecifiedError, Std_Err_strUnspecifiedError);
531  }
532 
533  }
534  }
535 }
536 
538 {
540  m_lCurrentCol = 0;
541  m_lCurrentRow = 0;
542  ReInitialize();
543 }
544 
556 {
557  long lColCount=0;
558  int iCount = m_aryDataColumns.GetSize();
559  for(int iCol=0; iCol<iCount; iCol++)
560  lColCount += m_aryDataColumns[iCol]->ColumnCount();
561 
562  return lColCount;
563 }
564 
575 void DataChart::AddColumn(std::string strXml, bool bDoNotInit)
576 {
577  CStdXml oXml;
578  oXml.Deserialize(strXml);
579  oXml.FindElement("Root");
580  oXml.FindChildElement("DataColumn");
581 
582  LoadDataColumn(oXml);
583  ReInitialize();
584 }
585 
595 {
596  //First lets make sure this is a unique item key.
597  try
598  {
599  m_aryColumnsMap.Add(Std_CheckString(lpColumn->ID()), lpColumn);
600  }
601  catch(CStdErrorInfo oError)
602  {
603  oError.m_strError += " Duplicate data column ID: " + lpColumn->ID();
604  THROW_ERROR(oError.m_lError, oError.m_strError);
605  }
606 
607  m_aryDataColumns.Add(lpColumn);
608 }
609 
619 void DataChart::RemoveColumn(std::string strID, bool bThrowError)
620 {
621  int iIndex=0;
622  DataColumn *lpColumn = FindColumn(strID, iIndex, bThrowError);
623  if(!lpColumn) return;
624 
625  m_aryColumnsMap.Remove(Std_CheckString(strID));
626  m_aryDataColumns.RemoveAt(iIndex);
627 }
628 
640 DataColumn *DataChart::FindColumn(std::string strID, bool bThrowError)
641 {
642  DataColumn *lpColumn = NULL;
643  CStdMap<std::string, DataColumn *>::iterator oPos;
644  oPos = m_aryColumnsMap.find(Std_CheckString(strID));
645 
646  if(oPos != m_aryColumnsMap.end())
647  lpColumn = oPos->second;
648  else if(bThrowError)
649  THROW_TEXT_ERROR(Al_Err_lDataColumnIDNotFound, Al_Err_strDataColumnIDNotFound, " DataColumn ID: " + strID);
650 
651  return lpColumn;
652 }
653 
666 DataColumn *DataChart::FindColumn(std::string strID, int &iIndex, bool bThrowError)
667 {
668  int iCount = m_aryDataColumns.GetSize();
669  DataColumn *lpColumn = NULL;
670  strID = Std_CheckString(strID);
671  for(iIndex=0; iIndex<iCount; iIndex++)
672  {
673  lpColumn = m_aryDataColumns[iIndex];
674 
675  if(lpColumn->ID() == strID)
676  return lpColumn;
677  }
678 
679  if(bThrowError)
680  THROW_TEXT_ERROR(Al_Err_lDataColumnIDNotFound, Al_Err_strDataColumnIDNotFound, " DataColumn ID: " + strID);
681 
682  return NULL;
683 }
684 
686 {
688 
689  int iCount = m_aryDataColumns.GetSize();
690  for(int iCol=0; iCol<iCount; iCol++)
691  m_aryDataColumns[iCol]->Activate();
692 }
693 
695 {
697 
698  int iCount = m_aryDataColumns.GetSize();
699  for(int iCol=0; iCol<iCount; iCol++)
700  m_aryDataColumns[iCol]->Deactivate();
701 }
702 
703 #pragma region DataAccesMethods
704 
705 bool DataChart::SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError)
706 {
707  std::string strType = Std_CheckString(strDataType);
708 
709  if(ActivatedItem::SetData(strDataType, strValue, false))
710  return true;
711 
712  if(strType == "STARTTIME")
713  {
714  StartTime((float) atof(strValue.c_str()));
715  return true;
716  }
717 
718  if(strType == "ENDTIME")
719  {
720  EndTime((float) atof(strValue.c_str()));
721  return true;
722  }
723 
724  if(strType == "SETSTARTENDTIME")
725  {
726  SetStartEndTime(Std_ToBool(strValue));
727  return true;
728  }
729 
730  if(strType == "COLLECTTIMEWINDOW")
731  {
732  CollectTimeWindow((float) atof(strValue.c_str()));
733  return true;
734  }
735 
736  if(strType == "COLLECTINTERVAL")
737  {
738  CollectInterval((float) atof(strValue.c_str()));
739  return true;
740  }
741 
742  //If it was not one of those above then we have a problem.
743  if(bThrowError)
744  THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType, "Data Type", strDataType);
745 
746  return false;
747 }
748 
749 void DataChart::QueryProperties(CStdPtrArray<TypeProperty> &aryProperties)
750 {
751  ActivatedItem::QueryProperties(aryProperties);
752 
753  aryProperties.Add(new TypeProperty("StartTime", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
754  aryProperties.Add(new TypeProperty("EndTime", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
755  aryProperties.Add(new TypeProperty("SetStartEndTime", AnimatPropertyType::Boolean, AnimatPropertyDirection::Set));
756  aryProperties.Add(new TypeProperty("CollectTimeWindow", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
757  aryProperties.Add(new TypeProperty("CollectInterval", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
758 }
759 
760 bool DataChart::AddItem(const std::string &strItemType, const std::string &strXml, bool bThrowError, bool bDoNotInit)
761 {
762  std::string strType = Std_CheckString(strItemType);
763 
764  if(strType == "DATACOLUMN")
765  {
766  AddColumn(strXml, bDoNotInit);
767  return true;
768  }
769 
770  //If it was not one of those above then we have a problem.
771  if(bThrowError)
772  THROW_PARAM_ERROR(Al_Err_lInvalidItemType, Al_Err_strInvalidItemType, "Item Type", strItemType);
773 
774  return false;
775 }
776 
777 bool DataChart::RemoveItem(const std::string &strItemType, const std::string &strID, bool bThrowError)
778 {
779  std::string strType = Std_CheckString(strItemType);
780 
781  if(strType == "DATACOLUMN")
782  {
783  RemoveColumn(strID, bThrowError);
784  return true;
785  }
786 
787  //If it was not one of those above then we have a problem.
788  if(bThrowError)
789  THROW_PARAM_ERROR(Al_Err_lInvalidItemType, Al_Err_strInvalidItemType, "Item Type", strItemType);
790 
791  return false;
792 }
793 
794 #pragma endregion
795 
797 {
799  {
800  m_lCurrentCol = 0;
801 
802  if(m_aryTimeBuffer)
803  {
804  float fltTime = m_lpSim->Time();
806  }
807 
808  int iCount = m_aryDataColumns.GetSize();
809  for(int iCol=0; iCol<iCount; iCol++)
811 
812  m_lCurrentRow++;
813  }
814 }
815 
826 void DataChart::AddData(int iColumn, int iRow, float fltVal)
827 {
828  SetData(iColumn, iRow, fltVal);
829  m_lCurrentCol++;
830 }
831 
842 void DataChart::SetData(int iColumn, int iRow, float fltVal)
843 {
844  if(iColumn < 0)
845  iColumn = m_lCurrentCol;
846  if(iRow < 0)
847  iRow = m_lCurrentRow;
848 
849  if( (iColumn>=m_lColumnCount) )
850  THROW_PARAM_ERROR(Std_Err_lAboveMaxValue, Std_Err_strAboveMaxValue, "Current Col Count", iColumn);
851 
852  if( (iRow>=m_lRowCount) )
853  THROW_PARAM_ERROR(Std_Err_lAboveMaxValue, Std_Err_strAboveMaxValue, "Current Row Count", iRow);
854 
855  m_aryDataBuffer[(iRow*m_lColumnCount) + iColumn] = fltVal;
856 }
857 
867 void DataChart::Load(std::string strProjectPath, std::string strConfigFile)
868 {
869  CStdXml oXml;
870 
871  TRACE_DEBUG("Loading data chart config file.\r\nFile: " + strConfigFile);
872 
873  if(Std_IsBlank(strProjectPath))
874  THROW_ERROR(Al_Err_lProjectPathBlank, Al_Err_strProjectPathBlank);
875 
876  if(Std_IsBlank(strConfigFile))
877  THROW_ERROR(Al_Err_lFilenameBlank, Al_Err_strFilenameBlank);
878 
879  m_strProjectPath = strProjectPath;
880  m_strConfigFilename = strConfigFile;
881 
882  oXml.Load(AnimatSim::GetFilePath(strProjectPath, strConfigFile));
883 
884  oXml.FindElement("ChartConfiguration");
885  oXml.FindChildElement("DataChart");
886 
887  Load(oXml);
888 
889  TRACE_DEBUG("Finished loading data chart config file.");
890 }
891 
892 
893 void DataChart::Load(CStdXml &oXml)
894 {
895  short iColumn, iTotalColumns;
896 
897  ActivatedItem::Load(oXml);
898 
899  oXml.IntoElem(); //Into DataChart Element
900 
901  if(m_aryDataBuffer) delete[] m_aryDataBuffer;
902  m_aryDataBuffer = NULL;
903  m_aryDataColumns.RemoveAll();
904 
905  CollectInterval(oXml.GetChildFloat("CollectInterval"));
906 
907  SetStartEndTime(oXml.GetChildBool("SetStartEndTime", false));
908  CollectTimeWindow(oXml.GetChildFloat("CollectTimeWindow", -1));
909 
910  //If we are not setting start/end time then it is always active.
912 
913  //*** Begin Loading DataColumns. *****
914  oXml.IntoChildElement("DataColumns");
915 
916  iTotalColumns = oXml.NumberOfChildren();
917  DataColumn *lpColumn = NULL;
918  for(iColumn=0; iColumn<iTotalColumns; iColumn++)
919  {
920  oXml.FindChildByIndex(iColumn);
921  lpColumn = LoadDataColumn(oXml);
922  }
923 
924  oXml.OutOfElem();
925  //*** End Loading DataColumns. *****
926 
927  oXml.OutOfElem(); //OutOf DataChart Element
928 }
929 
942 {
943  DataColumn *lpColumn=NULL;
944  std::string strModuleName, strType;
945 
946 try
947 {
948  oXml.IntoElem(); //Into Column Element
949  strModuleName = oXml.GetChildString("ModuleName", "");
950  strType = oXml.GetChildString("Type");
951  oXml.OutOfElem(); //OutOf Column Element
952 
953  lpColumn = dynamic_cast<DataColumn *>(m_lpSim->CreateObject(strModuleName, "DataColumn", strType));
954  if(!lpColumn)
955  THROW_TEXT_ERROR(Al_Err_lConvertingClassToType, Al_Err_strConvertingClassToType, "DataColumn");
956 
957  lpColumn->SetSystemPointers(m_lpSim, NULL, NULL, NULL, this, true);
958  lpColumn->Load(oXml);
959 
960  AddColumn(lpColumn);
961 
962  return lpColumn;
963 }
964 catch(CStdErrorInfo oError)
965 {
966  if(lpColumn) delete lpColumn;
967  RELAY_ERROR(oError);
968  return NULL;
969 }
970 catch(...)
971 {
972  if(lpColumn) delete lpColumn;
973  THROW_ERROR(Std_Err_lUnspecifiedError, Std_Err_strUnspecifiedError);
974  return NULL;
975 }
976 }
977 
978 
979  } //Charting
980 } //AnimatSim
981 
std::string m_strConfigFilename
Filename of the configuration file.
Definition: DataChart.h:38
virtual void Deserialize(std::string &strXml)
Deserializes a string into an xml document.
Definition: StdXml.cpp:162
Base class file for all Animat simulation objects.
Declares the nervous system class.
virtual int CollectInterval()
Gets the collect interval.
Definition: DataChart.cpp:224
virtual void Activate()
Activates this item.
Declares the simulation recorder class.
long m_lEndSlice
The time slice where this item is deactived.
Definition: ActivatedItem.h:39
bool m_bSetStartEndTime
true to set the start and end time. If false then the chart collects continuously.
Definition: DataChart.h:41
DataColumn * LoadDataColumn(CStdXml &oXml)
Loads a data column.
Definition: DataChart.cpp:941
virtual bool FindChildElement(std::string strElementName, bool fThrowError=true)
Finds a child element by name.
Definition: StdXml.cpp:256
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
Declares the body part class.
virtual bool operator<(ActivatedItem *lpItem)
Compares the Start slice time of two data charts to tell if one is less than the other.
Definition: DataChart.cpp:94
virtual long CurrentRow()
Gets the current row.
Definition: DataChart.cpp:386
long m_lCollectTimeWindow
The number of time slices where we will collect data.
Definition: DataChart.h:50
virtual long UsedBufferSize()
Gets the size of buffer that is currently used.
Definition: DataChart.cpp:171
virtual bool AddItem(const std::string &strItemType, const std::string &strXml, bool bThrowError=true, bool bDoNotInit=false)
Adds a new object to this parent.
Definition: DataChart.cpp:760
std::string m_strError
The error message.
Definition: StdErrorInfo.h:26
virtual bool FindElement(std::string strElementName, bool fThrowError=true)
Finds an element with the specified name.
Definition: StdXml.cpp:179
Simulator * m_lpSim
The pointer to a Simulation.
Definition: AnimatBase.h:43
Information about the standard error.
Definition: StdErrorInfo.h:19
virtual std::string ID()
Gets the unique GUID ID of this object.
Definition: AnimatBase.cpp:167
virtual bool IntoElem()
Goes into the next element where the cursor is located.
Definition: StdXml.cpp:42
Data column class.
Definition: DataColumn.h:24
virtual long RowCount()
Gets the row count.
Definition: DataChart.cpp:376
virtual void SetData(int iColumn, int iRow, float fltVal)
Sets a data element to the data buffer.
Definition: DataChart.cpp:842
Class that stores information about types for QueryProperty information.
Definition: TypeProperty.h:35
virtual long CollectTimeWindow()
Gets the collect time window time slices.
Definition: DataChart.cpp:299
long m_lError
The error number.
Definition: StdErrorInfo.h:23
virtual void StepSimulation()
Step the simulation for this object.
Definition: DataChart.cpp:796
virtual void RemoveColumn(std::string strID, bool bThrowError=true)
Removes the column with the specified ID.
Definition: DataChart.cpp:619
float m_fltCollectTimeWindow
The time duration where we will collect data.
Definition: DataChart.h:53
Declares the key frame class.
virtual void Initialize()
Initializes this object.
Definition: DataChart.cpp:422
virtual float ChartTimeBase()
Gets the Time base used by this data chart.
Definition: DataChart.cpp:279
virtual void QueryProperties(CStdPtrArray< TypeProperty > &aryProperties)
Queries this object for a list of properties that can be changed using SetData.
Definition: DataChart.cpp:749
virtual long CalculateChartColumnCount()
Calculates the chart column count.
Definition: DataChart.cpp:555
Base class for all activated items.
Definition: ActivatedItem.h:27
Declares the joint class.
Declares the organism class.
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
bool Std_IsAboveMin(int iMinVal, int iVal, bool bThrowError, std::string strParamName, bool bInclusiveLimit)
Tests if a number is above a minimum value.
Data chart base class.
Definition: DataChart.h:31
Declares a light object.
bool LessThanDataColumnCompare(DataColumn *lpColumn1, DataColumn *lpColumn2)
Compares two DataColumn items to find the one that is less than the other.
Definition: DataColumn.cpp:389
long m_lColumnCount
Number of data columns.
Definition: DataChart.h:69
Declares the activated item class.
virtual float TimeStep()
Gets the smallest integration time step used within the simulation.
Definition: Simulator.cpp:951
Declares the data column class.
virtual void Load(std::string strProjectPath, std::string strConfigFile)
Loads a data chart from a file.
Definition: DataChart.cpp:867
virtual CStdSerialize * CreateObject(std::string strModule, std::string strClassName, std::string strType, bool bThrowError=true)
Creates an object using a class factory.
Definition: Simulator.cpp:3440
Declares a light manager object.
virtual void ResetSimulation()
Resets the simulation back to time 0.
Definition: DataChart.cpp:537
Declares the bounding box class.
virtual float StartTime()
Gets the simulation start time for activation.
Declares the gain base class.
virtual void Load(std::string strFilename)
Loads an xml data file.
Definition: StdXml.cpp:1685
virtual float * DataBuffer()
Gets the data buffer.
Definition: DataChart.cpp:211
virtual DataColumn * FindColumn(std::string strID, int &iIndex, bool bThrowError)
Searches for a column that matches the specified ID.
Definition: DataChart.cpp:666
A standard xml manipulation class.
Definition: StdXml.h:19
virtual void ResetSimulation()
Resets the simulation back to time 0.
virtual bool SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError=true)
Set a variable based on a string data type name.
Declares the node class.
virtual void AddData(int iColumn, int iRow, float fltVal)
Adds a data element to the data buffer.
Definition: DataChart.cpp:826
virtual void QueryProperties(CStdPtrArray< TypeProperty > &aryProperties)
Queries this object for a list of properties that can be changed using SetData.
Definition: AnimatBase.cpp:447
virtual std::string GetChildString(std::string strElementName)
Gets a string value from the element with the specified name.
Definition: StdXml.cpp:307
virtual void Unlock()
Unlocks this data chart buffer from being written by any other process.
Definition: DataChart.cpp:420
float m_fltCollectInterval
Tells what the time slice step interval to use when collecting data. This is.
Definition: DataChart.h:47
virtual bool Lock()
Locks this data chart buffer from being written by any other process.
Definition: DataChart.cpp:409
bool Std_ToBool(int iVal)
Converts a value toa bool.
DataChart()
Default constructor.
Definition: DataChart.cpp:54
void Std_TraceMsg(const int iLevel, std::string strMessage, std::string strSourceFile, int iSourceLine, bool bLogToFile, bool bPrintHeader)
Traces a message to the debugger window.
virtual bool GetChildBool(std::string strElementName)
Gets a bool value from the element with the specified name.
Definition: StdXml.cpp:699
virtual long BufferByteSize()
Gets the buffer byte size.
Definition: DataChart.cpp:181
virtual int NumberOfChildren()
Gets the number of children of the current element.
Definition: StdXml.cpp:202
virtual bool SetStartEndTime()
Gets whether a start/end time is set for this chart.
Definition: DataChart.cpp:136
bool m_bInitialized
true if item has been initialized
Definition: ActivatedItem.h:62
virtual long UsedBufferByteSize()
Gets the used buffer byte size.
Definition: DataChart.cpp:191
virtual long ColumnCount()
Gets the column count.
Definition: DataChart.cpp:366
virtual bool OutOfElem()
Goes out of the element where the cursor is located.
Definition: StdXml.cpp:56
virtual void Deactivate()
Deactivates this item.
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
Declares the data chart class.
virtual std::string Type()
returns the string type name of this object.
Definition: DataChart.cpp:110
long m_lRowCount
Number of rows in the buffer.
Definition: DataChart.h:72
bool Std_IsBlank(std::string strVal)
Trims a string and tests if a string is blank.
virtual bool RemoveItem(const std::string &strItemType, const std::string &strID, bool bThrowError=true)
Removes a child item from this parent.
Definition: DataChart.cpp:777
virtual void Deactivate()
Deactivates this item.
Definition: DataChart.cpp:694
Declares the data chart manager class.
Declares the rigid body class.
virtual long BufferSize()
Gets the buffer size.
Definition: DataChart.cpp:161
virtual bool IntoChildElement(std::string strElementName, bool bThrowError=true)
Goes into the child element with the specified name.
Definition: StdXml.cpp:278
std::string Std_CheckString(std::string strVal)
Converts a string to upper case and trims it.
virtual void SetSystemPointers(Simulator *lpSim, Structure *lpStructure, NeuralModule *lpModule, Node *lpNode, DataChart *lpChart, bool bVerify)
Sets the system pointers.
float * m_aryTimeBuffer
Buffer for time data points.
Definition: DataChart.h:63
virtual long TimeSlice()
Gets the current time slice.
Definition: Simulator.cpp:613
Declares the structure class.
Declares the odor type class.
virtual void Initialize()
Initializes this object.
virtual void Activate()
Activates this item.
Definition: DataChart.cpp:685
Declares the odor class.
Declares the simulator class.
virtual ~DataChart()
Destructor.
Definition: DataChart.cpp:74
Declares the neural module class.
virtual std::string ProjectPath()
Gets the project path.
Definition: DataChart.cpp:346
int m_lCurrentRow
The currently selected row.
Definition: DataChart.h:78
virtual bool FindChildByIndex(int iIndex, bool bThrowError=true)
Finds a child element by index.
Definition: StdXml.cpp:225
virtual float Time()
Gets the current simulation time in seconds.
Definition: Simulator.cpp:559
Declares the activated item manager class.
Declares the contact sensor class.
Declares the external stimuli manager class.
virtual float * TimeBuffer()
Gets the time buffer.
Definition: DataChart.cpp:201
virtual bool AlwaysActive()
Gets whether this item is always active.
virtual void ReInitialize()
Re-initialize this object.
Definition: DataChart.cpp:463
long m_lStartSlice
The time slice where this item becomes active.
Definition: ActivatedItem.h:36
virtual void AddColumn(DataColumn *lpColumn)
Adds a column.
Definition: DataChart.cpp:594
Declares the receptive field class.
short m_iCollectInterval
Tells what the time slice step interval to use when collecting data. This is.
Definition: DataChart.h:44
virtual float GetChildFloat(std::string strElementName)
Gets a float value from the element with the specified name.
Definition: StdXml.cpp:617
virtual float EndTime()
Gets the end simulation time for deactivation.