]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkComplexBlackBoxDescriptor.cxx
BUG slash
[bbtk.git] / kernel / src / bbtkComplexBlackBoxDescriptor.cxx
index 70fc8c7a2d619b298c21044a2a40d65074c8b007..d9e8da14fffa779c90cd7d9dafc10c47a755a636 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkComplexBlackBoxDescriptor.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/02/06 14:58:41 $
-  Version:   $Revision: 1.6 $
+  Date:      $Date: 2008/03/07 10:21:30 $
+  Version:   $Revision: 1.12 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -33,7 +33,8 @@ namespace bbtk
   //=======================================================================
   /// Default ctor
   ComplexBlackBoxDescriptor::ComplexBlackBoxDescriptor(const std::string& name)
-    : BlackBoxDescriptor()
+    : BlackBoxDescriptor(),
+      mFactory(0)
   {
     bbtkDebugMessageInc("Kernel",9,"ComplexBlackBoxDescriptor::ComplexBlackBoxDescriptor(\""<<name<<"\")"<<std::endl);
     SetTypeName(name);
@@ -87,6 +88,11 @@ namespace bbtk
                        <<type<<"\",\""<<name<<"\") ["
                        <<GetTypeName()<<"]"<<std::endl);
     
+    // 
+    if (mFactory == 0) 
+      { 
+       bbtkError("ComplexBlackBoxDescriptor::Add : no factory set");
+      }
     
     // Verify that a box with the same name does not exist already
     if ( mPrototype->bbUnsafeGetBlackBox( name ) ) 
@@ -94,7 +100,7 @@ namespace bbtk
        bbtkError("a black box \""<<name<<"\" already exists");
       }
     // ok : create new one
-    mPrototype->bbAddBlackBox ( /*mFactory->Create*/ NewBlackBox(type,name) );
+    mPrototype->bbAddBlackBox ( mFactory->NewBlackBox(type,name) );
 
     bbtkDebugDecTab("Kernel",5);
   }
@@ -135,6 +141,13 @@ namespace bbtk
                        <<to<<"\",\""<<input
                        <<"\") ["
                        <<GetTypeName()<<"]"<<std::endl);
+  // 
+    if (mFactory == 0) 
+      { 
+       bbtkError("ComplexBlackBoxDescriptor::Connect : no factory set");
+      }
+    
+
   // Verify that a box with the same name does not exist already
     BlackBox* bbfrom = mPrototype->bbGetBlackBox( from );
     if ( !bbfrom ) 
@@ -147,7 +160,7 @@ namespace bbtk
        bbtkError("the black box \""<<to<<"\" does not exist");
       }
     
-    Connection* c = /*mFactory->*/ NewConnection( bbfrom, output, bbto, input );
+    Connection* c = mFactory->NewConnection( bbfrom, output, bbto, input );
 
     mPrototype->bbAddConnection(c);
 
@@ -281,13 +294,17 @@ namespace bbtk
 
 
     std::string descr = GetDescription();
-    //Utilities::html_format(descr);
+    Utilities::html_format(descr);
     
     std::string author = GetAuthor();
     Utilities::html_format(author);
     
-    std::string category = GetCategory();
-    Utilities::html_format(category);
+    std::vector<std::string> categories;
+    // Split the category string 
+    std::string delimiters = ";,";
+    Utilities::SplitString(GetCategory(),
+                          delimiters,categories);
+
         
     (s) << "<p><TABLE cellspacing=0  cellpadding=3>\n";
     (s) << "<TR><TD style='vertical-align: top;'><b> Description </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'> " 
@@ -296,14 +313,20 @@ namespace bbtk
     (s) << "<TR><TD style='vertical-align: top;'><b> Author(s) </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'>  " 
         << author << "</TD></TR>\n";
 
-    (s) << "<TR><TD style='vertical-align: top;'><b> Category(s) </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'>  " 
-        << category << "</TD></TR>\n";      
-
+    (s) << "<TR><TD style='vertical-align: top;'><b> Category(s) </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'>  ";
+    std::vector<std::string>::iterator ci;
+    for (ci=categories.begin(); ci!=categories.end(); ++ci)
+      {
+        s << "<a href=\"../index-category.html#"<< *ci <<"\">" << *ci 
+         << "</a>&nbsp;\n";
+      }
+    s << "</TD></TR>\n";      
     std::string inc = GetScriptFileName();
     if (inc.size()>0) 
       {
-    (s) << "<TR><TD style='vertical-align: top;'><b> Use command </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'> include " 
-      << inc << "</TD></TR>\n";
+       s << "<TR><TD style='vertical-align: top;'><b> To use it </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'> include ";
+       s << inc << "&nbsp;&nbsp;<a href=\"../../../bbs/"<<inc<<"\">[source]</a>";
+       s << "</TD></TR>\n";
        
       }
     
@@ -311,7 +334,7 @@ namespace bbtk
        
     if (B.size()) 
     {
-          (s) << "<TR><TD style='vertical-align: top;'><b> Dependencies </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'>  ";
+          (s) << "<TR><TD style='vertical-align: top;'><b> Uses </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'>  ";
 
           std::set<BlackBoxDescriptor*> pdeps;
           ComplexBlackBox::BlackBoxMapType::const_iterator b;
@@ -371,7 +394,7 @@ namespace bbtk
        Utilities::html_format(type);
        
        std::string descr(in->second->GetDescription());
-       //Utilities::html_format(descr);
+       Utilities::html_format(descr);
 
        (s) << "<TR><TD style='vertical-align: top;'><B><PRE> "<<name<<" </PRE></B></TD>"
          << "<TD style='vertical-align: top;'><I><PRE> "<<type<<" </PRE></I></TD>"
@@ -404,7 +427,7 @@ namespace bbtk
        Utilities::html_format(type);
        
        std::string descr(o->second->GetDescription());
-       //Utilities::html_format(descr);
+       Utilities::html_format(descr);
        
        (s) << "<TR><TD style='vertical-align: top;'><B><PRE> "<<name<<" </PRE></B></TD>"
          << "<TD style='vertical-align: top;'><I><PRE> "<<type<<" </PRE></I></TD>"