45 #ifndef __PROPERTY_ACTION_H__
46 #define __PROPERTY_ACTION_H__
73 template <
class Manipulator>
125 template <
class Manipulator>
132 _propertyID = _attrSet.addStringAttribute(
"property",
true );
133 _generatorID = _attrSet.addFloatDistAttribute(
"",
true , 0.f, 1.f );
155 virtual bool setFromXML(
Action * action, TiXmlElement * node,
const std::string & behaveFldr )
const {
157 assert( pAction != 0x0 &&
"Trying to set property action properties on an incompatible object" );
164 if ( prop == NO_PROPERTY ) {
165 logger <<
Logger::ERR_MSG <<
"The property action defined on line " << node->Row() <<
" specified an invalid value for the \"property\" attribute";
168 manip->
setGenerator( _attrSet.getFloatGenerator( _generatorID ) );
200 virtual const char *
name()
const {
return "set_property"; }
210 return "Causes the specified property to be *replaced* by the user-defined value";
243 virtual const char *
name()
const {
return "offset_property"; }
253 return "Adds the user-defined value into the agent's specified property";
286 virtual const char *
name()
const {
return "scale_property"; }
296 return "Scales the user-defined value into the agent's specified property";
317 #endif // __PROPERTY_ACTION_H__
Action * instance() const
Create an instance of this class's action.
Definition: PropertyAction.h:310
BFSM::PropertyOperand parsePropertyName(const std::string &opName)
Helper function for parsing property actions.
Definition: AgentPropertyManipulator.cpp:59
Factory for the SetPropertyAction.
Definition: PropertyAction.h:189
The core namespace. All elements of Menge are contained in this namespace.
Definition: AgentGenerator.cpp:43
Factory for the PropertyAction.
Definition: PropertyAction.h:126
Sets up the proper compiler directives for platform and dll export/import.
void setProperty(BFSM::PropertyOperand prop)
Sets the property operand.
Definition: AgentPropertyManipulator.h:130
Action * instance() const
Create an instance of this class's action.
Definition: PropertyAction.h:267
Factory for the ScalePropertyAction.
Definition: PropertyAction.h:275
The definition of actions that are taken as agents enter states.
virtual const char * description() const
A description of the action.
Definition: PropertyAction.h:295
virtual void onEnter(Agents::BaseAgent *agent)
Upon entering the state, this is called – it is the main work of the action.
Definition: PropertyAction.h:94
size_t _propertyID
The identifier for the "property" string attribute.
Definition: PropertyAction.h:176
Action * instance() const
Create an instance of this class's action.
Definition: PropertyAction.h:224
Factory for the OffsetPropertyAction.
Definition: PropertyAction.h:232
virtual bool setFromXML(Action *action, TiXmlElement *node, const std::string &behaveFldr) const
Given a pointer to an Action instance, sets the appropriate fields from the provided XML node...
Definition: PropertyAction.h:155
The factory for parsing xml data and instantiating actions.
void setGenerator(FloatGenerator *gen)
Sets the generator for the manipulator.
Definition: AgentPropertyManipulator.cpp:170
Manipulator * getManipulator()
Returns a pointer to the manipulator.
Definition: PropertyAction.h:99
virtual const char * description() const
A description of the action.
Definition: PropertyAction.h:252
virtual const char * description() const
A description of the action.
Definition: PropertyAction.h:209
virtual ~PropertyAction()
Virtual destructor.
Definition: PropertyAction.h:85
Classes for manipulating agent properties in an "undoable" manner (albeit, to a limited degree)...
The namespace contains the Behavior Finite State Machine (BFSM) definition.
Logger logger
Globally available Logger.
Definition: Logger.cpp:49
virtual const char * name() const
The name of the action.
Definition: PropertyAction.h:286
virtual const char * name() const
The name of the action.
Definition: PropertyAction.h:200
The abstract definition of an action.
Definition: Action.h:78
PropertyAction()
Constructor.
Definition: PropertyAction.h:79
Collection of convenient pre-compiler information for fsm definitions.
Manipulator _manip
The manipulator responsible for changing agent properties.
Definition: PropertyAction.h:113
Base class for manipulating agent properties in an undoable manner. The undo is limited, it only maintains knowledge of one manipulation. If multiple manipulations are applied, only the last can be undone.
Definition: AgentPropertyManipulator.h:83
Defines the basic agent properties and functionality that all simulation agents share.
Definition: BaseAgent.h:123
The base class for modifying agent properties.
Definition: PropertyAction.h:74
size_t _generatorID
The identifier for the float distribution attribute.
Definition: PropertyAction.h:181
virtual const char * name() const
The name of the action.
Definition: PropertyAction.h:243
A class for parsing the xml description of an action and instantiating particular instances...
Definition: ActionFactory.h:62
virtual void leaveAction(Agents::BaseAgent *agent)
The work to do upon state exit.
Definition: PropertyAction.h:108
The namespace that contains the basic simulation mechanisms.
virtual bool setFromXML(Action *action, TiXmlElement *node, const std::string &behaveFldr) const
Given a pointer to an Action instance, sets the appropriate fields from the provided XML node...
Definition: ActionFactory.cpp:56
PropertyActFactory()
Constructor.
Definition: PropertyAction.h:131
Error encountered but not handled.
Definition: Logger.h:69