SUMO - Simulation of Urban MObility
GUIGlObjectStorage Class Reference

A storage for of displayed objects via their numerical id. More...

#include <GUIGlObjectStorage.h>

Collaboration diagram for GUIGlObjectStorage:
Collaboration graph

Public Member Functions

void clear ()
 Clears this container. More...
 
std::set< GUIGlIDgetAllIDs () const
 Returns the set of all known ids. More...
 
GUIGlObjectgetNetObject () const
 Returns the network object. More...
 
GUIGlObjectgetObjectBlocking (GUIGlID id)
 Returns the object from the container locking it. More...
 
GUIGlObjectgetObjectBlocking (const std::string &fullName)
 Returns the object from the container locking it. More...
 
 GUIGlObjectStorage ()
 Constructor. More...
 
GUIGlID registerObject (GUIGlObject *object, const std::string &fullName)
 Registers an object. More...
 
bool remove (GUIGlID id)
 Removes the named object from this container. More...
 
void setNetObject (GUIGlObject *object)
 Sets the given object as the "network" object. More...
 
void unblockObject (GUIGlID id)
 Marks an object as unblocked. More...
 
 ~GUIGlObjectStorage ()
 Destructor. More...
 

Static Public Attributes

static GUIGlObjectStorage gIDStorage
 A single static instance of this class. More...
 

Private Types

typedef std::map< GUIGlID, GUIGlObject * > ObjectMap
 Definition of a container from numerical ids to objects. More...
 

Private Member Functions

 GUIGlObjectStorage (const GUIGlObjectStorage &s)
 invalidated copy constructor More...
 
GUIGlObjectStorageoperator= (const GUIGlObjectStorage &s)
 invalidate assignment operator More...
 

Private Attributes

ObjectMap my2Delete
 Objects to delete. More...
 
GUIGlID myAktID
 The next id to give; initially zero, increased by one with each object registration. More...
 
ObjectMap myBlocked
 The currently accessed objects. More...
 
std::map< std::string, GUIGlObject * > myFullNameMap
 
MFXMutex myLock
 A lock to avoid parallel access on the storages. More...
 
ObjectMap myMap
 The known objects which are not accessed currently. More...
 
GUIGlObjectmyNetObject
 The network object. More...
 

Detailed Description

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

  • for example using a property window or something like that - this container posesses three storages: one containing all objects that are not accessed at all, one for objects currently accessed and one for objects that are accessed but shall be deleted.

Definition at line 53 of file GUIGlObjectStorage.h.

Member Typedef Documentation

◆ ObjectMap

typedef std::map<GUIGlID, GUIGlObject*> GUIGlObjectStorage::ObjectMap
private

Definition of a container from numerical ids to objects.

Definition at line 151 of file GUIGlObjectStorage.h.

Constructor & Destructor Documentation

◆ GUIGlObjectStorage() [1/2]

GUIGlObjectStorage::GUIGlObjectStorage ( )

Constructor.

Definition at line 43 of file GUIGlObjectStorage.cpp.

◆ ~GUIGlObjectStorage()

GUIGlObjectStorage::~GUIGlObjectStorage ( )

Destructor.

Definition at line 47 of file GUIGlObjectStorage.cpp.

◆ GUIGlObjectStorage() [2/2]

GUIGlObjectStorage::GUIGlObjectStorage ( const GUIGlObjectStorage s)
private

invalidated copy constructor

Member Function Documentation

◆ clear()

void GUIGlObjectStorage::clear ( )

Clears this container.

The objects are not deleted.

Definition at line 110 of file GUIGlObjectStorage.cpp.

References myAktID, myLock, and myMap.

Referenced by GUIRunThread::deleteSim().

◆ getAllIDs()

std::set< GUIGlID > GUIGlObjectStorage::getAllIDs ( ) const

Returns the set of all known ids.

Definition at line 131 of file GUIGlObjectStorage.cpp.

References myLock, and myMap.

◆ getNetObject()

