]> Creatis software - bbtk.git/commitdiff
First stage of 'Keyword'
authorjean-pierre roux <jean-pierre.roux@creatis.insa-lyon.fr>
Wed, 30 Jan 2008 09:28:15 +0000 (09:28 +0000)
committerjean-pierre roux <jean-pierre.roux@creatis.insa-lyon.fr>
Wed, 30 Jan 2008 09:28:15 +0000 (09:28 +0000)
kernel/src/bbtkBlackBoxDescriptor.cxx
kernel/src/bbtkBlackBoxDescriptor.h
kernel/src/bbtkExecuter.cxx
kernel/src/bbtkExecuter.h
kernel/src/bbtkFactory.cxx
kernel/src/bbtkInterpreter.cxx
kernel/src/bbtkInterpreter.h
kernel/src/bbtkPackage.h
kernel/src/bbtkUserBlackBoxMacros.h
kernel/src/bbtkVirtualExec.h

index 1fe23c82888e6b63b9d8283d3f473ea31fbcbc5a..050231eccab747e7a3b638cf2666e732d50bd51c 100644 (file)
@@ -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(\""<<s<<
@@ -69,7 +70,10 @@ namespace bbtk
     if (clear) mDescription = s; 
     else mDescription += s;
    }
-  /// Adds the string to the BlackBox's author list
+  //=========================================================================
+
+  //=========================================================================   
+  /// Adds the string to the BlackBox author list
   void BlackBoxDescriptor::AddToAuthor( const std::string& s, bool clear)
   {
     bbtkDebugMessage("Core",9,"BlackBoxDescriptor::AddToAuthor(\""<<s<<"\") ["
@@ -79,6 +83,17 @@ namespace bbtk
   }
   //=========================================================================
 
+  //=========================================================================  
+  /// Adds the string to the BlackBox keyword list
+  void BlackBoxDescriptor::AddToKeyword( const std::string& s, bool clear)
+  {
+    bbtkDebugMessage("Core",9,"BlackBoxDescriptor::AddToKeyword(\""<<s<<"\") ["
+                    <<GetTypeName()<<"]"<<std::endl);  
+    if (clear) mKeyword = s;
+    else mKeyword += s;
+  }  
+  //=========================================================================
+
   //=========================================================================
   const BlackBoxDescriptor::InputDescriptor* 
   BlackBoxDescriptor::GetInputDescriptor(const std::string & name) const
@@ -89,9 +104,9 @@ namespace bbtk
     InputDescriptorMapType::const_iterator i;
     i = mInput.find(name);
     if ( i == mInput.end() ) 
-      {
-       bbtkError("input '"<<name<<"' does not exist");
-      }
+    {
+           bbtkError("input '"<<name<<"' does not exist");
+    }
     bbtkDebugDecTab("Core",9);
     return i->second;
   }
@@ -107,9 +122,9 @@ namespace bbtk
     OutputDescriptorMapType::const_iterator i;
     i = mOutput.find(name);
     if ( i == mOutput.end() ) 
-      {
-       bbtkError("output '"<<name<<"' does not exist");
-      }
+    {
+           bbtkError("output '"<<name<<"' does not exist");
+    }
     bbtkDebugDecTab("Core",9);
     return i->second;
   }
@@ -121,11 +136,11 @@ namespace bbtk
     bbtkDebugMessageInc("Core",9,"BlackBoxDescriptor::GetHelp() ["<<GetTypeName()<<"]"<<std::endl);
     if (GetPackage()) 
         {
-    bbtkMessage("Help",1,"Black Box <"<<
-               GetPackage()->GetName()<<"::"<<GetTypeName()<<">"<<std::endl);
-               }
-               else 
-               {
+       bbtkMessage("Help",1,"Black Box <"<<
+                    GetPackage()->GetName()<<"::"<<GetTypeName()<<">"<<std::endl);
+    }
+    else 
+    {
           bbtkMessage("Help",1,"Black Box <::"<<GetTypeName()<<">"<<std::endl);
        }
     bbtkMessage("Help",1," "<<GetDescription()<<std::endl);
index f4694a705484d907a01e532d07618a96bfaaf75e..259aa2f2d86f03139d9be98ff809c3397cda9860 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkBlackBoxDescriptor.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
@@ -70,40 +70,57 @@ namespace bbtk
 
     /// Returns the name of the **TYPE** of the black box
     const std::string& GetTypeName() const { return mTypeName; }
+    
     /// Returns the description of the BlackBox 
     const std::string& GetDescription() const { return mDescription; }
