X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkFactory.h;h=70e60e3c17c3b84beaf7fab0fe76689b8ee3b0cf;hb=5141e057598cdcde059d180c8cee02e1011f205d;hp=a686fa4f9debc5e62513d9ecae06c2da7b839eaf;hpb=6575a389b71b1b85c79e4444885becb76ecf16e4;p=bbtk.git diff --git a/kernel/src/bbtkFactory.h b/kernel/src/bbtkFactory.h index a686fa4..70e60e3 100644 --- a/kernel/src/bbtkFactory.h +++ b/kernel/src/bbtkFactory.h @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbtkFactory.h,v $ Language: C++ - Date: $Date: 2008/10/17 08:18:13 $ - Version: $Revision: 1.16 $ + Date: $Date: 2010/09/12 14:52:25 $ + Version: $Revision: 1.18 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -57,21 +57,45 @@ namespace bbtk public: static Pointer New(); - + // @name Packages management + //@{ + /// Pushes back the names of the Package s which are in the Factory void GetPackagesList(std::vector&); + /// Loads a dynamic library which contains a Package void LoadPackage( const std::string& name ); + /// Unloads a Package which was loaded from a dynamic library 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, std::string& package, - bool full=true ) const; - void ShowGraphTypes(const std::string& name) const; + /// Inserts a Package in the Factory void InsertPackage( Package::Pointer ); + /// Removess a Package from the Factory void RemovePackage( Package::Pointer ); - + /// Returns the pointer on a Package provided by name Package::Pointer GetPackage(const std::string& name) const; - + /// The type of map of packages + typedef std::map< std::string, Package::Pointer > PackageMapType; + /// Returns the map of Packages + const PackageMapType& GetPackageMap() const { return mPackageMap; } + //@} + + // @name Methods which print help + //@{ + /// Prints the list of Package + void PrintHelpListPackages(bool details = true, + bool adaptors = false) const; + /// Prints help on a particular Package + void PrintHelpPackage(const std::string& name, + bool adaptors = false) const; + /// Prints help on a BlackBoxDescriptor + void PrintHelpDescriptor(const std::string& name, + std::string& package, + bool full=true ) const; + void ShowGraphTypes(const std::string& name) const; + // @} + + + /// @name Object creation methods + //@{ BlackBox::Pointer NewBlackBox(const std::string& type, const std::string& name) const; @@ -83,6 +107,15 @@ namespace bbtk const DataInfo& typeout, const std::string& name) const; + Connection::Pointer NewConnection(BlackBox::Pointer from, + const std::string& output, + BlackBox::Pointer to, + const std::string& input) const; + //@} + + /// @name Package inspection methods + /// Allow to test if an Adaptor is present in the packages WITHOUT instanciating it + //@{ bool FindAdaptor(const DataInfo& typein, const DataInfo& typeout, std::string& adaptor) const; @@ -95,17 +128,14 @@ namespace bbtk const DataInfo& typeout, std::string& widget, std::string& adaptor) const; - - Connection::Pointer NewConnection(BlackBox::Pointer from, - const std::string& output, - BlackBox::Pointer to, - const std::string& input) const; - + //@} + void WriteDotFilePackagesList(FILE *ff); + /// Releases all the packages of the Factory void Reset(); - void CheckPackages() const; + void Check() const; typedef enum { @@ -124,27 +154,21 @@ namespace bbtk /// Gets the executer who created the factory (if any) - const // const Executer::Pointer GetExecuter() const { return mExecuter.lock(); } + std::string GetPackageNameOfaBlackBox(std::string boxType); - private: - - bool DoLoadPackage(std::string libname, - std::string pkgname, - std::string path); - - public: - /// The type of map of packages - typedef std::map< std::string, Package::Pointer > PackageMapType; + private: - const PackageMapType& GetPackageMap() const { return mPackageMap; } - private: /// The map of packages PackageMapType mPackageMap; /// The executer which created the factory (if any) ExecuterWeakPointer mExecuter; + bool DoLoadPackage(std::string libname, + std::string pkgname, + std::string path); void CloseAllPackages(); void ClosePackage(PackageMapType::iterator& i);