]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkPackage.cxx
*** empty log message ***
[bbtk.git] / kernel / src / bbtkPackage.cxx
index 4acb0f16192f8351b1219b8f73e0e2abfba64834..c37a2a1c71020086974e0d7fb6d9aee96dafffe1 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkPackage.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/01/22 15:02:00 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2008/02/05 11:07:42 $
+  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
@@ -74,20 +74,20 @@ namespace bbtk
     bbtkDebugMessageInc("Core",7,"Package::~Package(\""<<mName<<"\")"<<bbtkendl);
     BlackBoxMapType::const_iterator i;
     for (i=mBlackBoxMap.begin();
-        i!=mBlackBoxMap.end();
-        ++i) 
-      {
-       delete i->second;
-      
+         i!=mBlackBoxMap.end();
+       ++i) 
+     {
+        delete i->second;
+     } 
     // Adaptors are also stored in the black box map : hence already deleted
     /*
     AdaptorMapType::const_iterator j;
     for (j=mAdaptorMap.begin();
-        j!=mAdaptorMap.end();
-        ++j) 
+         j!=mAdaptorMap.end();
+       ++j) 
       {
-       delete j->second;
-       }
+         delete j->second;
+      }
     */ 
     bbtkDebugDecTab("Core",7);
   }
@@ -104,10 +104,10 @@ namespace bbtk
     
     BlackBoxMapType::const_iterator i = mBlackBoxMap.find(type);
     if (i == mBlackBoxMap.end())  
-      {
-       bbtkDebugDecTab("Core",8);
-       return 0;
-      }
+    {
+          bbtkDebugDecTab("Core",8);
+          return 0;
+    }
     BlackBox* bb =i->second->CreateInstance(name);
     bbtkDebugDecTab("Core",8);
     return bb;   
@@ -157,7 +157,7 @@ namespace bbtk
     d->SetPackage(this);
     
     // If it is a default adaptor, also register it in the adaptors map
-    if ( d->GetCategory() == BlackBoxDescriptor::DEFAULT_ADAPTOR) 
+    if ( d->GetKind() == BlackBoxDescriptor::DEFAULT_ADAPTOR) 
       {
        TypeInfo typein = d->GetInputDescriptor("In")->GetTypeInfo();
        TypeInfo typeout = d->GetOutputDescriptor("Out")->GetTypeInfo();
@@ -165,7 +165,7 @@ namespace bbtk
        AdaptorMapType::const_iterator i = mAdaptorMap.find(key);
        if (i == mAdaptorMap.end())  
          {
-           bbtkDebugMessage("Core",8,"The box is an adaptor, inserting it in adaptors map ..."<<std::endl);       
+           bbtkDebugMessage("Core",8,"The box is an adaptor, inserting it in adaptors map ..."<<std::endl);   
            mAdaptorMap[key] = d;
          }
        // If already an adaptor registered : error
@@ -177,8 +177,6 @@ namespace bbtk
                      <<"> as default adaptor but there is already a default adaptor registered (<"
                      <<i->second->GetTypeName()<<">)");
          }
-       
-
       }
     
     bbtkDebugDecTab("Core",8);
@@ -196,17 +194,17 @@ namespace bbtk
     // Looking into the bb map
     BlackBoxMapType::iterator i = mBlackBoxMap.find(name);
     if (i == mBlackBoxMap.end())  
-      {
-       bbtkDebugDecTab("Core",8);
-       bbtkError("UnRegister : The package <"<<GetName()<<"> does not contains the black box <"<<name<<">");
-      }
+    {
+       bbtkDebugDecTab("Core",8);
+       bbtkError("UnRegister : The package <"<<GetName()<<"> does not contains the black box <"<<name<<">");
+     }
     mBlackBoxMap.erase(i);
     // Is it also in the adaptors map ?
     /*
     AdaptorMapType::iterator j = mAdaptorMap.find(name);
     if (j != mAdaptorMap.end())  
       {
-       mAdaptorMap.erase(j);
+         mAdaptorMap.erase(j);
       }
     */    
     bbtkDebugDecTab("Core",8);    
