Maintain a diff list of changes that have happened to a World. More...
#include <world_diff.h>
Public Types | |
typedef std::map< std::string, World::Action > ::const_iterator | const_iterator |
Public Member Functions | |
const_iterator | begin () const |
void | clearChanges () |
Clear the internally maintained vector of changes. | |
const_iterator | end () const |
const_iterator | find (const std::string &id) const |
const std::map< std::string, World::Action > & | getChanges () const |
Return all the changes that have been recorded. | |
void | reset (const WorldPtr &world) |
Set which world to record. Erases all previously recorded changes. | |
void | reset () |
Turn off recording and erase all previously recorded changes. | |
void | set (const std::string &id, World::Action val) |
void | setWorld (const WorldPtr &world) |
Set which world to record. Records all objects in old world (if any) as DESTROYED and all objects in new world as CREATED and ADD_SHAPE. | |
size_t | size () const |
WorldDiff () | |
Constructor. | |
WorldDiff (const WorldPtr &world) | |
Constructor. | |
WorldDiff (WorldDiff &other) | |
copy constructor. | |
~WorldDiff () | |
Private Member Functions | |
void | notify (const World::ObjectConstPtr &, World::Action) |
Notification function. | |
Private Attributes | |
std::map< std::string, World::Action > | changes_ |
World::ObserverHandle | observer_handle_ |
boost::weak_ptr< World > | world_ |
Maintain a diff list of changes that have happened to a World.
Definition at line 47 of file world_diff.h.
typedef std::map<std::string, World::Action>::const_iterator collision_detection::WorldDiff::const_iterator |
Definition at line 80 of file world_diff.h.
Constructor.
Definition at line 48 of file world_diff.cpp.
collision_detection::WorldDiff::WorldDiff | ( | const WorldPtr & | world | ) |
Constructor.
Definition at line 51 of file world_diff.cpp.
copy constructor.
Definition at line 57 of file world_diff.cpp.
Definition at line 41 of file world_diff.cpp.
const_iterator collision_detection::WorldDiff::begin | ( | ) | const [inline] |
iterator pointing to first change
Definition at line 82 of file world_diff.h.
Clear the internally maintained vector of changes.
Definition at line 107 of file world_diff.cpp.
const_iterator collision_detection::WorldDiff::end | ( | ) | const [inline] |
iterator pointing to end of changes
Definition at line 87 of file world_diff.h.
const_iterator collision_detection::WorldDiff::find | ( | const std::string & | id | ) | const [inline] |
find changes for a named object
Definition at line 97 of file world_diff.h.
const std::map<std::string, World::Action>& collision_detection::WorldDiff::getChanges | ( | ) | const [inline] |
Return all the changes that have been recorded.
Definition at line 75 of file world_diff.h.
void collision_detection::WorldDiff::notify | ( | const World::ObjectConstPtr & | obj, |
World::Action | action | ||
) | [private] |
Notification function.
Definition at line 112 of file world_diff.cpp.
void collision_detection::WorldDiff::reset | ( | const WorldPtr & | world | ) |
Set which world to record. Erases all previously recorded changes.
Definition at line 80 of file world_diff.cpp.
Turn off recording and erase all previously recorded changes.
Definition at line 69 of file world_diff.cpp.
void collision_detection::WorldDiff::set | ( | const std::string & | id, |
World::Action | val | ||
) | [inline] |
set the entry for an id
Definition at line 102 of file world_diff.h.
void collision_detection::WorldDiff::setWorld | ( | const WorldPtr & | world | ) |
Set which world to record. Records all objects in old world (if any) as DESTROYED and all objects in new world as CREATED and ADD_SHAPE.
Definition at line 92 of file world_diff.cpp.
size_t collision_detection::WorldDiff::size | ( | ) | const [inline] |
number of changes stored
Definition at line 92 of file world_diff.h.
std::map<std::string, World::Action> collision_detection::WorldDiff::changes_ [private] |
keep changes in a map so they can be coalesced
Definition at line 118 of file world_diff.h.
Definition at line 121 of file world_diff.h.
boost::weak_ptr<World> collision_detection::WorldDiff::world_ [private] |
Definition at line 124 of file world_diff.h.