|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00007 // A storage for displayed objects via their numerical id 00008 /****************************************************************************/ 00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00010 // Copyright (C) 2001-2011 DLR (http://www.dlr.de/) and contributors 00011 /****************************************************************************/ 00012 // 00013 // This program is free software; you can redistribute it and/or modify 00014 // it under the terms of the GNU General Public License as published by 00015 // the Free Software Foundation; either version 2 of the License, or 00016 // (at your option) any later version. 00017 // 00018 /****************************************************************************/ 00019 #ifndef GUIGlObjectStorage_h 00020 #define GUIGlObjectStorage_h 00021 00022 00023 // =========================================================================== 00024 // included modules 00025 // =========================================================================== 00026 #ifdef _MSC_VER 00027 #include <windows_config.h> 00028 #else 00029 #include <config.h> 00030 #endif 00031 00032 #include <map> 00033 #include <string> 00034 #include <set> 00035 #include <fx.h> 00036 #include "GUIGlObject.h" 00037 #include <utils/foxtools/MFXMutex.h> 00038 00039 00040 // =========================================================================== 00041 // class definitions 00042 // =========================================================================== 00057 class GUIGlObjectStorage { 00058 public: 00060 GUIGlObjectStorage() throw(); 00061 00062 00064 ~GUIGlObjectStorage() throw(); 00065 00066 00076 GUIGlID registerObject(GUIGlObject* object, const std::string& fullName) throw(); 00077 00078 00087 GUIGlObject* getObjectBlocking(GUIGlID id) throw(); 00088 00089 00098 GUIGlObject* getObjectBlocking(const std::string& fullName) throw(); 00099 00100 00110 bool remove(GUIGlID id) throw(); 00111 00112 00117 void clear() throw(); 00118 00119 00125 void unblockObject(GUIGlID id) throw(); 00126 00127 00131 void setNetObject(GUIGlObject* object) throw() { 00132 myNetObject = object; 00133 } 00134 00135 00139 GUIGlObject* getNetObject() const throw() { 00140 return myNetObject; 00141 } 00142 00143 00146 static GUIGlObjectStorage gIDStorage; 00147 00148 00151 std::set<GUIGlID> getAllIDs() const; 00152 00153 private: 00155 typedef std::map<GUIGlID, GUIGlObject*> ObjectMap; 00156 00158 ObjectMap myMap; 00159 00160 /* @brief The known objects by their fill name (used when loading selection 00161 * from file */ 00162 std::map<std::string, GUIGlObject*> myFullNameMap; 00163 00165 ObjectMap myBlocked; 00166 00168 ObjectMap my2Delete; 00169 00171 GUIGlID myAktID; 00172 00174 MFXMutex myLock; 00175 00177 GUIGlObject* myNetObject; 00178 00179 00180 private: 00182 GUIGlObjectStorage(const GUIGlObjectStorage& s); 00183 00185 GUIGlObjectStorage& operator=(const GUIGlObjectStorage& s); 00186 00187 00188 }; 00189 00190 00191 #endif 00192 00193 /****************************************************************************/ 00194