AnimatLab  2
Test
GatedSynapse.cpp
Go to the documentation of this file.
1 
7 #include "StdAfx.h"
8 
9 #include "Synapse.h"
10 #include "GatedSynapse.h"
11 #include "Neuron.h"
12 #include "FiringRateModule.h"
13 
14 namespace FiringRateSim
15 {
16  namespace Synapses
17  {
25 {
27  m_strType = "GATED";
28 }
29 
37 {
38 
39 }
40 
50 
59 void GatedSynapse::InitialGateValue(unsigned char iVal) {m_iInitialGateValue = iVal;}
60 
62 {
64 
67  else
68  m_fltModulation = 1;
69 
70  return m_fltModulation;
71 }
72 
73 #pragma region DataAccesMethods
74 
75 float *GatedSynapse::GetDataPointer(const std::string &strDataType)
76 {
77  std::string strType = Std_CheckString(strDataType);
78 
79  if(strType == "MODULATION")
80  return &m_fltModulation;
81 
82  return Synapse::GetDataPointer(strDataType);
83 }
84 
85 bool GatedSynapse::SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError)
86 {
87  std::string strType = Std_CheckString(strDataType);
88 
89  if(Synapse::SetData(strDataType, strValue, false))
90  return true;
91 
92  if(strType == "GATEINITIALLYON")
93  {
94  InitialGateValue(Std_ToBool(strValue));
95  return true;
96  }
97 
98  //If it was not one of those above then we have a problem.
99  if(bThrowError)
100  THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType, "Data Type", strDataType);
101 
102  return false;
103 }
104 
105 void GatedSynapse::QueryProperties(CStdPtrArray<TypeProperty> &aryProperties)
106 {
107  Synapse::QueryProperties(aryProperties);
108 
109  aryProperties.Add(new TypeProperty("Modulation", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
110 
111  aryProperties.Add(new TypeProperty("GateInitiallyOn", AnimatPropertyType::Boolean, AnimatPropertyDirection::Set));
112 }
113 
114 #pragma endregion
115 
116 void GatedSynapse::Load(CStdXml &oXml)
117 {
118  Synapse::Load(oXml);
119 
120  oXml.IntoElem(); //Into GatedSynapse Element
121 
122  InitialGateValue((unsigned char) oXml.GetChildInt("InitialGateValue"));
123 
124  oXml.OutOfElem(); //OutOf GatedSynapse Element
125 }
126 
127  } //Synapses
128 } //FiringRateSim
129 
130 
131 
132 
133 
134 
GatedSynapse()
Default constructor.
virtual float CalculateModulation(FiringRateModule *lpModule)
Calculates the synaptic modulation.
Firing rate neural module.
Neuron * m_lpFromNeuron
The pointer to pre-synaptic neuron.
Definition: Synapse.h:48
float m_fltWeight
The weight of the synapse. This is a current value in nanoamps.
Definition: Synapse.h:39
Declares the gated synapse class.
unsigned char m_iInitialGateValue
Tells whether the gate is initially open or closed.
Definition: GatedSynapse.h:29
virtual bool SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError=true)
Set a variable based on a string data type name.
Definition: Synapse.cpp:397
virtual float * GetDataPointer(const std::string &strDataType)
Returns a float pointer to a data item of interest in this object.
Definition: Synapse.cpp:385
virtual bool SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError=true)
Set a variable based on a string data type name.
virtual float FiringFreq(FiringRateModule *lpModule)
Calculates the current firing frequency.
Declares the synapse class.
bool Std_ToBool(int iVal)
Converts a value toa bool.
virtual float * GetDataPointer(const std::string &strDataType)
Returns a float pointer to a data item of interest in this object.
Declares the firing rate module class.
bool m_bEnabled
Tells if this item is enabled or not. If it is not enabled then it is not run.
Definition: AnimatBase.h:40
virtual unsigned char InitialGateValue()
Gets the initial gate value.
Contains the classes for a firing rate neural model.
std::string Std_CheckString(std::string strVal)
Converts a string to upper case and trims it.
float m_fltModulation
The modulation value to use for this synapse.
Definition: Synapse.h:42
std::string m_strType
The type for this object. Examples are Box, Plane, Neuron, etc..
Definition: AnimatBase.h:58