00001 /****************************************************************************/ 00007 // A storage for of displayed objects via their numerical id 00008 /****************************************************************************/ 00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00010 // Copyright 2001-2010 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 <fx.h> 00034 #include <utils/foxtools/MFXMutex.h> 00035 00036 #ifdef _WIN32 00037 #include <windows.h> 00038 #endif 00039 00040 #include <GL/gl.h> 00041 00042 00043 // =========================================================================== 00044 // class declarations 00045 // =========================================================================== 00046 class GUIGlObject; 00047 00048 00049 // =========================================================================== 00050 // class definitions 00051 // =========================================================================== 00066 class GUIGlObjectStorage { 00067 public: 00069 GUIGlObjectStorage() throw(); 00070 00071 00073 ~GUIGlObjectStorage() throw(); 00074 00075 00083 void registerObject(GUIGlObject *object) throw(); 00084 00085 00089 GLuint getUniqueID() throw(); 00090 00091 00100 GUIGlObject *getObjectBlocking(GLuint id) throw(); 00101 00102 00112 bool remove(GLuint id) throw(); 00113 00114 00119 void clear() throw(); 00120 00121 00127 void unblockObject(GLuint id) throw(); 00128 00129 00133 void setNetObject(GUIGlObject *object) throw() { 00134 myNetObject = object; 00135 } 00136 00137 00141 GUIGlObject * const getNetObject() const throw() { 00142 return myNetObject; 00143 } 00144 00145 00148 static GUIGlObjectStorage gIDStorage; 00149 00150 private: 00152 typedef std::map<size_t, GUIGlObject *> ObjectMap; 00153 00155 ObjectMap myMap; 00156 00158 ObjectMap myBlocked; 00159 00161 ObjectMap my2Delete; 00162 00164 GLuint myAktID; 00165 00167 MFXMutex myLock; 00168 00170 GUIGlObject *myNetObject; 00171 00172 00173 private: 00175 GUIGlObjectStorage(const GUIGlObjectStorage &s); 00176 00178 GUIGlObjectStorage &operator=(const GUIGlObjectStorage &s); 00179 00180 00181 }; 00182 00183 00184 #endif 00185 00186 /****************************************************************************/ 00187
1.5.6