@@ -222,8 +220,8 @@ namespace bbtk
     BlackBoxMapType::iterator i = mBlackBoxMap.find(oldname);
     if (i == mBlackBoxMap.end())  
       {
-       bbtkDebugDecTab("Core",8);
-       bbtkError("ChangeBlackBoxName : The package <"<<GetName()<<"> does not contains the black box <"<<oldname<<">");
+         bbtkDebugDecTab("Core",8);
+         bbtkError("ChangeBlackBoxName : The package <"<<GetName()<<"> does not contains the black box <"<<oldname<<">");
       }
 
     i->second->SetTypeName(newname);
@@ -259,7 +257,7 @@ namespace bbtk
   {
     unsigned int lmax = 0;
     std::vector<std::string> names;
-    std::vector<std::string> categs;
+    std::vector<std::string> kinds;
     std::vector<std::string> descrs;
 
     BlackBoxMapType::const_iterator i;
@@ -268,25 +266,25 @@ namespace bbtk
         ++i) 
       {
        if ( adaptors || 
-            ( i->second->GetCategory() == BlackBoxDescriptor::STANDARD) ) 
+            ( i->second->GetKind() == BlackBoxDescriptor::STANDARD) ) 
          {
            std::string name("  ");
            name += i->second->GetTypeName();
            names.push_back(name);
 
-           std::string categ;
-           if ( i->second->GetCategory() == BlackBoxDescriptor::ADAPTOR )
+           std::string kind;
+           if ( i->second->GetKind() == BlackBoxDescriptor::ADAPTOR )
              {
-               categ = std::string("[A]");
+               kind = std::string("[A]");
              }
-           else if ( i->second->GetCategory() == 
+           else if ( i->second->GetKind() == 
                      BlackBoxDescriptor::DEFAULT_ADAPTOR )
              {
-               categ = std::string("[DA]");
+               kind = std::string("[DA]");
              }
-           categs.push_back(categ);
+           kinds.push_back(kind);
 
-           unsigned int l = name.size()+categ.size();
+           unsigned int l = name.size()+kind.size();
            if (l>lmax) lmax = l;
 
            std::string descr;
@@ -303,7 +301,7 @@ namespace bbtk
     std::string offs;
     offs.append(lmax+3,' ');
     std::vector<std::string>::iterator ni,ci,di;
-    for (ni = names.begin(), ci = categs.begin(), di = descrs.begin();
+    for (ni = names.begin(), ci = kinds.begin(), di = descrs.begin();
         ni != names.end(); ++ni, ++ci, ++di)
       {
        std::string space;
@@ -318,7 +316,7 @@ namespace bbtk
        else 
          bbtkMessage("Help",1,d << std::endl);
        //    d = d.substr(dmax,d.size());
-       //  }   
+       //  }
       }
 
   }
@@ -333,11 +331,11 @@ namespace bbtk
         i!=mBlackBoxMap.end();
         ++i) 
       {
-       if ( i->second->GetCategory() != BlackBoxDescriptor::STANDARD ) 
+       if ( i->second->GetKind() != BlackBoxDescriptor::STANDARD ) 
          {
            bbtkMessage("Help",1,
                        "  "<<i->second->GetTypeName());
-           if ( i->second->GetCategory() == 
+           if ( i->second->GetKind() == 
                 BlackBoxDescriptor::DEFAULT_ADAPTOR )
              {
                bbtkMessage("Help",1,
@@ -347,7 +345,7 @@ namespace bbtk
              {
                bbtkMessage("Help",1,
                            " : "<<i->second->GetDescription());
-               
+
              } 
            bbtkMessage("Help",1,std::endl);
          }
@@ -364,7 +362,7 @@ namespace bbtk
          {
            bbtkMessage("Help",1,
                        " : "<<i->second->GetDescription());
-         
+  
          } 
        bbtkMessage("Help",1,std::endl);
       }
@@ -402,10 +400,10 @@ namespace bbtk
     
     BlackBoxMapType::const_iterator i = mBlackBoxMap.find(name);
     if (i == mBlackBoxMap.end())  
-      {
-       bbtkDebugDecTab("Core",8);
-       return false;
-      }
+    {
+      bbtkDebugDecTab("Core",8);
+      return false;
+    }
     bbtkDebugDecTab("Core",8);
     return true;
   }
@@ -416,7 +414,7 @@ namespace bbtk
   //==========================================================================
   void Package::CreateHtmlPage(const std::string& filename,
                               const std::string& caller,
-                              const std::string& source,       
+                              const std::string& source,
                               const std::string& custom_header,
                               const std::string& custom_title,
                               int detail, 
@@ -431,9 +429,9 @@ namespace bbtk
     std::ofstream s;
     s.open(filename.c_str());
     if (!s.good()) 
-      {
-       bbtkError("Package "<<GetName()<<" : CreateHtmlPage : could not open file '"<<filename<<"'");
-      }
+    {
+       bbtkError("Package "<<GetName()<<" : CreateHtmlPage : could not open file '"<<filename<<"'");
+    }
     
     //----------------------
     // Html head
@@ -508,7 +506,9 @@ namespace bbtk
          << GetDescription() << "</TD></TR>\n";
        s << "<TR><TD style='vertical-align: top;'><b> Author(s) </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'>  " 
          << GetAuthor() << "</TD></TR>\n";
-       s << "<TR><TD style='vertical-align: top;'><b> Version </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'> " 
+       s << "<TR><TD style='vertical-align: top;'><b> Author(s) </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'>  " 
+         << GetKeyword() << "</TD></TR>\n";
+       s << "<TR><TD style='vertical-align: top;'><b> Version </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'> " 
          << GetVersion() << "</TD></TR>\n";
        s << "<TR><TD style='vertical-align: top;'><b> bbtk Version </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'> " 
          << GetBBTKVersion() << "</TD></TR>\n";
@@ -527,13 +527,13 @@ namespace bbtk
     BlackBoxMapType::const_iterator i;
     for (i=mBlackBoxMap.begin(); i!=mBlackBoxMap.end(); ++i) 
       {
-       if ( i->second->GetCategory() != BlackBoxDescriptor::STANDARD) 
+       if ( i->second->GetKind() != BlackBoxDescriptor::STANDARD) 
          continue;
        
        std::string name = i->second->GetTypeName();
        Utilities::html_format(name);
        std::string descr = i->second->GetDescription();
-       
+
         s << "<TR>";
        s << "<TD style='vertical-align: top;'>";
        s << "<li><a name=\"toc_"<<name
@@ -556,18 +556,18 @@ namespace bbtk
        //  s << "<div class=\"contents\">\n";
        s << "<p><b> Adaptors : </b>\n";
        s << "<ul>\n";
-       
+
        //    BlackBoxMapType::const_iterator i;
        s << "<p><TABLE cellspacing=0  cellpadding=3>\n";
        for (i=mBlackBoxMap.begin(); i!=mBlackBoxMap.end();++i) 
          {
-           if ( i->second->GetCategory() == BlackBoxDescriptor::STANDARD) 
+           if ( i->second->GetKind() == BlackBoxDescriptor::STANDARD) 
              continue;
-           
+    
            std::string name = i->second->GetTypeName();
            Utilities::html_format(name);
            std::string descr = i->second->GetDescription();
-           
+    
            s << "<TR>";
            s << "<TD style='vertical-align: top;'>";
            s << "<li><a name=\"toc_"<<name
@@ -578,7 +578,7 @@ namespace bbtk
            s << "</TR>\n";
          }    
        s << "</TABLE>\n";
-       
+
        s << "</li></ul>\n";
        s << "</div>\n";
       }
@@ -605,7 +605,7 @@ namespace bbtk
       filename.find_last_of(ConfigurationFile::GetInstance().Get_file_separator ());
     if (slash_position != std::string::npos) {
       if (slash_position == 0)
-       slash_position = 1;  
+         slash_position = 1;  
       dir = filename.substr(0,slash_position);
     }