8 #include "IMovableItemCallback.h"
9 #include "ISimGUICallback.h"
13 #include "IPhysicsMovableItem.h"
14 #include "IPhysicsBody.h"
16 #include "MovableItem.h"
72 {
Std_TraceMsg(0,
"Caught Error in desctructor of Mouth\r\n",
"", -1,
false,
true);}
89 Std_IsAboveMin((
float) 0, fltVal,
true,
"Mouth.MinFoodRadius",
true);
136 THROW_PARAM_ERROR(Al_Err_lPartTypeNotStomach, Al_Err_strPartTypeNotStomach,
"ID", strID);
172 CStdArray<RigidBody *> arySources;
173 CStdArray<float> aryDistances;
177 int iSources = arySources.GetSize();
182 for(
int iFoodIdx=0; iFoodIdx<iSources; iFoodIdx++)
184 lpFood = arySources[iFoodIdx];
185 fltDist = aryDistances[iFoodIdx];
187 float fltBiteSize = 0;
209 bool Mouth::SetData(
const std::string &strDataType,
const std::string &strValue,
bool bThrowError)
213 if(Sensor::SetData(strType, strValue,
false))
216 if(strType ==
"STOMACHID")
222 if(strType ==
"MINIMUMFOODRADIUS")
230 THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType,
"Data Type", strDataType);
235 void Mouth::QueryProperties(CStdPtrArray<TypeProperty> &aryProperties)
237 Sensor::QueryProperties(aryProperties);
239 aryProperties.Add(
new TypeProperty(
"EatingRate", AnimatPropertyType::String, AnimatPropertyDirection::Get));
240 aryProperties.Add(
new TypeProperty(
"FoodDistance", AnimatPropertyType::String, AnimatPropertyDirection::Get));
242 aryProperties.Add(
new TypeProperty(
"StomachID", AnimatPropertyType::String, AnimatPropertyDirection::Set));
243 aryProperties.Add(
new TypeProperty(
"MinimumFoodRadius", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
246 float *Mouth::GetDataPointer(
const std::string &strDataType)
250 if(strType ==
"EATINGRATE")
253 if(strType ==
"FOODDISTANCE")
256 return RigidBody::GetDataPointer(strDataType);
266 void Mouth::Load(
CStdXml &oXml)
virtual float FoodEnergyContent()
Gets the food energy content.
Base class file for all Animat simulation objects.
Declares the simulation recorder class.
Declares the mouth class.
Root namespace for the base simulation library for AnimatLab.
Declares the body part class.
The Stomach object is responsible for holding food energy.
Stomach * m_lpStomach
The pointer to stomach for this organism.
virtual void ResetSimulation()
Resets the simulation back to time 0.
virtual float FoodQuantity()
Gets the food quantity.
virtual void ResetSimulation()
Resets the simulation back to time 0.
virtual void Initialize()
Initializes this object.
Simulator * m_lpSim
The pointer to a Simulation.
virtual bool IntoElem()
Goes into the next element where the cursor is located.
virtual std::string StomachID()
Gets the stomach identifier.
Class that stores information about types for QueryProperty information.
virtual void Eat(float fltBiteSize, long lTimeSlice)
This item is eating the specified amount of food.
Declares the key frame class.
virtual void Initialize()
Initializes this object.
Declares the joint class.
Declares the organism class.
bool Std_IsAboveMin(int iMinVal, int iVal, bool bThrowError, std::string strParamName, bool bInclusiveLimit)
Tests if a number is above a minimum value.
Mouth()
Default constructor.
Declares the activated item class.
Declares the stomach class.
virtual void SetStomachPointer(std::string strID)
Sets the stomach pointer.
Declares a light manager object.
Declares the bounding box class.
virtual CStdFPoint GetCurrentPosition()
Gets the current position of this part.
A standard xml manipulation class.
virtual float EnergyLevel()
Gets the energy level.
virtual float MaxEnergyLevel()
Gets the maximum energy level.
virtual std::string GetChildString(std::string strElementName)
Gets a string value from the element with the specified name.
virtual AnimatBase * FindByID(std::string strID, bool bThrowError=true)
Searches for the object with the specified ID.
virtual void AddExternalNodeInput(int iTargetDataType, float fltInput)
Adds an external node input.
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.
float m_fltMinFoodRadius
Any food source that is further away than this minimum radius will not be available for eating...
virtual bool OutOfElem()
Goes out of the element where the cursor is located.
Declares the sensor class.
float m_fltFoodDistance
The current distance between the food and the mouth.
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.
virtual void StepSimulation()
Step the simulation for this object.
std::string Std_CheckString(std::string strVal)
Converts a string to upper case and trims it.
std::string m_strStomachID
Identifier for the stomach.
virtual long TimeSlice()
Gets the current time slice.
Declares the structure class.
Declares the odor type class.
virtual float MinFoodRadius()
Gets the minium radius where food can be eaten.
virtual void StepSimulation()
Step the simulation.
virtual float InverseDistanceUnits()
Gets the inverse distance units.
virtual ~Mouth()
Destructor.
Declares the simulator class.
virtual float EatingRate()
Gets the eating rate.
Declares the activated item manager class.
Declares the external stimuli manager class.
The base class for all of the basic rigid body type of objects.
Declares the receptive field class.
virtual float GetChildFloat(std::string strElementName)
Gets a float value from the element with the specified name.