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 
00003 
00005 
00006 
00011 
00016 
00021 //                            GVManager.h                                     //
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

Generated on Wed Sep 10 11:25:13 2003 for X3DToolKit by doxygen1.3