LoadableModuleFactory.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Copyright Brigham and Women's Hospital (BWH) All Rights Reserved.
00004 
00005   See Doc/copyright/copyright.txt
00006   or http://www.slicer.org/copyright/copyright.txt for details.
00007 
00008   Program:   Dynamic Module
00009   Module:    $HeadURL: http://svn.slicer.org/Slicer3/trunk/Libs/LoadableModule/LoadableModuleFactory.h $
00010   Date:      $Date: 2010-01-22 14:42:07 -0500 (Fri, 22 Jan 2010) $
00011   Version:   $Revision: 11741 $
00012 
00013 ==========================================================================*/
00014 #ifndef __LoadableModuleFactory_h
00015 #define __LoadableModuleFactory_h
00016 
00017 #include "LoadableModuleWin32Header.h"
00018 
00019 #include "LoadableModuleDescription.h"
00020 
00021 #include <vector>
00022 
00023 class LoadableModuleDescriptionMap;
00024 class LoadableModuleFileMap;
00025 class LoadableModuleCache;
00026 
00027 class LoadableModule_EXPORT LoadableModuleFactory
00028 {
00029 public:
00030   LoadableModuleFactory();
00031   virtual ~LoadableModuleFactory();
00032 
00036   void SetName( const std::string& name) { Name = name; }
00037 
00041   const std::string& GetName() const { return Name; }
00042   
00045   void SetSearchPaths(const std::string& paths) { SearchPaths = paths; }
00046 
00048   const std::string& GetSearchPaths() const { return SearchPaths; }
00049 
00052   virtual void Scan();
00053 
00055   std::vector<std::string> GetModuleNames() const;
00056 
00058   LoadableModuleDescription GetModuleDescription(const std::string&) const;
00059 
00061   typedef void (*CallbackFunctionType)(const char *);
00062     
00064   void SetWarningMessageCallback( CallbackFunctionType );
00065   CallbackFunctionType GetWarningMessageCallback();
00066 
00068   void SetErrorMessageCallback( CallbackFunctionType );
00069   CallbackFunctionType GetErrorMessageCallback();
00070 
00072   void SetInformationMessageCallback( CallbackFunctionType );
00073   CallbackFunctionType GetInformationMessageCallback();
00074 
00076   void SetModuleDiscoveryMessageCallback( CallbackFunctionType );
00077   CallbackFunctionType GetModuleDiscoveryMessageCallback();
00078   
00079   
00080 protected:
00081 
00086   virtual long ScanForSharedObjectModules();
00087 
00088   void WarningMessage( const char *);
00089   void ErrorMessage( const char *);
00090   void InformationMessage( const char *);
00091   void ModuleDiscoveryMessage( const char *);
00092   
00093   LoadableModuleCache *InternalCache;
00094   LoadableModuleDescriptionMap *InternalMap;
00095   LoadableModuleFileMap *InternalFileMap;
00096 
00097   bool CacheModified;
00098   
00099 private:
00100 
00101   std::string Name;
00102   std::string SearchPaths;
00103   std::string CachePath;
00104 
00105   CallbackFunctionType WarningMessageCallback;
00106   CallbackFunctionType ErrorMessageCallback;
00107   CallbackFunctionType InformationMessageCallback;
00108   CallbackFunctionType ModuleDiscoveryMessageCallback;
00109 };
00110 
00111 
00112 #endif

Generated on 6 Apr 2011 for Slicer3 by  doxygen 1.6.1