SUMO - Simulation of Urban MObility
|
A storage for of displayed objects via their numerical id. More...
#include <GUIGlObjectStorage.h>
Public Member Functions | |
void | clear () |
Clears this container. | |
std::set< GUIGlID > | getAllIDs () const |
Returns the set of all known ids. | |
GUIGlObject * | getNetObject () const |
Returns the network object. | |
GUIGlObject * | getObjectBlocking (GUIGlID id) |
Returns the object from the container locking it. | |
GUIGlObject * | getObjectBlocking (const std::string &fullName) |
Returns the object from the container locking it. | |
GUIGlObjectStorage () | |
Constructor. | |
GUIGlID | registerObject (GUIGlObject *object, const std::string &fullName) |
Registers an object. | |
bool | remove (GUIGlID id) |
Removes the named object from this container. | |
void | setNetObject (GUIGlObject *object) |
Sets the given object as the "network" object. | |
void | unblockObject (GUIGlID id) |
Marks an object as unblocked. | |
~GUIGlObjectStorage () | |
Destructor. | |
Static Public Attributes | |
static GUIGlObjectStorage | gIDStorage |
A single static instance of this class. | |
Private Types | |
typedef std::map< GUIGlID, GUIGlObject * > | ObjectMap |
Definition of a container from numerical ids to objects. | |
Private Member Functions | |
GUIGlObjectStorage (const GUIGlObjectStorage &s) | |
invalidated copy constructor | |
GUIGlObjectStorage & | operator= (const GUIGlObjectStorage &s) |
invalidate assignment operator | |
Private Attributes | |
ObjectMap | my2Delete |
Objects to delete. | |
GUIGlID | myAktID |
The next id to give; initially zero, increased by one with each object registration. | |
ObjectMap | myBlocked |
The currently accessed objects. | |
std::map< std::string, GUIGlObject * > | myFullNameMap |
MFXMutex | myLock |
A lock to avoid parallel access on the storages. | |
ObjectMap | myMap |
The known objects which are not accessed currently. | |
GUIGlObject * | myNetObject |
The network object. |
A storage for of displayed objects via their numerical id.
This is a container for GUIGlObject - objects, which may be displayed and due to this may generate tooltips or be grapped in other ways.
As in case of vehicles (other, later implemented objects may have this property, too) they may be deleted by the simulation while being accessed
Definition at line 60 of file GUIGlObjectStorage.h.
typedef std::map<GUIGlID, GUIGlObject*> GUIGlObjectStorage::ObjectMap [private] |
Definition of a container from numerical ids to objects.
Definition at line 158 of file GUIGlObjectStorage.h.
Constructor.
Definition at line 54 of file GUIGlObjectStorage.cpp.
Destructor.
Definition at line 58 of file GUIGlObjectStorage.cpp.
GUIGlObjectStorage::GUIGlObjectStorage | ( | const GUIGlObjectStorage & | s | ) | [private] |
invalidated copy constructor
void GUIGlObjectStorage::clear | ( | ) |
Clears this container.
The objects are not deleted.
Definition at line 131 of file GUIGlObjectStorage.cpp.
References MFXMutex::lock(), myAktID, myLock, myMap, and MFXMutex::unlock().
Referenced by GUIRunThread::deleteSim().
std::set< GUIGlID > GUIGlObjectStorage::getAllIDs | ( | ) | const |
Returns the set of all known ids.
Definition at line 155 of file GUIGlObjectStorage.cpp.
References myMap.
GUIGlObject* GUIGlObjectStorage::getNetObject | ( | ) | const [inline] |
Returns the network object.
Definition at line 142 of file GUIGlObjectStorage.h.
References myNetObject.
Referenced by GUISUMOAbstractView::openObjectDialog().
Returns the object from the container locking it.
The lock prevents the object from being deleted while it is accessed. The object is moved from "myMap" to "myBlocked".
[in] | id | The id of the object to return |
Definition at line 73 of file GUIGlObjectStorage.cpp.
References MFXMutex::lock(), myBlocked, myLock, myMap, and MFXMutex::unlock().
Referenced by GUISUMOAbstractView::centerTo(), GUISelectedStorage::deselect(), GUISUMOAbstractView::getObjectAtPosition(), getObjectBlocking(), GUISelectedStorage::loadIDs(), GUISUMOAbstractView::openObjectDialog(), GUIDialog_GLChosenEditor::rebuildList(), GUISelectedStorage::save(), GUISelectedStorage::select(), GUISUMOAbstractView::showToolTipFor(), and GUISelectedStorage::toggleSelection().
GUIGlObject * GUIGlObjectStorage::getObjectBlocking | ( | const std::string & | fullName | ) |
Returns the object from the container locking it.
The lock prevents the object from being deleted while it is accessed. The object is moved from "myMap" to "myBlocked".
[in] | id | The id of the object to return |
Definition at line 95 of file GUIGlObjectStorage.cpp.
References getObjectBlocking(), MFXMutex::lock(), myFullNameMap, myLock, and MFXMutex::unlock().
GUIGlObjectStorage& GUIGlObjectStorage::operator= | ( | const GUIGlObjectStorage & | s | ) | [private] |
invalidate assignment operator
GUIGlID GUIGlObjectStorage::registerObject | ( | GUIGlObject * | object, |
const std::string & | fullName | ||
) |
Registers an object.
This done within the constructor of the GUIGlObject; The object's "setGLID" method is called giving the next free id.
[in] | object | The object to register |
[in] | fullName | The full name of the object to register |
Definition at line 62 of file GUIGlObjectStorage.cpp.
References MFXMutex::lock(), myAktID, myFullNameMap, myLock, myMap, and MFXMutex::unlock().
Referenced by GUIGlObject::GUIGlObject().
Removes the named object from this container.
This function returns true if the object may be deleted; otherwise it's kept in an internal storage (for visualisation etc.) and will be removed by this class
[in] | id | The id of the object to remove |
Definition at line 109 of file GUIGlObjectStorage.cpp.
References MFXMutex::lock(), my2Delete, myBlocked, myFullNameMap, myLock, myMap, and MFXMutex::unlock().
Referenced by GUIGlObject::~GUIGlObject().
void GUIGlObjectStorage::setNetObject | ( | GUIGlObject * | object | ) | [inline] |
Sets the given object as the "network" object.
[in] | object | The object to set as network object |
Definition at line 134 of file GUIGlObjectStorage.h.
References myNetObject.
Referenced by GUINet::GUINet().
void GUIGlObjectStorage::unblockObject | ( | GUIGlID | id | ) |
Marks an object as unblocked.
The object is moved from "myBlocked" to "myMap".
[in] | id | The id of the object to unblock |
Definition at line 140 of file GUIGlObjectStorage.cpp.
References MFXMutex::lock(), myBlocked, myLock, myMap, and MFXMutex::unlock().
Referenced by GUISUMOAbstractView::centerTo(), GUISelectedStorage::deselect(), GUISUMOAbstractView::getObjectAtPosition(), GUISUMOAbstractView::openObjectDialog(), GUIDialog_GLChosenEditor::rebuildList(), GUISelectedStorage::save(), GUISelectedStorage::select(), GUISUMOAbstractView::showToolTipFor(), and GUISelectedStorage::toggleSelection().
A single static instance of this class.
Definition at line 149 of file GUIGlObjectStorage.h.
Referenced by GUISUMOAbstractView::centerTo(), GUIRunThread::deleteSim(), GUISelectedStorage::deselect(), GUISUMOAbstractView::getObjectAtPosition(), GUIGlObject::GUIGlObject(), GUINet::GUINet(), GUISelectedStorage::loadIDs(), GUISUMOViewParent::onCmdLocate(), GUISUMOAbstractView::openObjectDialog(), GUIDialog_GLChosenEditor::rebuildList(), GUISelectedStorage::save(), GUISelectedStorage::select(), GUISUMOAbstractView::showToolTipFor(), GUISelectedStorage::toggleSelection(), and GUIGlObject::~GUIGlObject().
ObjectMap GUIGlObjectStorage::my2Delete [private] |
GUIGlID GUIGlObjectStorage::myAktID [private] |
The next id to give; initially zero, increased by one with each object registration.
Definition at line 174 of file GUIGlObjectStorage.h.
Referenced by clear(), and registerObject().
ObjectMap GUIGlObjectStorage::myBlocked [private] |
The currently accessed objects.
Definition at line 168 of file GUIGlObjectStorage.h.
Referenced by getObjectBlocking(), remove(), and unblockObject().
std::map<std::string, GUIGlObject*> GUIGlObjectStorage::myFullNameMap [private] |
Definition at line 165 of file GUIGlObjectStorage.h.
Referenced by getObjectBlocking(), registerObject(), and remove().
MFXMutex GUIGlObjectStorage::myLock [private] |
A lock to avoid parallel access on the storages.
Definition at line 177 of file GUIGlObjectStorage.h.
Referenced by clear(), getObjectBlocking(), registerObject(), remove(), and unblockObject().
ObjectMap GUIGlObjectStorage::myMap [private] |
The known objects which are not accessed currently.
Definition at line 161 of file GUIGlObjectStorage.h.
Referenced by clear(), getAllIDs(), getObjectBlocking(), registerObject(), remove(), and unblockObject().
GUIGlObject* GUIGlObjectStorage::myNetObject [private] |
The network object.
Definition at line 180 of file GUIGlObjectStorage.h.
Referenced by getNetObject(), and setNetObject().