LAMA
/home/brandes/workspace/LAMA/src/lama/ContextFactory.hpp
Go to the documentation of this file.
00001 
00033 #ifndef LAMA_CONTEXT_FACTORY_HPP_
00034 #define LAMA_CONTEXT_FACTORY_HPP_
00035 
00036 // for dll_import
00037 #include <lama/config.hpp>
00038 
00039 // base classes
00040 #include <lama/NonCopyable.hpp>
00041 
00042 // others
00043 #include <lama/Context.hpp>
00044 
00045 // logging
00046 #include <logging/logging.hpp>
00047 
00048 // boost
00049 #include <boost/shared_ptr.hpp>
00050 
00051 namespace lama
00052 {
00053 
00054 class ContextManager;
00055 
00061 #define LAMA_DEFAULT_DEVICE_NUMBER -1
00062 
00078 class LAMA_DLL_IMPORTEXPORT ContextFactory : NonCopyable
00079 {
00080 public:
00081  
00095     static ContextPtr getContext( const Context::ContextType type , int deviceNr = LAMA_DEFAULT_DEVICE_NUMBER );
00096 
00110     ContextManager* getContextManager( const Context::ContextType type );
00111 
00117     static bool hasContext( const Context::ContextType type );
00118 
00126     void addContextManager( const Context::ContextType type, ContextManager& contextManager );
00127 
00130     static ContextFactory& getFactory();
00131 
00134     static void release();
00135 
00136 private:
00137 
00138     ContextFactory();
00139 
00140     virtual ~ContextFactory();
00141 
00144     ContextManager* mContextManager[Context::MaxContext];
00145 
00146     static const char* theContextIds[Context::MaxContext];
00147     
00148     static ContextFactory* theContextFactory;
00149 
00150     LAMA_LOG_DECL_STATIC_LOGGER(logger);
00151 };
00152 
00153 }
00154 
00155 #endif // LAMA_CONTEXT_FACTORY_HPP_