Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GUIGlObjectStorage Class Reference

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

#include <GUIGlObjectStorage.h>

Collaboration diagram for GUIGlObjectStorage:
[legend]

Public Member Functions

void changeName (GUIGlObject *object, const std::string &fullName)
 
void clear ()
 Clears this container.
 
const std::vector< GUIGlObject * > & getAllGLObjects () const
 Returns the set of all known objects.
 
GUIGlObjectgetNetObject () const
 Returns the network object.
 
GUIGlObjectgetObjectBlocking (const std::string &fullName) const
 Returns the object from the container locking it.
 
GUIGlObjectgetObjectBlocking (GUIGlID id) const
 Returns the object from the container locking it.
 
 GUIGlObjectStorage ()
 Constructor.
 
GUIGlID registerObject (GUIGlObject *object)
 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 Member Functions

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

Private Attributes

std::map< std::string, GUIGlObject * > myFullNameMap
 The known objects by their full name.
 
FXMutex myLock
 A lock to avoid parallel access on the storages.
 
GUIGlObjectmyNetObject
 The network object.
 
GUIGlID myNextID
 The next id to give; initially one, increased by one with each object registration.
 
std::vector< GUIGlObject * > myObjects
 The known objects.
 

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 49 of file GUIGlObjectStorage.h.

Constructor & Destructor Documentation

◆ GUIGlObjectStorage() [1/2]

GUIGlObjectStorage::GUIGlObjectStorage ( )

Constructor.

Definition at line 39 of file GUIGlObjectStorage.cpp.

References myObjects.

◆ ~GUIGlObjectStorage()

GUIGlObjectStorage::~GUIGlObjectStorage ( )

Destructor.

Definition at line 46 of file GUIGlObjectStorage.cpp.

◆ GUIGlObjectStorage() [2/2]

GUIGlObjectStorage::GUIGlObjectStorage ( const GUIGlObjectStorage s)
privatedelete

invalidated copy constructor

Member Function Documentation

◆ changeName()

void GUIGlObjectStorage::changeName ( GUIGlObject object,
const std::string &  fullName 
)

Definition at line 66 of file GUIGlObjectStorage.cpp.

References myFullNameMap, and myLock.

Referenced by GUIGlObject::GUIGlObject(), and GUIGlObject::setMicrosimID().

Here is the caller graph for this function:

◆ clear()

void GUIGlObjectStorage::clear ( )

Clears this container.

The objects are not deleted.

Definition at line 113 of file GUIGlObjectStorage.cpp.

References myFullNameMap, myLock, myNextID, and myObjects.

Referenced by GUIRunThread::deleteSim().

Here is the caller graph for this function:

◆ getAllGLObjects()

const std::vector< GUIGlObject * > & GUIGlObjectStorage::getAllGLObjects ( ) const

Returns the set of all known objects.

Definition at line 132 of file GUIGlObjectStorage.cpp.

References myObjects.

Referenced by GNESelectorFrame::SelectionOperation::loadFromFile().

Here is the caller graph for this function:

◆ getNetObject()

GUIGlObject * GUIGlObjectStorage::getNetObject ( ) const
inline

Returns the network object.

Returns
The network object

Definition at line 124 of file GUIGlObjectStorage.h.

References myNetObject.

Referenced by GUISUMOAbstractView::openObjectDialogAtCursor().

Here is the caller graph for this function:

◆ getObjectBlocking() [1/2]

GUIGlObject * GUIGlObjectStorage::getObjectBlocking ( const std::string &  fullName) const

Returns the object from the container locking it.

The lock prevents the object from being deleted while it is accessed.

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

Definition at line 86 of file GUIGlObjectStorage.cpp.

References myFullNameMap, myLock, and GUIGlObject::setBlocked().

◆ getObjectBlocking() [2/2]

GUIGlObject * GUIGlObjectStorage::getObjectBlocking ( GUIGlID  id) const

◆ operator=()

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

invalidate assignment operator

◆ registerObject()

GUIGlID GUIGlObjectStorage::registerObject ( GUIGlObject object)

Registers an object.

This is done within the constructor of the GUIGlObject. The next free id is calculated as well.

Parameters
[in]objectThe object to register

Definition at line 50 of file GUIGlObjectStorage.cpp.

References myLock, myNextID, and myObjects.

◆ 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 99 of file GUIGlObjectStorage.cpp.

References myFullNameMap, myLock, myNextID, and myObjects.

Referenced by GUIGlObject::~GUIGlObject().

Here is the caller graph for this function:

◆ 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 117 of file GUIGlObjectStorage.h.

References myNetObject.

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

Here is the caller graph for this function:

◆ unblockObject()

Field Documentation

◆ gIDStorage

GUIGlObjectStorage GUIGlObjectStorage::gIDStorage
static

A single static instance of this class.

Definition at line 129 of file GUIGlObjectStorage.h.

Referenced by GUIMessageWindow::appendMsg(), GUISUMOAbstractView::centerTo(), GUIRunThread::deleteSim(), GUISelectedStorage::deselect(), GUIMessageWindow::getActiveStringObject(), GUISUMOAbstractView::getGUIGlObjectsAtPosition(), GUIViewTraffic::getLaneUnderCursor(), GUISUMOAbstractView::getObjectAtPosition(), GUISUMOAbstractView::getObjectsAtPosition(), GNENet::GNENet(), GUIGlObject::GUIGlObject(), GUINet::GUINet(), GNESelectorFrame::SelectionOperation::loadFromFile(), GUISelectedStorage::loadIDs(), GUIViewTraffic::onCmdAddRerouter(), GUIViewTraffic::onCmdCloseEdge(), GUIViewTraffic::onCmdCloseLane(), GUISUMOViewParent::onCmdLocate(), GUIDialog_ChooserAbstract::onCmdLocateByName(), GUISUMOViewParent::onCmdSpeedFactor(), GUIDialog_ChooserAbstract::onCmdTrack(), GNEViewNet::onCmdTransformPOI(), GUIViewTraffic::onGamingClick(), GUIViewTraffic::onGamingRightClick(), GUISUMOAbstractView::onLeftBtnPress(), GUISUMOViewParent::onUpdSpeedFactor(), GUISUMOAbstractView::openObjectDialogAtCursor(), GUIDialog_GLChosenEditor::rebuildList(), GUIDialog_ChooserAbstract::refreshList(), GNENetHelper::AttributeCarriers::retrieveAttributeCarrier(), GUISelectedStorage::save(), GUISelectedStorage::select(), GUIMessageWindow::setCursorPos(), GUIGlObject::setMicrosimID(), GUISUMOAbstractView::showToolTipFor(), GUIViewTraffic::startTrack(), GUISelectedStorage::toggleSelection(), and GUIGlObject::~GUIGlObject().

◆ myFullNameMap

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

The known objects by their full name.

Definition at line 139 of file GUIGlObjectStorage.h.

Referenced by changeName(), clear(), getObjectBlocking(), and remove().

◆ myLock

FXMutex GUIGlObjectStorage::myLock
mutableprivate

A lock to avoid parallel access on the storages.

Definition at line 145 of file GUIGlObjectStorage.h.

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

◆ myNetObject

GUIGlObject* GUIGlObjectStorage::myNetObject
private

The network object.

Definition at line 148 of file GUIGlObjectStorage.h.

Referenced by getNetObject(), and setNetObject().

◆ myNextID

GUIGlID GUIGlObjectStorage::myNextID
private

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

Definition at line 142 of file GUIGlObjectStorage.h.

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

◆ myObjects

std::vector<GUIGlObject*> GUIGlObjectStorage::myObjects
private

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