CMS 3D CMS Logo

IgModule.h

Go to the documentation of this file.
00001 #ifndef IGUANA_FRAMEWORK_IG_PLUGIN_H
00002 # define IGUANA_FRAMEWORK_IG_PLUGIN_H
00003 
00004 //<<<<<< INCLUDES                                                       >>>>>>
00005 
00006 # include "Iguana/Framework/interface/config.h"
00007 # include "Iguana/Framework/interface/IgPluginInfo.h"
00008 # include "Iguana/Framework/interface/IgModuleDescriptor.h"
00009 # include "classlib/iobase/Filename.h"
00010 # include "classlib/utils/SharedLibrary.h"
00011 # include <string>
00012 # include <list>
00013 
00014 //<<<<<< PUBLIC DEFINES                                                 >>>>>>
00015 //<<<<<< PUBLIC CONSTANTS                                               >>>>>>
00016 //<<<<<< PUBLIC TYPES                                                   >>>>>>
00017 
00018 class IgModule;
00019 class IgModuleDef;
00020 class IgModuleCache;
00021 class IgModuleDescriptor;
00022 class IgPluginManager;
00023 
00025 extern "C" { typedef IgModuleDef *(*IgModuleEntry) (void); }
00026 
00028 extern "C" { typedef void (*IgModuleCapEntry) (const char **&names, int &n); }
00029 
00030 //<<<<<< PUBLIC VARIABLES                                               >>>>>>
00031 //<<<<<< PUBLIC FUNCTIONS                                               >>>>>>
00032 //<<<<<< CLASS DECLARATIONS                                             >>>>>>
00033 
00069 class IgModule
00070 {
00071     typedef std::list<IgPluginInfo *>   InfoList;
00072 public:
00073     typedef InfoList::const_iterator    InfoIterator;
00074 
00075     IgModule (IgPluginManager *manager,
00076               const lat::Filename &libraryName,
00077               const std::string &time,
00078               const std::string &flag);
00079     virtual ~IgModule (void);
00080 
00081     // module management interface
00082     IgPluginManager *   manager (void) const;
00083     const lat::Filename &libraryName (void) const;
00084     unsigned            time (void) const;
00085     bool                bad (void) const;
00086     void                bad (bool value);
00087 
00088     virtual void        load (void);
00089     virtual void        unload (void);
00090     virtual void        attach (void);
00091     virtual void        detach (void);
00092     virtual void        query (void);
00093 
00094     virtual bool        attached (void);
00095 
00096     // program built-in module (= program itself)
00097     static IgModule *   builtin (void);
00098 
00099     // info access
00100     InfoIterator        beginInfos (void) const;
00101     InfoIterator        endInfos (void) const;
00102     void                addInfo (IgPluginInfo *info, bool cache);
00103     void                detachInfo (IgPluginInfo *info);
00104     IgModuleDescriptor *cacheRoot (void) const;
00105 
00106 protected:
00107     friend class IgModuleCache;
00108     void                makeCache (void);
00109     void                clearCache (void);
00110     virtual void        restore (IgModuleDescriptor *info);
00111     virtual void        cache (IgModuleDescriptor *to) const;
00112 
00113     virtual bool        checkEntryPoints (void) const;
00114     IgModuleEntry       moduleEntryPoint (void);
00115     IgModuleCapEntry    capabilityEntryPoint (void);
00116 
00117     lat::SharedLibrary *library (void) const;
00118     bool                loaded (void) const;
00119 
00120     static const char * tag (void);
00121 
00122 private:
00123     IgPluginManager     *m_manager;
00124     lat::Filename       m_libraryName;
00125     mutable lat::SharedLibrary *m_library;
00126     IgModuleDescriptor  *m_cache;
00127 
00128     unsigned            m_time;         //< Registration file time stamp
00129     bool                m_bad;          //< Flag to mark if the file was bad
00130     bool                m_attached;     //< Set when library has been attached.
00131     IgModuleDef         *m_definition;  //< My definition proxy.
00132     InfoList            m_infos;        //< Info items for this module.
00133     static const char   s_modEntryPoint [];//< Name of the normal library entry point.
00134     static const char   s_capEntryPoint [];//< Name of the capability library entry point.
00135     static const char   s_tag [];
00136 
00137     // undefined semantics
00138     IgModule (const IgModule &);
00139     IgModule &operator= (const IgModule &);
00140 };
00141 
00142 //<<<<<< INLINE PUBLIC FUNCTIONS                                        >>>>>>
00143 //<<<<<< INLINE MEMBER FUNCTIONS                                        >>>>>>
00144 
00145 inline const char *
00146 IgModule::tag (void)
00147 { return s_tag; }
00148 
00150 inline unsigned
00151 IgModule::time (void) const
00152 { return m_time; }
00153 
00154 #endif // IGUANA_FRAMEWORK_IG_PLUGIN_H

Generated on Tue Jun 9 17:38:18 2009 for CMSSW by  doxygen 1.5.4