00001
00002
00003
00005
00006
00011
00016
00021
00023
00024 #ifndef GLOBALVARIABLESMANAGER_H
00025 #define GLOBALVARIABLESMANAGER_H
00026
00027 #include <list>
00028
00029 #include "GlobalVariables.h"
00030
00031 namespace X3DTK {
00032
00034
00035 class GVManager
00036 {
00037 public:
00038 template <class G>
00039 static G *getInstanceOf()
00040 {
00041 for (std::list<GlobalVariables *>::iterator it = globalVariablesList_.begin(); it != globalVariablesList_.end(); ++it)
00042 {
00043 if (dynamic_cast<G *>(*it) != 0)
00044 return static_cast<G *>(*it);
00045 }
00046 G *g = new G();
00047 globalVariablesList_.push_back(g);
00048 return g;
00049 };
00050
00051 private:
00052 static std::list<GlobalVariables *> globalVariablesList_;
00053 };
00054
00055 }
00056
00057 #endif