X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkComplexBlackBoxDescriptor.cxx;h=efe06f170e8444cc9ee7105576d1b5a4d5a66887;hb=4ad5b5ee44357ad873bc8c43230defb6d0a79879;hp=679557533a763c58d095c50de67622675c931cf8;hpb=c2a4b1893412e50a3d9abff221938a2d16c4a7cb;p=bbtk.git diff --git a/kernel/src/bbtkComplexBlackBoxDescriptor.cxx b/kernel/src/bbtkComplexBlackBoxDescriptor.cxx index 6795575..efe06f1 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/09 11:16:57 $ - Version: $Revision: 1.14 $ + Date: $Date: 2008/04/18 12:59: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 @@ -28,20 +28,30 @@ namespace bbtk { - + //======================================================================= + /// + ComplexBlackBoxDescriptor::Pointer + ComplexBlackBoxDescriptor::New(const std::string& name) + { + bbtkDebugMessage("object",1,"##> ComplexBlackBoxDescriptor::New(\""< ComplexBlackBoxDescriptor::ComplexBlackBoxDescriptor(\""<Reference(); - bbtkDebugDecTab("Kernel",9); + mPrototype = ComplexBlackBox::New(name+std::string("Prototype"), + MakePointer(this,true)); + mPrototype->SetAsPrototype(); + bbtkDebugMessage("object",2,"<== ComplexBlackBoxDescriptor::ComplexBlackBoxDescriptor(\""< ComplexBlackBoxDescriptor::~ComplexBlackBoxDescriptor(\""<Delete(); + mPrototype.reset(); + bbtkDebugMessage("object",2,"<== ComplexBlackBoxDescriptor::~ComplexBlackBoxDescriptor(\""< 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) { @@ -124,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); @@ -192,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(); @@ -564,7 +590,43 @@ namespace bbtk } //======================================================================= - - + //========================================================================== + std::string ComplexBlackBoxDescriptor::GetObjectName() const + { + return std::string("ComplexBlackBoxDescriptor '")+GetFullTypeName() + +std::string("'"); + } + //========================================================================== + //======================================================================= + std::string ComplexBlackBoxDescriptor::GetObjectInfo() const + { + std::string i; + return i; + } + //======================================================================= + //========================================================================== +size_t ComplexBlackBoxDescriptor::GetObjectSize() const +{ + size_t s = Superclass::GetObjectSize(); + s += ComplexBlackBoxDescriptor::GetObjectInternalSize(); + return s; + } + //========================================================================== + //========================================================================== +size_t ComplexBlackBoxDescriptor::GetObjectInternalSize() const +{ + size_t s = sizeof(ComplexBlackBoxDescriptor); + return s; + } + //========================================================================== + //========================================================================== + size_t ComplexBlackBoxDescriptor::GetObjectRecursiveSize() const + { + size_t s = Superclass::GetObjectRecursiveSize(); + s += ComplexBlackBoxDescriptor::GetObjectInternalSize(); + s += mPrototype->GetObjectRecursiveSize(); + return s; + } + //========================================================================== }