]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkFactory.h
Started the devel of a wx package browser
[bbtk.git] / kernel / src / bbtkFactory.h
index 7a5476819d1452d9b2138abadca16b0d866abe40..3150e6ea3fbdcb0d86376372cb6376ead1e78235 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkFactory.h,v $
   Language:  C++
-  Date:      $Date: 2008/01/22 15:02:00 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2008/03/28 13:42:17 $
+  Version:   $Revision: 1.11 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See doc/license.txt or
@@ -36,7 +36,7 @@
 namespace bbtk
 {
 
-
+  class Executer;
 
   class BBTK_EXPORT Factory
   {
@@ -45,14 +45,13 @@ namespace bbtk
 
     Factory();
     ~Factory();
-
-    void LoadPackage( const std::string& name, 
-                      bool use_configuration_file = true, 
-                     bool verbose = false );
+    
+    void LoadPackage( const std::string& name );
     void UnLoadPackage( const std::string& name );
     void PrintPackages(bool details = true, bool adaptors = false) const;
     void HelpPackage(const std::string& name, bool adaptors = false) const;
-    void HelpBlackBox(const std::string& name, bool full=true) const;
+    void HelpBlackBox(const std::string& name, std::string& package,
+                     bool full=true ) const;
     void ShowGraphTypes(const std::string& name) const;
     void InsertPackage( Package* );
     void RemovePackage( Package* );
@@ -71,26 +70,36 @@ namespace bbtk
                               const std::string& output,
                               BlackBox* to,
                               const std::string& input) const;
-    
+
     void WriteDotFilePackagesList(FILE *ff);
 
     void Reset();
     
-    // usefull in many places.
-    // -> should be factorized : bbtk::Util class?    
-    bool FileExists(std::string strFilename);
+    typedef enum
+      {
+       Packages,
+       Categories,
+       Initials,
+       Adaptors
+      }
+      IndexEntryType;
+    void CreateHtmlIndex(IndexEntryType type, const std::string& filename);
+
+    /// Sets the executer who created the factory (if any)
+    void SetExecuter(Executer *e) { mExecuter = e; }
+    /// Gets the executer who created the factory (if any)
+    Executer* GetExecuter() { return mExecuter; }
+    /// Gets the executer who created the factory (if any) - const
+    const Executer* GetExecuter() const { return mExecuter; }
+
+
   private:
-    /// the methods for LoadPackage
-    std::string ExtractPackageName(const std::string &name, 
-                                  std::string& path);
-    std::string ExpandLibName(const std::string &name, bool v);  
-    std::string MakeLibnameFromPath(std::string path, std::string pkgname);
+
     bool DoLoadPackage(std::string libname,
                       std::string pkgname,
-                      std::string path,
-                      bool v);
-    bool IsAtRoot(std::string cwd);     
-    private:
+                      std::string path);
+
+  public:
     /// The structure storing info on a package
     class PackageInfoType
     {
@@ -106,9 +115,16 @@ namespace bbtk
     };
     /// The type of map of packages
     typedef std::map< std::string, PackageInfoType > PackageMapType;
+
+    const PackageMapType& GetPackageMap() const { return mPackageMap; }
+
+  private:
     /// The map of packages
     PackageMapType mPackageMap;
 
+    /// The executer which created the factory (if any)
+    Executer* mExecuter;
+
     void CloseAllPackages();
     void ClosePackage(PackageMapType::iterator& i);
 
@@ -116,6 +132,8 @@ namespace bbtk
   // class Factory
 
 
+
+  /*
   /// SYSTEM METHOD : Global method returning the global factory object pointer
   inline Factory*& GlobalFactoryPointer() 
   {
@@ -142,10 +160,9 @@ namespace bbtk
     }
   }
 
-  inline void LoadPackage( const std::string& name, 
-                           bool use_configuration_file = true, bool verbose = false )
+  inline void LoadPackage( const std::string& name )
   {
-    GetGlobalFactory()->LoadPackage(name,use_configuration_file, verbose);
+    GetGlobalFactory()->LoadPackage(name);
   }
 
   inline void UnLoadPackage( const std::string& name )
@@ -165,7 +182,15 @@ namespace bbtk
   
   inline void HelpBlackBox(const std::string& name, bool full=true) 
   {
-    GetGlobalFactory()->HelpBlackBox(name,full);
+    std::string package; 
+    GetGlobalFactory()->HelpBlackBox(name, package, full);
+  }
+
+  inline void HelpBlackBox(const std::string& name, std::string& package,
+                          bool full=true
+                          )
+  {
+    GetGlobalFactory()->HelpBlackBox(name, package, full);
   }
 
 
@@ -214,7 +239,7 @@ namespace bbtk
   {
     GetGlobalFactory()->WriteDotFilePackagesList(ff);
   }
-
+  */
 }// namespace bbtk