SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00009 // A storage for displayed objects via their numerical id 00010 /****************************************************************************/ 00011 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00012 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00013 /****************************************************************************/ 00014 // 00015 // This file is part of SUMO. 00016 // SUMO is free software: you can redistribute it and/or modify 00017 // it under the terms of the GNU General Public License as published by 00018 // the Free Software Foundation, either version 3 of the License, or 00019 // (at your option) any later version. 00020 // 00021 /****************************************************************************/ 00022 #ifndef GUIGlObjectStorage_h 00023 #define GUIGlObjectStorage_h 00024 00025 00026 // =========================================================================== 00027 // included modules 00028 // =========================================================================== 00029 #ifdef _MSC_VER 00030 #include <windows_config.h> 00031 #else 00032 #include <config.h> 00033 #endif 00034 00035 #include <map> 00036 #include <string> 00037 #include <set> 00038 #include <fx.h> 00039 #include "GUIGlObject.h" 00040 #include <utils/foxtools/MFXMutex.h> 00041 00042 00043 // =========================================================================== 00044 // class definitions 00045 // =========================================================================== 00060 class GUIGlObjectStorage { 00061 public: 00063 GUIGlObjectStorage() ; 00064 00065 00067 ~GUIGlObjectStorage() ; 00068 00069 00079 GUIGlID registerObject(GUIGlObject* object, const std::string& fullName) ; 00080 00081 00090 GUIGlObject* getObjectBlocking(GUIGlID id) ; 00091 00092 00101 GUIGlObject* getObjectBlocking(const std::string& fullName) ; 00102 00103 00113 bool remove(GUIGlID id) ; 00114 00115 00120 void clear() ; 00121 00122 00128 void unblockObject(GUIGlID id) ; 00129 00130 00134 void setNetObject(GUIGlObject* object) { 00135 myNetObject = object; 00136 } 00137 00138 00142 GUIGlObject* getNetObject() const { 00143 return myNetObject; 00144 } 00145 00146 00149 static GUIGlObjectStorage gIDStorage; 00150 00151 00154 std::set<GUIGlID> getAllIDs() const; 00155 00156 private: 00158 typedef std::map<GUIGlID, GUIGlObject*> ObjectMap; 00159 00161 ObjectMap myMap; 00162 00163 /* @brief The known objects by their fill name (used when loading selection 00164 * from file */ 00165 std::map<std::string, GUIGlObject*> myFullNameMap; 00166 00168 ObjectMap myBlocked; 00169 00171 ObjectMap my2Delete; 00172 00174 GUIGlID myAktID; 00175 00177 MFXMutex myLock; 00178 00180 GUIGlObject* myNetObject; 00181 00182 00183 private: 00185 GUIGlObjectStorage(const GUIGlObjectStorage& s); 00186 00188 GUIGlObjectStorage& operator=(const GUIGlObjectStorage& s); 00189 00190 00191 }; 00192 00193 00194 #endif 00195 00196 /****************************************************************************/ 00197