GUIGlObject* GUIGlObjectStorage::getNetObject ( ) const
inline

Returns the network object.

Returns
The network object

Definition at line 135 of file GUIGlObjectStorage.h.

References myNetObject.

Referenced by GUISUMOAbstractView::openObjectDialog(), and GNEViewNet::openObjectDialog().

◆ getObjectBlocking() [1/2]

GUIGlObject * GUIGlObjectStorage::getObjectBlocking ( GUIGlID  id)

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".

Parameters
[in]idThe id of the object to return
Returns
The object with the given id or 0 if no such object is known

Definition at line 61 of file GUIGlObjectStorage.cpp.

References myBlocked, myLock, and myMap.

Referenced by GUISUMOAbstractView::centerTo(), GUISelectedStorage::deselect(), GUIMessageWindow::getActiveStringObject(), GNEViewNet::getAdditionalAtPopupPosition(), GNEViewNet::getConnectionAtPopupPosition(), GNEViewNet::getCrossingAtPopupPosition(), GNEViewNet::getEdgeAtPopupPosition(), GUISUMOAbstractView::getGUIGlObjectsAtPosition(), GNEViewNet::getJunctionAtPopupPosition(), GNEViewNet::getLaneAtPopupPosition(), GUIViewTraffic::getLaneUnderCursor(), GUISUMOAbstractView::getObjectAtPosition(), getObjectBlocking(), GUISUMOAbstractView::getObjectsAtPosition(), GNEViewNet::getPOIAtPopupPosition(), GNEViewNet::getPolygonAtPopupPosition(), GUISelectedStorage::loadIDs(), GNEViewNet::mergeJunctions(), GNEViewNet::onCmdAddSelected(), GNESelectorFrame::SelectionOperation::onCmdLoad(), GNEViewNet::onCmdRemoveSelected(), GNEViewNet::onCmdTransformPOI(), GUISUMOAbstractView::openObjectDialog(), GNEViewNet::openObjectDialog(), GUIDialog_GLChosenEditor::rebuildList(), GUIDialog_GLObjChooser::refreshList(), GNENet::retrieveAttributeCarrier(), GUISelectedStorage::save(), GUISelectedStorage::select(), GUISUMOAbstractView::showToolTipFor(), and GUISelectedStorage::toggleSelection().

◆ getObjectBlocking() [2/2]

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".

Parameters
[in]idThe id of the object to return
Returns
The object with the given id or 0 if no such object is known

Definition at line 80 of file GUIGlObjectStorage.cpp.

References getObjectBlocking(), myFullNameMap, and myLock.

◆ operator=()

GUIGlObjectStorage& GUIGlObjectStorage::operator= ( const GUIGlObjectStorage s)
private

invalidate assignment operator

◆ registerObject()

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.

Parameters
[in]objectThe object to register
[in]fullNameThe full name of the object to register
Returns
the GUIGlObject under which the object has been registered

Definition at line 51 of file GUIGlObjectStorage.cpp.

References myAktID, myFullNameMap, myLock, and myMap.

Referenced by GUIGlObject::GUIGlObject().

◆ remove()

bool GUIGlObjectStorage::remove ( GUIGlID  id)

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

Parameters
[in]idThe id of the object to remove
Returns
Whether the object could be removed (and may be deleted)

Definition at line 91 of file GUIGlObjectStorage.cpp.

References my2Delete, myBlocked, myFullNameMap, myLock, and myMap.

Referenced by GUIGlObject::~GUIGlObject().

◆ setNetObject()

void GUIGlObjectStorage::setNetObject ( GUIGlObject object)
inline

Sets the given object as the "network" object.

Parameters
[in]objectThe object to set as network object

Definition at line 127 of file GUIGlObjectStorage.h.

References myNetObject.

Referenced by GNENet::GNENet(), and GUINet::GUINet().

◆ unblockObject()

Field Documentation

◆ gIDStorage

GUIGlObjectStorage GUIGlObjectStorage::gIDStorage
static

