From 2d76cd309d74d5f83d701d6bb0a4140d5d122b36 Mon Sep 17 00:00:00 2001 From: jean-pierre roux Date: Wed, 30 Jan 2008 09:28:15 +0000 Subject: [PATCH] First stage of 'Keyword' --- kernel/src/bbtkBlackBoxDescriptor.cxx | 45 ++++++++++++++++++--------- kernel/src/bbtkBlackBoxDescriptor.h | 29 ++++++++++++++--- kernel/src/bbtkExecuter.cxx | 10 +++--- kernel/src/bbtkExecuter.h | 9 ++++-- kernel/src/bbtkFactory.cxx | 12 +++---- kernel/src/bbtkInterpreter.cxx | 24 +++++++++----- kernel/src/bbtkInterpreter.h | 7 +++-- kernel/src/bbtkPackage.h | 19 ++++++++--- kernel/src/bbtkUserBlackBoxMacros.h | 9 ++++-- kernel/src/bbtkVirtualExec.h | 11 ++++--- 10 files changed, 120 insertions(+), 55 deletions(-) diff --git a/kernel/src/bbtkBlackBoxDescriptor.cxx b/kernel/src/bbtkBlackBoxDescriptor.cxx index 1fe23c8..050231e 100644 --- a/kernel/src/bbtkBlackBoxDescriptor.cxx +++ b/kernel/src/bbtkBlackBoxDescriptor.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkBlackBoxDescriptor.cxx,v $ Language: C++ - Date: $Date: 2008/01/22 15:02:00 $ - Version: $Revision: 1.1 $ + Date: $Date: 2008/01/30 09:28:15 $ + Version: $Revision: 1.2 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -34,6 +34,7 @@ namespace bbtk : mTypeName("Unknown"), mDescription(""), mAuthor(""), + mKeyword(""), mCategory(STANDARD), mPackage(NULL) { @@ -61,7 +62,7 @@ namespace bbtk //========================================================================= //========================================================================= - /// Adds the string to the BlackBox's description + /// Adds the string to the BlackBox description void BlackBoxDescriptor::AddToDescription( const std::string& s, bool clear) { bbtkDebugMessage("Core",9,"BlackBoxDescriptor::AddToDescription(\""<second; } @@ -107,9 +122,9 @@ namespace bbtk OutputDescriptorMapType::const_iterator i; i = mOutput.find(name); if ( i == mOutput.end() ) - { - bbtkError("output '"<second; } @@ -121,11 +136,11 @@ namespace bbtk bbtkDebugMessageInc("Core",9,"BlackBoxDescriptor::GetHelp() ["<GetName()<<"::"<"<GetName()<<"::"<"<"< const InputDescriptor* GetInputDescriptor(const std::string & name) const; + /// Returns a const pointer on the descriptor of the output of name const OutputDescriptor* GetOutputDescriptor(const std::string & name) const; /// Sets the name of the **TYPE** of BlackBox void SetTypeName( const std::string& name ) { mTypeName=name; } - /// Adds the string to the BlackBox's description + + /// Adds the string to the BlackBox description void AddToDescription( const std::string&, bool clear = false ); - /// Adds the string to the BlackBox's author list + + /// Adds the string to the BlackBox author list void AddToAuthor( const std::string&, bool clear = false ); + + /// Adds the string to the BlackBox keyword list + void AddToKeyword( const std::string&, bool clear = false ); + /// Sets the Package to which the box belongs void SetPackage(Package *package) { mPackage = package; } + /// Sets the category of box void SetCategory(Category category) { mCategory = category; } @@ -136,6 +153,8 @@ namespace bbtk std::string mDescription; /// The author of the black box std::string mAuthor; + /// The keyword of the black box + std::string mKeyword; /// The category of box Category mCategory; /// The Package to which the box belongs diff --git a/kernel/src/bbtkExecuter.cxx b/kernel/src/bbtkExecuter.cxx index 8730b02..bd71511 100644 --- a/kernel/src/bbtkExecuter.cxx +++ b/kernel/src/bbtkExecuter.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkExecuter.cxx,v $ $ Language: C++ - Date: $Date: 2008/01/28 15:34:37 $ - Version: $Revision: 1.3 $ + Date: $Date: 2008/01/30 09:28:15 $ + Version: $Revision: 1.4 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -341,7 +341,6 @@ namespace bbtk } } - /** * */ @@ -393,7 +392,10 @@ namespace bbtk Current()->AddToAuthor(authorName,Current()==mRoot); } - + void Executer::Keyword(const std::string &keyword) + { + Current()->AddToKeyword(keyword,Current()==mRoot); + } void Executer::Description(const std::string &d) { diff --git a/kernel/src/bbtkExecuter.h b/kernel/src/bbtkExecuter.h index 8604aff..47935ae 100644 --- a/kernel/src/bbtkExecuter.h +++ b/kernel/src/bbtkExecuter.h @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkExecuter.h,v $ $ Language: C++ - Date: $Date: 2008/01/28 15:08:53 $ - Version: $Revision: 1.3 $ + Date: $Date: 2008/01/30 09:28:15 $ + Version: $Revision: 1.4 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -119,9 +119,12 @@ namespace bbtk /// changes the workspace name void SetWorkspaceName( const std::string& n ); - ///Adds the authorName to the Box's author list + ///Adds the authorName to the Box author list void Author(const std::string &authorName); + ///Adds the categories to the Box keyword list + void Keyword(const std::string &keyword); + /// The description string which explains what does the ComplexBox void Description(const std::string & d); diff --git a/kernel/src/bbtkFactory.cxx b/kernel/src/bbtkFactory.cxx index 5c06007..849ebab 100644 --- a/kernel/src/bbtkFactory.cxx +++ b/kernel/src/bbtkFactory.cxx @@ -4,8 +4,8 @@ Program: bbtk Module: $RCSfile: bbtkFactory.cxx,v $ Language: C++ -Date: $Date: 2008/01/29 14:01:31 $ -Version: $Revision: 1.6 $ +Date: $Date: 2008/01/30 09:28:15 $ +Version: $Revision: 1.7 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de @@ -319,12 +319,10 @@ namespace bbtk bbtkError("Use absolute or relative path name! ["<Author(words[1]); break; - + + case cKeyword : + mExecuter->Keyword(words[1]); + break; + case cDescription : mExecuter->Description(words[1]); break; @@ -796,7 +808,7 @@ void Interpreter::SplitLine ( const std::string& str, std::vector& int nbFiles = Utilities::Explore(fullDirectoryName, false, Filenames); // std::cout << "=================nbFiles " << nbFiles << std::endl; int nbBssFiles = 0; - for (std::vector::iterator i = Filenames.begin(); i!=Filenames.end(); ++i) + for (std::vector::iterator i = Filenames.begin(); i!= Filenames.end(); ++i) { if ((*i).substr((*i).size()-4, 4) != ".bbs") continue; // ignore non .bbs files @@ -818,8 +830,7 @@ void Interpreter::SplitLine ( const std::string& str, std::vector& // (not only a plain script name) // we trust him, and try to expland the directory name // WARNING : starting from current local directory : ./whatYouWant (./ mandatory!) - - // if (slash_position != std::string::npos) + if (name[0]=='/' || name[1] == ':' || name[0]=='.') // absolute path (linux/windows) or relative path { @@ -849,7 +860,6 @@ void Interpreter::SplitLine ( const std::string& str, std::vector& { foundFile = true; } - } // endif l != 0 } else diff --git a/kernel/src/bbtkInterpreter.h b/kernel/src/bbtkInterpreter.h index 732e8f7..24dbd89 100644 --- a/kernel/src/bbtkInterpreter.h +++ b/kernel/src/bbtkInterpreter.h @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkInterpreter.h,v $ $ Language: C++ - Date: $Date: 2008/01/29 10:12:45 $ - Version: $Revision: 1.5 $ + Date: $Date: 2008/01/30 09:28:15 $ + Version: $Revision: 1.6 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -57,7 +57,8 @@ namespace bbtk cSet, cConfig, // JPR cReset, // EED - cAuthor, + cAuthor, + cKeyword, // JPR cDescription, cHelp, cMessage, diff --git a/kernel/src/bbtkPackage.h b/kernel/src/bbtkPackage.h index 069d135..3b4d8dc 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/01/30 09:28:15 $ + Version: $Revision: 1.2 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See doc/license.txt or @@ -43,19 +43,26 @@ 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 keyword of the package + const std::string& GetKeyword() const { return mKeyword; } + /// 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, @@ -99,6 +106,8 @@ namespace bbtk std::string mName; /// The author of the package std::string mAuthor; + /// The keywords of the package + std::string mKeyword; /// The description of the package std::string mDescription; /// The version of the package diff --git a/kernel/src/bbtkUserBlackBoxMacros.h b/kernel/src/bbtkUserBlackBoxMacros.h index f7d145c..2ff7aed 100644 --- a/kernel/src/bbtkUserBlackBoxMacros.h +++ b/kernel/src/bbtkUserBlackBoxMacros.h @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkUserBlackBoxMacros.h,v $ Language: C++ - Date: $Date: 2008/01/22 15:41:34 $ - Version: $Revision: 1.2 $ + Date: $Date: 2008/01/30 09:28:16 $ + Version: $Revision: 1.3 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -242,6 +242,11 @@ #define BBTK_AUTHOR(AUTHOR) AddToAuthor(AUTHOR) //============================================================================ +//============================================================================ +/// Declares the keywords of a UserBlackBox (to be put inside the UBB description block) +#define BBTK_KEYWORD(KEYWORD) AddToKeyword(KEYWORD) +//============================================================================ + //============================================================================ /// Declares the description of a UserBlackBox (to be put inside the UBB description block) #define BBTK_DESCRIPTION(DESCR) AddToDescription(DESCR) diff --git a/kernel/src/bbtkVirtualExec.h b/kernel/src/bbtkVirtualExec.h index 85e0798..42217a7 100644 --- a/kernel/src/bbtkVirtualExec.h +++ b/kernel/src/bbtkVirtualExec.h @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkVirtualExec.h,v $ $ Language: C++ - Date: $Date: 2008/01/28 15:08:53 $ - Version: $Revision: 1.3 $ + Date: $Date: 2008/01/30 09:28:16 $ + Version: $Revision: 1.4 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -126,11 +126,14 @@ namespace bbtk /// changes the workspace name virtual void SetWorkspaceName( const std::string& n ) = 0; - ///Adds the authorName to the Box's author list + ///Adds the authorName to the Box author list virtual void Author(const std::string &authorName) = 0; + ///Adds the keywords to the Box keywords list + virtual void Keyword(const std::string &keywords) = 0; + /// The description string which explains what does the ComplexBox - virtual void Description(const std::string & d) = 0; + virtual void Description(const std::string &d) = 0; /// prints the list off the boxes of the current box virtual void PrintBoxes() = 0; -- 2.45.1