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: 2010/09/12 14:52:25 $
00006   Version:   $Revision: 1.18 $
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     // @name Packages management
00062 
00063     void GetPackagesList(std::vector<std::string>&);
00065     void LoadPackage( const std::string& name );
00067     void UnLoadPackage( const std::string& name );
00069     void InsertPackage( Package::Pointer );
00071     void RemovePackage( Package::Pointer );
00073     Package::Pointer GetPackage(const std::string& name) const;
00075     typedef std::map< std::string, Package::Pointer > PackageMapType;
00077     const PackageMapType& GetPackageMap() const { return mPackageMap; }
00079 
00080     // @name Methods which print help
00082 
00083     void PrintHelpListPackages(bool details = true, 
00084                                bool adaptors = false) const;
00086     void PrintHelpPackage(const std::string& name, 
00087                           bool adaptors = false) const;
00089     void PrintHelpDescriptor(const std::string& name, 
00090                              std::string& package,
00091                              bool full=true ) const;
00092     
00093     void ShowGraphTypes(const std::string& name) const;
00094     // @}
00095 
00096 
00098 
00099     BlackBox::Pointer NewBlackBox(const std::string& type, 
00100                           const std::string& name) const;
00101     
00102     BlackBox::Pointer NewAdaptor(const DataInfo& typein,
00103                          const DataInfo& typeout,
00104                          const std::string& name) const;
00105 
00106     BlackBox::Pointer NewWidgetAdaptor(const DataInfo& typein,
00107                                const DataInfo& typeout,
00108                                const std::string& name) const;
00109 
00110     Connection::Pointer NewConnection(BlackBox::Pointer from,
00111                                       const std::string& output,
00112                                       BlackBox::Pointer to,
00113                                       const std::string& input) const;
00115 
00118 
00119     bool FindAdaptor(const DataInfo& typein,
00120                      const DataInfo& typeout,
00121                      std::string& adaptor) const;
00122 
00123     bool FindWidgetAdaptor(const DataInfo& typein,
00124                            const DataInfo& typeout,
00125                            std::string& adaptor) const;
00126     
00127     bool FindWidgetAdaptor2(const DataInfo& typein,
00128                             const DataInfo& typeout,
00129                             std::string& widget,
00130                             std::string& adaptor) const;
00132   
00133     void WriteDotFilePackagesList(FILE *ff);
00134 
00136     void Reset();
00137     
00138     void Check() const;
00139 
00140     typedef enum
00141       {
00142         Packages,
00143         Categories,
00144         Initials,
00145         Adaptors
00146       }
00147       IndexEntryType;
00148     void CreateHtmlIndex(IndexEntryType type, const std::string& filename);
00149 
00151     void SetExecuter(ExecuterPointer e) { mExecuter = e; }
00153     ExecuterPointer GetExecuter() { return mExecuter.lock(); }
00155     //    const Executer::Pointer GetExecuter() const { return mExecuter.lock(); }
00156 
00157           std::string GetPackageNameOfaBlackBox(std::string boxType);
00158 
00159 
00160   private:
00161 
00162 
00164     PackageMapType mPackageMap;
00165 
00167     ExecuterWeakPointer mExecuter;
00168 
00169     bool DoLoadPackage(std::string libname,
00170                        std::string pkgname,
00171                        std::string path);
00172     void CloseAllPackages();
00173     void ClosePackage(PackageMapType::iterator& i);
00174 
00175   };
00176   // class Factory
00177 
00178 
00179 
00180 }// namespace bbtk
00181 
00182 
00183 
00184 #endif
00185 

Generated on Thu May 31 14:12:03 2012 for BBTK by  doxygen 1.5.7.1