SUMO - Simulation of Urban MObility

GUIGlObjectStorage Class Reference

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

#include <GUIGlObjectStorage.h>

Public Member Functions

void clear () throw ()
 Clears this container.
std::set< GUIGlID > getAllIDs () const
 Returns the set of all known ids.
GUIGlObject * getNetObject () const throw ()
 Returns the network object.
GUIGlObject * getObjectBlocking (const std::string &fullName) throw ()
 Returns the object from the container locking it.
GUIGlObject * getObjectBlocking (GUIGlID id) throw ()
 Returns the object from the container locking it.
 GUIGlObjectStorage () throw ()
 Constructor.
GUIGlID registerObject (GUIGlObject *object, const std::string &fullName) throw ()
 Registers an object.
bool remove (GUIGlID id) throw ()
 Removes the named object from this container.
void setNetObject (GUIGlObject *object) throw ()
 Sets the given object as the "network" object.
void unblockObject (GUIGlID id) throw ()
 Marks an object as unblocked.
 ~GUIGlObjectStorage () throw ()
 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.

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


Member Typedef Documentation

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

Definition of a container from numerical ids to objects.

Definition at line 155 of file GUIGlObjectStorage.h.


Constructor & Destructor Documentation

GUIGlObjectStorage::GUIGlObjectStorage ( ) throw ()

Constructor.

Definition at line 51 of file GUIGlObjectStorage.cpp.

GUIGlObjectStorage::~GUIGlObjectStorage ( ) throw ()

Destructor.

Definition at line 55 of file GUIGlObjectStorage.cpp.

GUIGlObjectStorage::GUIGlObjectStorage ( const GUIGlObjectStorage &  s) [private]

invalidated copy constructor


Member Function Documentation

void GUIGlObjectStorage::clear ( ) throw ()

Clears this container.

The objects are not deleted.

Definition at line 128 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 152 of file GUIGlObjectStorage.cpp.

References myMap.

GUIGlObject* GUIGlObjectStorage::getNetObject ( ) const throw () [inline]

Returns the network object.

Returns:
The network object

Definition at line 139 of file GUIGlObjectStorage.h.

References myNetObject.

Referenced by GUISUMOAbstractView::openObjectDialog().

GUIGlObject * GUIGlObjectStorage::getObjectBlocking ( GUIGlID  id) throw ()

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

Referenced by GUISUMOAbstractView::centerTo(), GUISelectedStorage::deselect(), GUISUMOAbstractView::getObjectAtPosition(), GUISelectedStorage::loadIDs(), GUISUMOAbstractView::openObjectDialog(), GUIDialog_GLChosenEditor::rebuildList(), GUISelectedStorage::save(), GUISelectedStorage::select(), GUISUMOAbstractView::showToolTipFor(), and GUISelectedStorage::toggleSelection().

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

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

References GUIGlObject::getGlID().

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

invalidate assignment operator

GUIGlID GUIGlObjectStorage::registerObject ( GUIGlObject *  object,
const std::string &  fullName 
) throw ()

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

Referenced by GUIGlObject::GUIGlObject().

bool GUIGlObjectStorage::remove ( GUIGlID  id) throw ()

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

Referenced by GUIGlObject::~GUIGlObject().

void GUIGlObjectStorage::setNetObject ( GUIGlObject *  object) throw () [inline]

Sets the given object as the "network" object.

Parameters:
[in]objectThe object to set as network object

Definition at line 131 of file GUIGlObjectStorage.h.

References myNetObject.

Referenced by GUINet::GUINet().

void GUIGlObjectStorage::unblockObject ( GUIGlID  id) throw ()

Field Documentation

Objects to delete.

Definition at line 168 of file GUIGlObjectStorage.h.

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

Definition at line 171 of file GUIGlObjectStorage.h.

Referenced by clear().

The currently accessed objects.

Definition at line 165 of file GUIGlObjectStorage.h.

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

Definition at line 162 of file GUIGlObjectStorage.h.

A lock to avoid parallel access on the storages.

Definition at line 174 of file GUIGlObjectStorage.h.

Referenced by clear().

The known objects which are not accessed currently.

Definition at line 158 of file GUIGlObjectStorage.h.

Referenced by clear(), and getAllIDs().

The network object.

Definition at line 177 of file GUIGlObjectStorage.h.

Referenced by getNetObject(), and setNetObject().


The documentation for this class was generated from the following files:
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines