00001
00002
00004
00005 #ifndef GLOBALVARIABLESMANAGER_H
00006 #define GLOBALVARIABLESMANAGER_H
00007
00008 #include <list>
00009
00010 #include "GlobalVariables.h"
00011
00012 namespace X3DTK {
00013
00015
00016 class GVManager
00017 {
00018 public:
00019 template <class G>
00020 static G *getInstanceOf()
00021 {
00022 for (std::list<GlobalVariables *>::iterator it = globalVariablesList_.begin(); it != globalVariablesList_.end(); ++it)
00023 {
00024 if (dynamic_cast<G *>(*it) != 0)
00025 return static_cast<G *>(*it);
00026 }
00027 G *g = new G();
00028 globalVariablesList_.push_back(g);
00029 return g;
00030 };
00031
00032 private:
00033 static std::list<GlobalVariables *> globalVariablesList_;
00034 };
00035
00036 }
00037
00038 #endif