AnimatLab  2
Test
ReceptiveFieldPair.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 "ReceptiveFieldPair.h"
23 #include "ContactSensor.h"
24 #include "RigidBody.h"
25 #include "Sensor.h"
26 #include "Attachment.h"
27 #include "Structure.h"
28 #include "NeuralModule.h"
29 #include "Adapter.h"
30 #include "NervousSystem.h"
31 #include "Organism.h"
32 #include "ActivatedItem.h"
33 #include "ActivatedItemMgr.h"
34 #include "DataChartMgr.h"
35 #include "ExternalStimuliMgr.h"
36 #include "KeyFrame.h"
37 #include "SimulationRecorder.h"
38 #include "OdorType.h"
39 #include "Odor.h"
40 #include "Light.h"
41 #include "LightManager.h"
42 #include "Simulator.h"
43 
44 namespace AnimatSim
45 {
46  namespace Environment
47  {
55 {
56  m_lpNode = NULL;
57  m_lpField = NULL;
58 }
59 
67 {
68 }
69 
70 void ReceptiveFieldPair::FieldID(std::string strID)
71 {
72  if(Std_IsBlank(strID))
73  THROW_ERROR(Al_Err_lIDBlank, Al_Err_strIDBlank);
74 
75  m_strFieldID = strID;
76 }
77 
78 std::string ReceptiveFieldPair::FieldID() {return m_strFieldID;}
79 
80 void ReceptiveFieldPair::TargetNodeID(std::string strID)
81 {
82  if(Std_IsBlank(strID))
83  THROW_ERROR(Al_Err_lIDBlank, Al_Err_strIDBlank);
84 
85  m_strTargetNodeID = strID;
86 }
87 
88 std::string ReceptiveFieldPair::TargetNodeID() {return m_strTargetNodeID;}
89 
90 ReceptiveField *ReceptiveFieldPair::Field() {return m_lpField;}
91 
93 {
95 
96  m_lpNode = dynamic_cast<Node *>(m_lpSim->FindByID(m_strTargetNodeID));
97  if(!m_lpNode)
98  THROW_PARAM_ERROR(Al_Err_lNodeNotFound, Al_Err_strNodeNotFound, "ID: ", m_strTargetNodeID);
99 
101  if(!m_lpField)
102  THROW_PARAM_ERROR(Al_Err_lNodeNotFound, Al_Err_strNodeNotFound, "ID: ", m_strFieldID);
103 }
104 
106 {
107  if(m_lpField && m_lpNode)
109 }
110 
111 
112 void ReceptiveFieldPair::Load(CStdXml &oXml)
113 {
114  AnimatBase::Load(oXml);
115 
116  oXml.IntoElem(); //Into Adapter Element
117 
118  FieldID(oXml.GetChildString("FieldID"));
119  TargetNodeID(oXml.GetChildString("TargetNodeID"));
120 
121  oXml.OutOfElem(); //OutOf Adapter Element
122 }
123 
124  } //Environment
125 } //AnimatSim
Base class file for all Animat simulation objects.
Declares the nervous system class.
Declares the simulation recorder class.
Root namespace for the base simulation library for AnimatLab.
Declares the body part class.
std::string m_strTargetNodeID
GUID ID of the target neuron where current will be injected.
virtual void AddExternalNodeInput(int iTargetDataType, float fltInput)=0
Adds an external node input.
Simulator * m_lpSim
The pointer to a Simulation.
Definition: AnimatBase.h:43
virtual bool IntoElem()
Goes into the next element where the cursor is located.
Definition: StdXml.cpp:42
virtual void Initialize()
Initializes this object.
Definition: AnimatBase.cpp:573
Declares the key frame class.
Declares the joint class.
Declares the organism class.
virtual void Initialize()
Initializes this object.
Declares a light object.
Declares the activated item class.
std::string m_strFieldID
Identifier for the field to use with this field pair.
Declares a light manager object.
Declares the receptive field pair class.
Declares the bounding box class.
Declares the gain base class.
A standard xml manipulation class.
Definition: StdXml.h:19
Node * m_lpNode
The pointer to this items parent Node. If this is not relevant for this object then this is NULL...
Definition: AnimatBase.h:52
Declares the node class.
float m_fltCurrent
The accumulated current for this receptive field.
virtual void StepSimulation()
Step the simulation for this object.
virtual std::string GetChildString(std::string strElementName)
Gets a string value from the element with the specified name.
Definition: StdXml.cpp:307
virtual AnimatBase * FindByID(std::string strID, bool bThrowError=true)
Searches for the object with the specified ID.
Definition: Simulator.cpp:4008
virtual void Load(StdUtils::CStdXml &oXml)
Loads the item using an XML data packet.
Definition: AnimatBase.cpp:771
Base class for body parts and neural network nodes.
Definition: Node.h:25
virtual bool OutOfElem()
Goes out of the element where the cursor is located.
Definition: StdXml.cpp:56
Declares the sensor class.
bool Std_IsBlank(std::string strVal)
Trims a string and tests if a string is blank.
Declares the data chart manager class.
Declares the rigid body class.
Declares the structure class.
Declares the odor type class.
Declares the odor class.
Declares the simulator class.
Declares the neural module class.
Declares the activated item manager class.
ReceptiveField * m_lpField
Pointer to the ReceptiveField associated with this pairing.
Declares the contact sensor class.
Declares the external stimuli manager class.
Declares the attachment class.
Receptive field that generates current based on the amount of contact force, and how close it is to t...
Declares the receptive field class.