A single static instance of this class.

Definition at line 142 of file GUIGlObjectStorage.h.

Referenced by GUIMessageWindow::appendMsg(), GUISUMOAbstractView::centerTo(), GUIRunThread::deleteSim(), GUISelectedStorage::deselect(), GUIMessageWindow::getActiveStringObject(), GNEViewNet::getAdditionalAtPopupPosition(), GNEViewNet::getConnectionAtPopupPosition(), GNEViewNet::getCrossingAtPopupPosition(), GNEViewNet::getEdgeAtPopupPosition(), GUISUMOAbstractView::getGUIGlObjectsAtPosition(), GNEViewNet::getJunctionAtPopupPosition(), GNEViewNet::getLaneAtPopupPosition(), GUIViewTraffic::getLaneUnderCursor(), GUISUMOAbstractView::getObjectAtPosition(), GUISUMOAbstractView::getObjectsAtPosition(), GNEViewNet::getPOIAtPopupPosition(), GNEViewNet::getPolygonAtPopupPosition(), GNENet::GNENet(), GUIGlObject::GUIGlObject(), GUINet::GUINet(), GUISelectedStorage::loadIDs(), GNEViewNet::mergeJunctions(), GUIViewTraffic::onCmdAddRerouter(), GNEViewNet::onCmdAddSelected(), GUIViewTraffic::onCmdCloseEdge(), GUIViewTraffic::onCmdCloseLane(), GNESelectorFrame::SelectionOperation::onCmdLoad(), GUISUMOViewParent::onCmdLocate(), GNEViewNet::onCmdRemoveSelected(), GNEViewNet::onCmdTransformPOI(), GUISUMOAbstractView::openObjectDialog(), GNEViewNet::openObjectDialog(), GUIDialog_GLChosenEditor::rebuildList(), GUIDialog_GLObjChooser::refreshList(), GNENet::retrieveAttributeCarrier(), GUISelectedStorage::save(), GUISelectedStorage::select(), GUIMessageWindow::setCursorPos(), GUISUMOAbstractView::showToolTipFor(), GUISelectedStorage::toggleSelection(), and GUIGlObject::~GUIGlObject().

◆ my2Delete

ObjectMap GUIGlObjectStorage::my2Delete
private

Objects to delete.

Definition at line 164 of file GUIGlObjectStorage.h.

Referenced by remove().

◆ myAktID

GUIGlID GUIGlObjectStorage::myAktID
private

The next id to give; initially zero, increased by one with each object registration.

Definition at line 167 of file GUIGlObjectStorage.h.

Referenced by clear(), and registerObject().

◆ myBlocked

ObjectMap GUIGlObjectStorage::myBlocked
private

The currently accessed objects.

Definition at line 161 of file GUIGlObjectStorage.h.

Referenced by getObjectBlocking(), remove(), and unblockObject().

◆ myFullNameMap

std::map<std::string, GUIGlObject*> GUIGlObjectStorage::myFullNameMap
private

Definition at line 158 of file GUIGlObjectStorage.h.

Referenced by getObjectBlocking(), registerObject(), and remove().

◆ myLock

MFXMutex GUIGlObjectStorage::myLock
mutableprivate

A lock to avoid parallel access on the storages.

Definition at line 170 of file GUIGlObjectStorage.h.

Referenced by clear(), getAllIDs(), getObjectBlocking(), registerObject(), remove(), and unblockObject().

◆ myMap

ObjectMap GUIGlObjectStorage::myMap
private

The known objects which are not accessed currently.

Definition at line 154 of file GUIGlObjectStorage.h.

Referenced by clear(), getAllIDs(), getObjectBlocking(), registerObject(), remove(), and unblockObject().

◆ myNetObject

GUIGlObject* GUIGlObjectStorage::myNetObject
private

The network object.

Definition at line 173 of file GUIGlObjectStorage.h.

Referenced by getNetObject(), and setNetObject().


The documentation for this class was generated from the following files: