X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkPackage.h;h=4c0b70534cf890d37f22f4f0a43c7b73bcfc3372;hb=c2a4b1893412e50a3d9abff221938a2d16c4a7cb;hp=069d13598275e865d8eea0380c798a7f03508914;hpb=a26195c366a89795288009cf7e20f11afa494970;p=bbtk.git diff --git a/kernel/src/bbtkPackage.h b/kernel/src/bbtkPackage.h index 069d135..4c0b705 100644 --- a/kernel/src/bbtkPackage.h +++ b/kernel/src/bbtkPackage.h @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkPackage.h,v $ Language: C++ - Date: $Date: 2008/01/22 15:02:00 $ - Version: $Revision: 1.1 $ + Date: $Date: 2008/04/09 11:16:57 $ + Version: $Revision: 1.7 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See doc/license.txt or @@ -43,24 +43,41 @@ namespace bbtk ~Package(); /// Returns the name of the package const std::string& GetName() const { return mName; } + /// Returns the author of the package const std::string& GetAuthor() const { return mAuthor; } + + /// Returns the category of the package + const std::string& GetCategory() const { return mCategory; } + /// Returns the description of the package const std::string& GetDescription() const { return mDescription; } + /// Returns the version of the package const std::string& GetVersion() const { return mVersion; } + /// Returns the version of bbtk used to build the package const std::string& GetBBTKVersion() const { return mBBTKVersion; } - + bool ContainsBlackBox(const std::string& boxname) const; - - BlackBox* NewBlackBox(const std::string& type, + + BlackBox* NewBlackBox(const std::string& type, const std::string& name) const; - BlackBox* NewAdaptor(TypeInfo typein, - TypeInfo typeout, - const std::string& name) const; + BlackBox* NewAdaptor(const DataInfo& typein, + const DataInfo& typeout, + const std::string& name) const; + + BlackBox* NewWidgetAdaptor(const DataInfo& typein, + const DataInfo& typeout, + const std::string& name) const; + bool FindAdaptor(const DataInfo& typein, + const DataInfo& typeout, + std::string& adaptor) const; + bool FindWidgetAdaptor(const DataInfo& typein, + const DataInfo& typeout, + std::string& adaptor) const; bool RegisterBlackBox(BlackBoxDescriptor*); void UnRegisterBlackBox(const std::string& name); @@ -93,12 +110,67 @@ namespace bbtk /// Changes the name of a black box type void ChangeBlackBoxName( const std::string& oldname, const std::string& newname ); + /// The type of map of descriptors + typedef std::map< std::string, BlackBoxDescriptor*> BlackBoxMapType; + const BlackBoxMapType& GetBlackBoxMap() const { return mBlackBoxMap; } + BlackBoxMapType& GetBlackBoxMap() { return mBlackBoxMap; } + + /// The type of key in the map of adaptor descriptors + class AdaptorKey + { + public: + AdaptorKey( const DataInfo& typein, const DataInfo& typeout, + BlackBoxDescriptor::Kind kind ) + : mTypeIn(typein), mTypeOut(typeout), mKind(kind) {} + + bool operator< ( const AdaptorKey& k ) const + { + return ( ( mKind < k.mKind ) || + ( ( mKind == k.mKind ) && + ( ( mTypeIn < k.mTypeIn ) || + ( ( mTypeIn == k.mTypeIn ) && + ( mTypeOut < k.mTypeOut ) ) ) ) ); + } + + bool operator== ( const AdaptorKey& k ) const + { + return ( ( mKind == k.mKind ) && + ( mTypeIn == k.mTypeIn ) && + ( mTypeOut == k.mTypeOut ) ); + } + DataInfo mTypeIn; + DataInfo mTypeOut; + BlackBoxDescriptor::Kind mKind; + }; + + /// The type of map of adaptor descriptors + typedef std::map< AdaptorKey, BlackBoxDescriptor*> AdaptorMapType; + + + const AdaptorMapType& GetAdaptorMap() const { return mAdaptorMap; } + + + // Factories management + /// Adds the factory to the set of factories which use the package + void AddFactory(Factory* f) { mFactorySet.insert(f); } + /// Removes the factory from the set of factories which use the package + void RemoveFactory(Factory* f) { mFactorySet.erase(f); } + + /// Gets the set of factories which use the package + std::set& GetFactorySet() { return mFactorySet; } + /// Gets the set of factories which use the package (const) + const std::set& GetFactorySet() const { return mFactorySet; } + + void CheckBoxes() const; private: + /// The name of the package std::string mName; /// The author of the package std::string mAuthor; + /// The categories of the package + std::string mCategory; /// The description of the package std::string mDescription; /// The version of the package @@ -111,43 +183,21 @@ namespace bbtk /// (path relative to bbtk doc root) std::string mDocRelativeURL; - - /// The type of map of descriptors - typedef std::map< std::string, BlackBoxDescriptor*> BlackBoxMapType; /// The map of black boxes descriptors BlackBoxMapType mBlackBoxMap; - /// The type of key in the map of adaptor descriptors - class AdaptorKey - { - public: - AdaptorKey( TypeInfo typein, TypeInfo typeout) - : mTypeIn(typein.name()), mTypeOut(typeout.name()) {} - - bool operator< ( const AdaptorKey& k ) const - { - // return ( ( mTypeIn.before(k.mTypeIn) ) || - // ( ( mTypeIn == k.mTypeIn ) && - // ( mTypeOut.before(k.mTypeOut) ) ) ); - return ( ( mTypeIn < k.mTypeIn ) || - ( ( mTypeIn == k.mTypeIn ) && - ( mTypeOut < k.mTypeOut ) ) ); - } - - private: - // TypeInfo mTypeIn; - // TypeInfo mTypeOut; - std::string mTypeIn; - std::string mTypeOut; - }; - - //typedef std::string AdaptorKey; - /// The type of map of adaptor descriptors - typedef std::map< AdaptorKey, BlackBoxDescriptor*> AdaptorMapType; + public: + + private: /// The map of adaptors descriptors AdaptorMapType mAdaptorMap; + + + /// The set of factories which contain the package + std::set mFactorySet; + }; // EO class Package //====================================================================