AnimatLab  2
Test
Organism.h
Go to the documentation of this file.
1 
7 #pragma once
8 
9 
10 namespace AnimatSim
11 {
12  namespace Environment
13  {
14 
31  class ANIMAT_PORT Organism : public Structure
32  {
33  protected:
35  NervousSystem *m_lpNervousSystem;
36 
38  bool m_bDead;
39 
41  RobotInterface *m_lpRobot;
42 
43  virtual RobotInterface *AddRobotInterface(std::string strXml);
44  virtual void RemoveRobotInterface(std::string strID, bool bThrowError = true);
45  virtual RobotInterface *LoadRobotInterface(CStdXml &oXml);
46 
47  public:
48  Organism();
49  virtual ~Organism();
50 
51  static Organism *CastToDerived(AnimatBase *lpBase) {return static_cast<Organism*>(lpBase);}
52 
53  virtual bool IsDead();
54 
55  virtual RobotInterface *GetRobotInterface() {return m_lpRobot;};
56 
57 #pragma region SnapshotMethods
58  virtual long CalculateSnapshotByteSize();
59  virtual void SaveKeyFrameSnapshot(byte *aryBytes, long &lIndex);
60  virtual void LoadKeyFrameSnapshot(byte *aryBytes, long &lIndex);
61 #pragma endregion
62 
63 #pragma region DataAccesMethods
64  virtual bool SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError = true);
65  virtual bool AddItem(const std::string &strItemType, const std::string &strXml, bool bThrowError = true, bool bDoNotInit = false);
66  virtual bool RemoveItem(const std::string &strItemType, const std::string &strID, bool bThrowError = true);
67 #pragma endregion
68 
69  virtual void Initialize();
70  virtual void StepNeuralEngine();
71  virtual void StepPhysicsEngine();
72  virtual void ResetSimulation();
73  virtual void Kill(bool bState = true);
74  virtual void MinTimeStep(float &fltMin);
75 
76  virtual void Load(CStdXml &oXml);
77  virtual AnimatSim::Behavior::NervousSystem *GetNervousSystem();
78  };
79 
80  } // Environment
81 } //AnimatSim
NervousSystem * m_lpNervousSystem
The pointer to the nervous system.
Definition: Organism.h:35
Nervous system for an organism.
Definition: NervousSystem.h:28
Root namespace for the base simulation library for AnimatLab.
RobotInterface * m_lpRobot
Pointer to a robot interface node to allow the organism to be hooked to a robot.
Definition: Organism.h:41
A "static" structure in the simulation.
Definition: Structure.h:84
bool m_bDead
Tells if the organism is dead or not.
Definition: Organism.h:38
Animat base class.
Definition: AnimatBase.h:36
A dynamic organism that is controlled by a neural network.
Definition: Organism.h:31