X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkComplexBlackBoxDescriptor.cxx;h=0e1114d52383c1480eb50ca410ba084ff1aa0746;hb=ba235cfa6ce74178ab468c01af002af0ab3a7d82;hp=e421055a8e2c5c65f136566801765cacbe528f6c;hpb=6c5d7746e8e4cb0b5d6e164b917008a7137910fb;p=bbtk.git diff --git a/kernel/src/bbtkComplexBlackBoxDescriptor.cxx b/kernel/src/bbtkComplexBlackBoxDescriptor.cxx index e421055..0e1114d 100644 --- a/kernel/src/bbtkComplexBlackBoxDescriptor.cxx +++ b/kernel/src/bbtkComplexBlackBoxDescriptor.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkComplexBlackBoxDescriptor.cxx,v $ Language: C++ - Date: $Date: 2008/04/08 06:59:30 $ - Version: $Revision: 1.13 $ + Date: $Date: 2008/05/14 10:26:29 $ + Version: $Revision: 1.16 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -28,19 +28,30 @@ namespace bbtk { - + //======================================================================= + /// + ComplexBlackBoxDescriptor::Pointer + ComplexBlackBoxDescriptor::New(const std::string& name) + { + bbtkDebugMessage("object",1,"##> ComplexBlackBoxDescriptor::New(\""< ComplexBlackBoxDescriptor::ComplexBlackBoxDescriptor(\""<SetAsPrototype(); + bbtkDebugMessage("object",2,"<== ComplexBlackBoxDescriptor::ComplexBlackBoxDescriptor(\""< ComplexBlackBoxDescriptor::~ComplexBlackBoxDescriptor(\""<Delete(); + mPrototype.reset(); + bbtkDebugMessage("object",2,"<== ComplexBlackBoxDescriptor::~ComplexBlackBoxDescriptor(\""<Check(recursive); + } + //========================================================================= //======================================================================= /// Creates an instance of name of the ComplexBlackBox of which this is the descriptor - BlackBox* ComplexBlackBoxDescriptor::CreateInstance(const std::string& name) + BlackBox::Pointer + ComplexBlackBoxDescriptor::NewBlackBox(const std::string& name) { - //bbtkError("ComplexBlackBoxDescriptor::CreateInstance not implemented"); bbtkDebugMessageInc("Kernel",5, - "ComplexBlackBoxDescriptor::CreateInstance(\"" + "ComplexBlackBoxDescriptor::NewBlackBox(\"" <bbAddBlackBox ( mFactory->NewBlackBox(type,name) ); + mPrototype->bbAddBlackBox ( GetFactory()->NewBlackBox(type,name) ); bbtkDebugDecTab("Kernel",5); } //======================================================================= + + //======================================================================= + /// Removes a black box from the complex box + void ComplexBlackBoxDescriptor::Remove( const std::string& name, + bool remove_connections) + { + mPrototype->bbRemoveBlackBox(name,remove_connections); + } + //======================================================================= + - //======================================================================= + //======================================================================= /// Adds a black box to the execution list void ComplexBlackBoxDescriptor::AddToExecutionList ( const std::string& box) { @@ -115,7 +149,7 @@ namespace bbtk <bbUnsafeGetBlackBox( box ); + BlackBox::Pointer b = mPrototype->bbUnsafeGetBlackBox( box ); if ( !b ) { bbtkError("the black box \""<bbGetBlackBox( from ); + BlackBox::Pointer bbfrom = mPrototype->bbGetBlackBox( from ); if ( !bbfrom ) { bbtkError("the black box \""<bbGetBlackBox( to ); + BlackBox::Pointer bbto = mPrototype->bbGetBlackBox( to ); if ( !bbto ) { bbtkError("the black box \""<NewConnection( bbfrom, output, bbto, input ); + Connection::Pointer c + = GetFactory()->NewConnection( bbfrom, output, bbto, input ); mPrototype->bbAddConnection(c); @@ -183,7 +218,7 @@ namespace bbtk <<"\") [" <bbGetBlackBox( box ); + BlackBox::Pointer bb = mPrototype->bbGetBlackBox( box ); if ( !bb ) { bbtkError("the black box \""<bbGetBlackBox( box ); + BlackBox::Pointer bb = mPrototype->bbGetBlackBox( box ); if ( !bb ) { bbtkError("the black box \""< Uses : "; - std::set pdeps; + std::set pdeps; ComplexBlackBox::BlackBoxMapType::const_iterator b; for ( b = B.begin(); b != B.end(); ++b ) { - BlackBoxDescriptor* d = b->second->bbGetDescriptor(); + BlackBoxDescriptor::Pointer d = b->second->bbGetDescriptor(); if (pdeps.find(d) != pdeps.end()) continue; pdeps.insert(d); - Package* p = d->GetPackage(); + Package::Pointer p = d->GetPackage(); std::string name = b->second->bbGetTypeName(); @@ -400,7 +435,7 @@ namespace bbtk Utilities::html_format(type); std::string descr(in->second->GetDescription()); - Utilities::html_format(descr); + //Utilities::html_format(descr); (s) << "
 "<"
 	  << "
 "<"
@@ -433,7 +468,7 @@ namespace bbtk
 	Utilities::html_format(type);
 	
 	std::string descr(o->second->GetDescription());
-	Utilities::html_format(descr);
+	//Utilities::html_format(descr);
 	
 	(s) << "
 "<"
 	  << "
 "<"
@@ -466,12 +501,15 @@ namespace bbtk
     InputDescriptorMapType::const_iterator i;
     unsigned int namelmax = 0;
     unsigned int typelmax = 0;
+    unsigned int natlmax = 0;
     for ( i = mInput.begin();  i != mInput.end(); ++i ) 
     {
 	   if (i->second->GetName().size()>namelmax) 
 	     namelmax = i->second->GetName().size();
 	   if (i->second->GetTypeName().size()>typelmax) 
 	     typelmax = i->second->GetTypeName().size();
+	   if (i->second->GetNature().size()>natlmax) 
+	     natlmax = i->second->GetNature().size();
     }
     OutputDescriptorMapType::const_iterator o;
     if (full) 
@@ -482,6 +520,8 @@ namespace bbtk
 	       namelmax = o->second->GetName().size();
 	    if (o->second->GetTypeName().size()>typelmax) 
 	       typelmax = o->second->GetTypeName().size();
+	   if (o->second->GetNature().size()>natlmax) 
+	     natlmax = o->second->GetNature().size();
 	   }
     }
     //
@@ -494,10 +534,14 @@ namespace bbtk
 	   std::string type(i->second->GetTypeName());
 	   type += ">";
 	   type.append(1+typelmax-type.size(),' ');
+	   std::string nature(i->second->GetNature());
+	   nature += "]";
+	   nature.append(1+natlmax-nature.size(),' ');
 	   bbtkMessage("Help",1,
-		    "    '"<second->GetDescription()<second->GetDescription()<second->GetTypeName());
 	     type += ">";
 	     type.append(1+typelmax-type.size(),' ');
+	     std::string nature(o->second->GetNature());
+	     nature += "]";
+	     nature.append(1+natlmax-nature.size(),' ');
 	     bbtkMessage("Help",1,
-			 "    '"<second->GetDescription()<GetObjectRecursiveSize();
+    return s;
+  }
+  //==========================================================================
 
 }