From b36ad32968c9523e48d5b853b6b77e9e421709d2 Mon Sep 17 00:00:00 2001 From: guigues Date: Fri, 7 Mar 2008 10:21:30 +0000 Subject: [PATCH] Compiles de nuevo with no global factory --- kernel/appli/bbi/bbi.cxx | 7 ++- kernel/src/bbtkComplexBlackBox.cxx | 6 +-- kernel/src/bbtkComplexBlackBoxDescriptor.cxx | 23 +++++++-- kernel/src/bbtkComplexBlackBoxDescriptor.h | 20 ++++++-- kernel/src/bbtkConnection.cxx | 12 +++-- kernel/src/bbtkConnection.h | 14 ++++-- kernel/src/bbtkFactory.cxx | 52 ++------------------ kernel/src/bbtkTranscriptor.cxx | 6 +-- 8 files changed, 66 insertions(+), 74 deletions(-) diff --git a/kernel/appli/bbi/bbi.cxx b/kernel/appli/bbi/bbi.cxx index 3a7368b..56417d9 100644 --- a/kernel/appli/bbi/bbi.cxx +++ b/kernel/appli/bbi/bbi.cxx @@ -144,8 +144,11 @@ bool wxBBIApp::OnInit( ) for (i=input_file.begin(); i!=input_file.end(); ++i) I->InterpretFile(*i); I->SetNoExecMode(false); - if (help_on_script) bbtk::HelpBlackBox("workspace",false); - + if (help_on_script) + { + std::string package; + I->GetInterpreter()->GetExecuter()->GetFactory()->HelpBlackBox("workspace",package,false); + } if (!(command || bbtk::Wx::IsSomeWindowShown() )) { I->Close(); diff --git a/kernel/src/bbtkComplexBlackBox.cxx b/kernel/src/bbtkComplexBlackBox.cxx index be9fec2..8c54bc9 100644 --- a/kernel/src/bbtkComplexBlackBox.cxx +++ b/kernel/src/bbtkComplexBlackBox.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkComplexBlackBox.cxx,v $ Language: C++ -Date: $Date: 2008/02/19 18:40:10 $ -Version: $Revision: 1.6 $ +Date: $Date: 2008/03/07 10:21:30 $ +Version: $Revision: 1.7 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -79,7 +79,7 @@ namespace bbtk BlackBox* bbfrom = bbGetBlackBox( (*j)->GetBlackBoxFrom()->bbGetName() ); BlackBox* bbto = bbGetBlackBox( (*j)->GetBlackBoxTo()->bbGetName() ); - Connection* c = /*mDescriptor->GetFactory()->Create*/ + Connection* c = mDescriptor->GetFactory()-> NewConnection( bbfrom, (*j)->GetBlackBoxFromOutput(), bbto, diff --git a/kernel/src/bbtkComplexBlackBoxDescriptor.cxx b/kernel/src/bbtkComplexBlackBoxDescriptor.cxx index b7b0798..d9e8da1 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/02/19 18:40:10 $ - Version: $Revision: 1.11 $ + 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(\""<bbUnsafeGetBlackBox( name ) ) @@ -94,7 +100,7 @@ namespace bbtk bbtkError("a black box \""<bbAddBlackBox ( /*mFactory->Create*/ NewBlackBox(type,name) ); + mPrototype->bbAddBlackBox ( mFactory->NewBlackBox(type,name) ); bbtkDebugDecTab("Kernel",5); } @@ -135,6 +141,13 @@ namespace bbtk <bbGetBlackBox( from ); if ( !bbfrom ) @@ -147,7 +160,7 @@ namespace bbtk bbtkError("the black box \""<*/ NewConnection( bbfrom, output, bbto, input ); + Connection* c = mFactory->NewConnection( bbfrom, output, bbto, input ); mPrototype->bbAddConnection(c); diff --git a/kernel/src/bbtkComplexBlackBoxDescriptor.h b/kernel/src/bbtkComplexBlackBoxDescriptor.h index cfa7945..27dcd4d 100644 --- a/kernel/src/bbtkComplexBlackBoxDescriptor.h +++ b/kernel/src/bbtkComplexBlackBoxDescriptor.h @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkComplexBlackBoxDescriptor.h,v $ Language: C++ - Date: $Date: 2008/01/22 15:02:00 $ - Version: $Revision: 1.1 $ + Date: $Date: 2008/03/07 10:21:30 $ + 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 @@ -45,18 +45,28 @@ namespace bbtk public: /// Default ctor with name - ComplexBlackBoxDescriptor(const std::string& name); //, Factory* f); + ComplexBlackBoxDescriptor(const std::string& name); /// Default dtor ~ComplexBlackBoxDescriptor(); + + /// Sets the factory used + void SetFactory(Factory* f) { mFactory = f; } + /// Gets the factory used + Factory* GetFactory() { return mFactory; } + /// Gets the factory used (const) + const Factory* GetFactory() const { return mFactory; } + /// Creates an instance of name of the ComplexBlackBox of which this is the descriptor virtual BlackBox* CreateInstance(const std::string& name); /// Adds a black box to the complex box + /// Needs a factory set ! void Add ( const std::string& type, const std::string& name ); /// Connects two black boxes of the complex box - void Connect ( const std::string& from, + /// Needs a factory set ! + void Connect ( const std::string& from, const std::string& output, const std::string& to, const std::string& input @@ -114,6 +124,8 @@ namespace bbtk private: /// Default ctor is private (must have name and factory) ComplexBlackBoxDescriptor() {} + /// The factory used + Factory* mFactory; /// The complex box in which boxes and connections are stored ComplexBlackBox* mPrototype; /// The name of the script file from which it was created diff --git a/kernel/src/bbtkConnection.cxx b/kernel/src/bbtkConnection.cxx index 5049658..8dbce18 100644 --- a/kernel/src/bbtkConnection.cxx +++ b/kernel/src/bbtkConnection.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkConnection.cxx,v $ Language: C++ - Date: $Date: 2008/02/05 13:23:46 $ - Version: $Revision: 1.2 $ + Date: $Date: 2008/03/07 10:21:30 $ + 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 @@ -32,8 +32,10 @@ namespace bbtk /// Ctor with the black box from and to and their input and output. /// Check the input and output compatibility Connection::Connection(BlackBox* from, const std::string& output, - BlackBox* to, const std::string& input ) + BlackBox* to, const std::string& input , + const Factory* f ) : mAdaptor(0), + mFactory(f), mFromAny(false), mToAny(false) { @@ -97,7 +99,7 @@ namespace bbtk std::string name; name = from->bbGetName() + "." + output + "-" + to->bbGetName() + "." + input; - mAdaptor = NewAdaptor(from->bbGetOutputType(output), + mAdaptor = mFactory->NewAdaptor(from->bbGetOutputType(output), to->bbGetInputType(input), name); if (!mAdaptor) @@ -229,7 +231,7 @@ namespace bbtk bbtk::BlackBox* adaptor = 0; try { - adaptor = NewAdaptor(mFrom->bbGetOutput(mOutput).type(), + adaptor = mFactory->NewAdaptor(mFrom->bbGetOutput(mOutput).type(), mTo->bbGetInputType(mInput), ""); } diff --git a/kernel/src/bbtkConnection.h b/kernel/src/bbtkConnection.h index 4a79968..b75cb20 100644 --- a/kernel/src/bbtkConnection.h +++ b/kernel/src/bbtkConnection.h @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkConnection.h,v $ Language: C++ - Date: $Date: 2008/02/20 16:05:38 $ - Version: $Revision: 1.2 $ + Date: $Date: 2008/03/07 10:21:30 $ + 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 @@ -29,10 +29,14 @@ #define __bbtkConnection_h__ #include "bbtkSystem.h" + #include namespace bbtk { + + class Factory; + /// typedef int IOStatus; /// @@ -51,7 +55,8 @@ namespace bbtk public: /// Ctor Connection(BlackBox* from, const std::string& output, - BlackBox* to, const std::string& input ); + BlackBox* to, const std::string& input, + const Factory* f ); /// Dtor ~Connection(); @@ -93,6 +98,9 @@ namespace bbtk /// Adaptor black box if needed BlackBox* mAdaptor; + /// The factory used to create adaptors + const Factory* mFactory; + /// Is the connection input type is any ? bool mFromAny; diff --git a/kernel/src/bbtkFactory.cxx b/kernel/src/bbtkFactory.cxx index 5e9c395..85e92b0 100644 --- a/kernel/src/bbtkFactory.cxx +++ b/kernel/src/bbtkFactory.cxx @@ -4,8 +4,8 @@ Program: bbtk Module: $RCSfile: bbtkFactory.cxx,v $ Language: C++ -Date: $Date: 2008/03/07 08:40:14 $ -Version: $Revision: 1.27 $ +Date: $Date: 2008/03/07 10:21:30 $ +Version: $Revision: 1.28 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de @@ -723,53 +723,7 @@ namespace bbtk <bbGetName()<<"\",\""<bbGetOutputType(output).name() ); - std::string t2 ( to->bbGetInputType(input).name() ); - - - if ( t1 == t2 ) - //from->bbGetOutputType(output) == - // to->bbGetInputType(input) ) - { - c = new Connection(from,output,to,input); - } - else - { - // std::cout << "Adaptive connection "<bbGetName() + "." + output + "-" - + to->bbGetName() + "." + input; - - BlackBox* b = 0; - PackageMapType::const_iterator i; - for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i ) - { - b = i->second.mPackage->NewAdaptor(from->bbGetOutputType(output), - to->bbGetInputType(input), - name); - if (b) break; - } - if (!b) - { - bbtkError("did not find any <" - <bbGetOutputType(output)) - <<"> to <" - <bbGetInputType(input)) - <<"> adaptor"); - } - c = new AdaptiveConnection(from,output,to,input,b); - } - bbtkDebugDecTab("Kernel",7); - - return c; - */ + return new Connection(from,output,to,input,this); } //=================================================================== diff --git a/kernel/src/bbtkTranscriptor.cxx b/kernel/src/bbtkTranscriptor.cxx index 0609b5f..dd432e7 100644 --- a/kernel/src/bbtkTranscriptor.cxx +++ b/kernel/src/bbtkTranscriptor.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkTranscriptor.cxx,v $ $ Language: C++ - Date: $Date: 2008/02/18 10:41:02 $ - Version: $Revision: 1.6 $ + Date: $Date: 2008/03/07 10:21:30 $ + Version: $Revision: 1.7 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -73,7 +73,7 @@ std::cout << "====================================================== delete Tran } if (mPackage) { - GetGlobalFactory()->UnLoadPackage("user"); + //GetGlobalFactory()->UnLoadPackage("user"); } if(m_Fp) -- 2.45.1