AnimatLab  2
Test
NeuralModule.h
Go to the documentation of this file.
1 
7 #pragma once
8 
9 namespace AnimatSim
10 {
11  namespace Behavior
12  {
29  class ANIMAT_PORT NeuralModule : public AnimatBase
30  {
31  protected:
33  Organism *m_lpOrganism;
34 
38 
41 
43  // of this module. This is zeroed back out at the next step of this module.
45 
47  std::string m_strProjectPath;
48 
51 
54 
56  CStdArray<Adapter *> m_arySourceAdapters;
57 
59  CStdArray<Adapter *> m_aryTargetAdapters;
60 
62  CStdPtrArray<AnimatSim::Link> m_aryExternalSynapses;
63 
66 
67  virtual int FindAdapterListIndex(CStdArray<Adapter *> aryAdapters, std::string strID, bool bThrowError = true);
68  virtual AnimatSim::Link *LoadExternalSynapse(CStdXml &oXml);
69  virtual void LoadExternalSynapses(CStdXml &oXml);
70 
71  public:
72  NeuralModule();
73  virtual ~NeuralModule();
74 
75  static NeuralModule *CastToDerived(AnimatBase *lpBase) {return static_cast<NeuralModule*>(lpBase);}
76 
85  virtual std::string ModuleName() = 0;
86 
87  virtual short TimeStepInterval();
88  virtual void TimeStepInterval(short iVal);
89 
90  virtual float TimeStep();
91  virtual void TimeStep(float fltVal);
92 
93  virtual IStdClassFactory *ClassFactory();
94  virtual void ClassFactory(IStdClassFactory *lpFactory);
95 
96  Simulator *GetSimulator();
97  Organism *GetOrganism();
98 
121  virtual void SetSystemPointers(Simulator *lpSim, Structure *lpStructure, NeuralModule *lpModule, Node *lpNode, bool bVerify);
122  virtual void VerifySystemPointers();
123 
134  virtual void AttachSourceAdapter(Adapter *lpAdapter);
135 
146  virtual void RemoveSourceAdapter(Adapter *lpAdapter);
147 
158  virtual void AttachTargetAdapter(Adapter *lpAdapter);
159 
170  virtual void RemoveTargetAdapter(Adapter *lpAdapter);
171 
172  virtual float *GetDataPointer(const std::string &strDataType);
173 
174  virtual void AddExternalSynapse(AnimatSim::Link *lpSynapse);
175  virtual void AddExternalSynapse(std::string strXml, bool bDoNotInit);
176  virtual void RemoveExternalSynapse(std::string strID, bool bThrowError = true);
177  virtual int FindExternalSynapseListPos(std::string strID, bool bThrowError = true);
178 
179  virtual void Initialize();
180  virtual void ResetSimulation();
181  virtual bool NeedToStep(bool bIncrement);
182  virtual void ResetStepCounter();
183  virtual void StepSimulation();
184 
191  virtual void StepAdapters();
192  };
193 
194  } //Behavior
195 } //AnimatSim
CStdPtrArray< AnimatSim::Link > m_aryExternalSynapses
An array of external synapses connected to nodes within this module.
Definition: NeuralModule.h:62
CStdArray< Adapter * > m_arySourceAdapters
An array of source adapters for this module.
Definition: NeuralModule.h:56
Simulates the entire environment.
Definition: Simulator.h:31
Root namespace for the base simulation library for AnimatLab.
std::string m_strNeuralNetworkFile
The string neural network file name.
Definition: NeuralModule.h:50
IStdClassFactory * m_lpClassFactory
The pointer to the class factory for this module.
Definition: NeuralModule.h:53
short m_iTimeStepCount
Count variable that keeps track of how many slices have occured since the last StepSimulation.
Definition: NeuralModule.h:44
CStdArray< Adapter * > m_aryTargetAdapters
An array of target adapters for this module.
Definition: NeuralModule.h:59
Organism * m_lpOrganism
The pointer to the organism.
Definition: NeuralModule.h:33
Animat base class.
Definition: AnimatBase.h:36
Base class for body parts and neural network nodes.
Definition: Node.h:25
short m_iTargetAdapterCount
Number of target adapters.
Definition: NeuralModule.h:65
std::string m_strProjectPath
Full pathname of the string project file for this module.
Definition: NeuralModule.h:47
float m_fltTimeStep
The DT time step for this neural module in seconds.
Definition: NeuralModule.h:40