Fawkes API  Fawkes Development Version
module_manager.h
00001 
00002 /***************************************************************************
00003  *  module_manager.h - manager for modules (i.e. shared objects)
00004  *
00005  *  Created: Wed Aug 23 16:15:02 2006
00006  *  Copyright  2006-2011  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version. A runtime exception applies to
00014  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00022  */
00023 
00024 #ifndef __UTILS_SYSTEM_DYNAMIC_MODULE_MODULE_MANAGER_H_
00025 #define __UTILS_SYSTEM_DYNAMIC_MODULE_MODULE_MANAGER_H_
00026 
00027 #include <map>
00028 #include <string>
00029 
00030 #include <utils/system/dynamic_module/module.h>
00031 
00032 namespace fawkes {
00033 #if 0 /* just to make Emacs auto-indent happy */
00034 }
00035 #endif
00036 
00037 class Module;
00038 class Mutex;
00039 
00040 class ModuleManager {
00041  public:
00042 
00043   ModuleManager(const char *module_base_dir,
00044                 Module::ModuleFlags open_flags = Module::MODULE_FLAGS_DEFAULT);
00045   virtual ~ModuleManager();
00046 
00047   virtual Module *  open_module(const char *filename);
00048   virtual void      close_module(Module *module);
00049   virtual void      close_module(const char *filename);
00050   virtual bool      module_opened(const char *filename);
00051   virtual Module *  get_module(const char *filename);
00052 
00053   virtual const char * get_module_file_extension();
00054 
00055   void set_open_flags(Module::ModuleFlags open_flags);
00056 
00057  private:
00058   std::map<std::string, Module * > __modules;
00059 
00060   const char *__module_base_dir;
00061   Mutex *__mutex;
00062   Module::ModuleFlags __open_flags;
00063 
00064 };
00065 
00066 } // end namespace fawkes
00067 
00068 #endif