Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

GVManager.h

Go to the documentation of this file.
00001 
00002 //                            GVManager.h                                     //
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

Generated on Thu Oct 9 13:50:53 2003 for X3DToolKit by doxygen1.2.18