+    
     /// Returns the author(s) of the BlackBox
     const std::string& GetAuthor() const { return mAuthor; }
+    
+    /// Returns the keyword(s) of the BlackBox
+    const std::string& GetKeyword() const { return mKeyword; }
+    
     /// Returns the Package to which the box belongs
     Package* GetPackage() { return mPackage; }
+    
     /// Returns the Package to which the box belongs
     const Package* GetPackage() const { return mPackage; }
+    
     /// Returns the category of box 
     Category GetCategory() const { return mCategory; }
 
-
     /// Prints help on the black box
     virtual void GetHelp(bool full=true) const;
 
     /// Returns a const ref on the map of input descriptors
     const InputDescriptorMapType& GetInputDescriptorMap() const 
       { return mInput; }
+      
     /// Returns a const ref on the map of output descriptors
     const OutputDescriptorMapType& GetOutputDescriptorMap() const 
       { return mOutput; }
+      
     /// Returns a const pointer on the descriptor of the input of name <name> 
     const InputDescriptor* GetInputDescriptor(const std::string & name) const;
+
     /// Returns a const pointer on the descriptor of the output of name <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
index 8730b02eb2387ef7ea7bba95ce8f107e1ebea92f..bd715119fffa4b453dc59b9308bd339e19b36632 100644 (file)
@@ -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)
   {
index 8604affad83ef25be21df4f9ca400dd740f4d35b..47935ae4b5d8bbc5e3ec64d1d22bece112209f85 100644 (file)
@@ -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);
 
index 5c060075c20806d05dde4e55871ac1d4b24841b8..849ebabfc3f4f84c2403206ea7303c09d8020ba6 100644 (file)
@@ -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! ["<<name<<"] is an illegal name");
           return;
        }
-       
+
       // std::string path = Utilities::ExpandLibName(upath, verbose);
-       std::string path;
-       if (name[1]!= ':')  // Absolute name, under Windows
-          path = Utilities::ExpandLibName(name, verbose); // keep last item, here.
-          
+       std::string path = Utilities::ExpandLibName(name, verbose); // keep last item, here.
+         
        if (path != "")
        {
           std::string p2;
index 861f063656ab773dd5e5489debab459f678252f1..dac3e047189dcffc96a91b60d1fb2c2f54f2523a 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkInterpreter.cxx,v $ $
   Language:  C++
-  Date:      $Date: 2008/01/29 14:34:43 $
-  Version:   $Revision: 1.14 $
+  Date:      $Date: 2008/01/30 09:28:15 $
+  Version:   $Revision: 1.15 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -178,6 +178,14 @@ Interpreter* Interpreter::mGlobalInterpreter = NULL;
     info.syntax = "author <string>";
     info.help = "Adds the string <string> to the author information of the black box being defined";
     mCommandDict[info.keyword] = info;
+    
+    info.keyword = "keyword"; //JP
+    info.argmin = 1;
+    info.argmax = 1;
+    info.code = cKeyword;
+    info.syntax = "keyword <list of items, separated by ;>";
+    info.help = "Adds the string <string> to the keyword information of the black box being defined";
+    mCommandDict[info.keyword] = info;
 
     info.keyword = "description";
     info.argmin = 1;
@@ -494,7 +502,11 @@ void Interpreter::InterpretLine( const std::string& line, bool &insideComment )
       case cAuthor :
         mExecuter->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<std::string>&
         int nbFiles = Utilities::Explore(fullDirectoryName, false, Filenames);
 // std::cout << "=================nbFiles " << nbFiles << std::endl;
         int nbBssFiles = 0;
-        for (std::vector<std::string>::iterator i = Filenames.begin(); i!=Filenames.end(); ++i)
+        for (std::vector<std::string>::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<std::string>&
     // (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<std::string>&
         {
           foundFile = true;
         }
-
       } // endif l != 0
     }
     else 
index 732e8f725144e0aff6683f102b7749b1c337729f..24dbd89f29079743afdb46b14a5f0374f5b14f76 100644 (file)
@@ -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,
index 069d13598275e865d8eea0380c798a7f03508914..3b4d8dcf3082ded00d4dc4cb4610964283f46db4 100644 (file)
@@ -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
index f7d145cad09abf7aa6cac4a2aece96a8139fdbba..2ff7aed90366949a269363f2d88b57b21ac2e6a4 100644 (file)
@@ -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
 #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)
index 85e079875c6abeb9c8ec0d4104de700ba86700c0..42217a7a1c88b3c53f7fa39121b34da6ab76891c 100644 (file)
@@ -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;