45 #ifndef __AGENT_PROPERT_EFFECT_H__
46 #define __AGENT_PROPERT_EFFECT_H__
66 template <
class Manipulator>
102 template <
class Manipulator >
109 _propertyID = _attrSet.addStringAttribute(
"property",
true );
110 _generatorID = _attrSet.addFloatDistAttribute(
"",
true , 0.f, 1.f );
134 assert( aEffect != 0x0 &&
"Trying to set agent event effect properties on an incompatible object" );
142 BFSM::PropertyOperand prop =
parsePropertyName( _attrSet.getString( _propertyID ) );
144 if ( prop == BFSM::NO_PROPERTY ) {
145 logger <<
Logger::ERR_MSG <<
"The property event effect defined on line " << node->Row() <<
" specified an invalid value for the \"property\" attribute";
148 manip->
setGenerator( _attrSet.getFloatGenerator( _generatorID ) );
180 virtual const char *
name()
const {
return "set_agent_property"; }
190 return "Causes the specified property to be *replaced* by the user-defined value";
223 virtual const char *
name()
const {
return "offset_agent_property"; }
233 return "Causes the specified property to be offset by the user-defined value";
266 virtual const char *
name()
const {
return "scale_agent_property"; }
276 return "Causes the specified property to be scaled by the user-defined value";
295 #endif // __AGENT_PROPERT_EFFECT_H__
AgentPropertyEffect()
Constructor.
Definition: AgentPropertyEffect.h:72
virtual const char * description() const
A description of the effect.
Definition: AgentPropertyEffect.h:232
virtual const char * name() const
The name of the effect.
Definition: AgentPropertyEffect.h:266
EventEffect * instance() const
Create an instance of this class's effect.
Definition: AgentPropertyEffect.h:290
BFSM::PropertyOperand parsePropertyName(const std::string &opName)
Helper function for parsing property actions.
Definition: AgentPropertyManipulator.cpp:59
The core namespace. All elements of Menge are contained in this namespace.
Definition: AgentGenerator.cpp:43
size_t _generatorID
The identifier for the float distribution attribute.
Definition: AgentPropertyEffect.h:161
virtual const char * name() const
The name of the effect.
Definition: AgentPropertyEffect.h:223
void setProperty(BFSM::PropertyOperand prop)
Sets the property operand.
Definition: AgentPropertyManipulator.h:130
virtual const char * description() const
A description of the effect.
Definition: AgentPropertyEffect.h:189
Factory for the SetPropertyEffect.
Definition: AgentPropertyEffect.h:169
virtual const char * name() const
The name of the effect.
Definition: AgentPropertyEffect.h:180
The factory for agent property event effects.
Definition: AgentPropertyEffect.h:103
Manipulator _manip
The manipulator responsible for changing agent properties.
Definition: AgentPropertyEffect.h:94
void setGenerator(FloatGenerator *gen)
Sets the generator for the manipulator.
Definition: AgentPropertyManipulator.cpp:170
virtual bool setFromXML(EventEffect *element, TiXmlElement *node, const std::string &specFldr) const
Given a pointer to an element instance, sets the appropriate fields from the provided XML node...
Definition: ElementFactory.h:176
The definition of a response to an event.
Definition: EventEffect.h:65
Classes for manipulating agent properties in an "undoable" manner (albeit, to a limited degree)...
EventEffect * instance() const
Create an instance of this class's effect.
Definition: AgentPropertyEffect.h:247
Manipulator * getManipulator()
Returns a pointer to the manipulator.
Definition: AgentPropertyEffect.h:77
The base class for generating event effects.
Definition: EventEffectFactory.h:56
The base class event effect changes agent properties.
Definition: AgentPropertyEffect.h:67
Logger logger
Globally available Logger.
Definition: Logger.cpp:49
virtual const char * description() const
A description of the effect.
Definition: AgentPropertyEffect.h:275
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
AgentPropertyEffectFactory()
Constructor.
Definition: AgentPropertyEffect.h:108
Defines the basic agent properties and functionality that all simulation agents share.
Definition: BaseAgent.h:123
Factory for the OffsetPropertyEffect.
Definition: AgentPropertyEffect.h:212
The namespace that contains the basic simulation mechanisms.
EventEffect * instance() const
Create an instance of this class's effect.
Definition: AgentPropertyEffect.h:204
Factory for the ScalePropertyEffect.
Definition: AgentPropertyEffect.h:255
Error encountered but not handled.
Definition: Logger.h:69
The event effect class that operates on sets of agents.
Definition: AgentEventEffect.h:63
The definition of the agent event effect – defines the agent-base effect.
The definition of the basic event effect factory.
size_t _propertyID
The identifier for the "property" string attribute.
Definition: AgentPropertyEffect.h:156
virtual void agentEffect(Agents::BaseAgent *agent)
The actual work of the effect.
Definition: AgentPropertyEffect.h:89
virtual bool setFromXML(EventEffect *effect, TiXmlElement *node, const std::string &behaveFldr) const
Given a pointer to an AgentPropertyEffect instance, sets the appropriate fields from the provided XML...
Definition: AgentPropertyEffect.h:132