bbtkFactory.h

Go to the documentation of this file.
00001 /*=========================================================================                                                                               
00002   Program:   bbtk
00003   Module:    $RCSfile: bbtkFactory.h,v $
00004   Language:  C++
00005   Date:      $Date: 2008/10/17 08:18:13 $
00006   Version:   $Revision: 1.16 $
00007 =========================================================================*/
00008 
00009 /* ---------------------------------------------------------------------
00010 
00011 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
00012 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
00013 *
00014 *  This software is governed by the CeCILL-B license under French law and 
00015 *  abiding by the rules of distribution of free software. You can  use, 
00016 *  modify and/ or redistribute the software under the terms of the CeCILL-B 
00017 *  license as circulated by CEA, CNRS and INRIA at the following URL 
00018 *  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
00019 *  or in the file LICENSE.txt.
00020 *
00021 *  As a counterpart to the access to the source code and  rights to copy,
00022 *  modify and redistribute granted by the license, users are provided only
00023 *  with a limited warranty  and the software's author,  the holder of the
00024 *  economic rights,  and the successive licensors  have only  limited
00025 *  liability. 
00026 *
00027 *  The fact that you are presently reading this means that you have had
00028 *  knowledge of the CeCILL-B license and that you accept its terms.
00029 * ------------------------------------------------------------------------ */                                                                         
00030 
00042 #ifndef __bbtkFactory_h__
00043 #define __bbtkFactory_h__
00044 
00045 #include "bbtkPackage.h"
00046 
00047 namespace bbtk
00048 {
00049 
00050   class Executer;
00051   BBTK_FORWARD_DECLARE_POINTER(Executer);
00052 
00053   class BBTK_EXPORT Factory : public Object
00054   {
00055     BBTK_OBJECT_INTERFACE(Factory);
00056     typedef Object Superclass;
00057   public:
00058     static Pointer New();
00059 
00060     
00061     void GetPackagesList(std::vector<std::string>&);
00062     void LoadPackage( const std::string& name );
00063     void UnLoadPackage( const std::string& name );
00064     void PrintPackages(bool details = true, bool adaptors = false) const;
00065     void HelpPackage(const std::string& name, bool adaptors = false) const;
00066     void HelpBlackBox(const std::string& name, std::string& package,
00067                       bool full=true ) const;
00068     void ShowGraphTypes(const std::string& name) const;
00069     void InsertPackage( Package::Pointer );
00070     void RemovePackage( Package::Pointer );
00071 
00072     Package::Pointer GetPackage(const std::string& name) const;
00073 
00074     
00075     BlackBox::Pointer NewBlackBox(const std::string& type, 
00076                           const std::string& name) const;
00077     
00078     BlackBox::Pointer NewAdaptor(const DataInfo& typein,
00079                          const DataInfo& typeout,
00080                          const std::string& name) const;
00081 
00082     BlackBox::Pointer NewWidgetAdaptor(const DataInfo& typein,
00083                                const DataInfo& typeout,
00084                                const std::string& name) const;
00085 
00086     bool FindAdaptor(const DataInfo& typein,
00087                      const DataInfo& typeout,
00088                      std::string& adaptor) const;
00089 
00090     bool FindWidgetAdaptor(const DataInfo& typein,
00091                            const DataInfo& typeout,
00092                            std::string& adaptor) const;
00093     
00094     bool FindWidgetAdaptor2(const DataInfo& typein,
00095                             const DataInfo& typeout,
00096                             std::string& widget,
00097                             std::string& adaptor) const;
00098 
00099     Connection::Pointer NewConnection(BlackBox::Pointer from,
00100                                       const std::string& output,
00101                                       BlackBox::Pointer to,
00102                                       const std::string& input) const;
00103 
00104     void WriteDotFilePackagesList(FILE *ff);
00105 
00106     void Reset();
00107     
00108     void CheckPackages() const;
00109 
00110     typedef enum
00111       {
00112         Packages,
00113         Categories,
00114         Initials,
00115         Adaptors
00116       }
00117       IndexEntryType;
00118     void CreateHtmlIndex(IndexEntryType type, const std::string& filename);
00119 
00121     void SetExecuter(ExecuterPointer e) { mExecuter = e; }
00123     ExecuterPointer GetExecuter() { return mExecuter.lock(); }
00125     //    const Executer::Pointer GetExecuter() const { return mExecuter.lock(); }
00126 
00127 
00128   private:
00129 
00130     bool DoLoadPackage(std::string libname,
00131                        std::string pkgname,
00132                        std::string path);
00133 
00134   public:
00135 
00137     typedef std::map< std::string, Package::Pointer > PackageMapType;
00138 
00139     const PackageMapType& GetPackageMap() const { return mPackageMap; }
00140 
00141   private:
00143     PackageMapType mPackageMap;
00144 
00146     ExecuterWeakPointer mExecuter;
00147 
00148     void CloseAllPackages();
00149     void ClosePackage(PackageMapType::iterator& i);
00150 
00151   };
00152   // class Factory
00153 
00154 
00155 
00156 }// namespace bbtk
00157 
00158 
00159 
00160 #endif
00161 

Generated on Wed Nov 12 11:37:08 2008 for BBTK by  doxygen 1.5.6