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.
More...
#include <AgentPropertyManipulator.h>
|
FloatGenerator * | _operandGen |
| The generator for determining the operand value.
|
|
BFSM::PropertyOperand | _property |
| The property to operate on.
|
|
std::map< size_t, float > | _originalMap |
| A mapping from agent id to the agent's property value before the action was applied.
|
|
SimpleLock | _lock |
| Lock for guaranteeing thread-safety.
|
|
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.
Applies the manipulation to the given agent, storing the previous state for restoration.
- Parameters
-
agent | The agent to manipulate. |
virtual float Menge::AgentPropertyManipulator::newValue |
( |
float |
value, |
|
|
size_t |
agentID |
|
) |
| |
|
protectedpure virtual |
Restores the agent's previous value.
If there is no previous value for the provided agent, nothing happens.
- Parameters
-
agent | The agent whose property value should be restored. |
void Menge::AgentPropertyManipulator::setGenerator |
( |
FloatGenerator * |
gen | ) |
|
Sets the generator for the manipulator.
- Parameters
-
gen | The generator to assign to this manipulator. Any previous generator will be destroyed and it is assumed that the generator is not shared with any other entity. |
void Menge::AgentPropertyManipulator::setProperty |
( |
BFSM::PropertyOperand |
prop | ) |
|
|
inline |
Sets the property operand.
- Parameters
-
prop | The property to operate on. |
The documentation for this class was generated from the following files: