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();
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
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,
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
//=======================================================================
/// Default ctor
ComplexBlackBoxDescriptor::ComplexBlackBoxDescriptor(const std::string& name)
- : BlackBoxDescriptor()
+ : BlackBoxDescriptor(),
+ mFactory(0)
{
bbtkDebugMessageInc("Kernel",9,"ComplexBlackBoxDescriptor::ComplexBlackBoxDescriptor(\""<<name<<"\")"<<std::endl);
SetTypeName(name);
<<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 ) )
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);
}
<<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 )
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);
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
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 <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
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
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
/// 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)
{
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)
bbtk::BlackBox* adaptor = 0;
try
{
- adaptor = NewAdaptor(mFrom->bbGetOutput(mOutput).type(),
+ adaptor = mFactory->NewAdaptor(mFrom->bbGetOutput(mOutput).type(),
mTo->bbGetInputType(mInput),
"");
}
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
#define __bbtkConnection_h__
#include "bbtkSystem.h"
+
#include <string>
namespace bbtk
{
+
+ class Factory;
+
///
typedef int IOStatus;
///
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();
/// Adaptor black box if needed
BlackBox* mAdaptor;
+ /// The factory used to create adaptors
+ const Factory* mFactory;
+
/// Is the connection input type is any<thing> ?
bool mFromAny;
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
<<to->bbGetName()<<"\",\""<<input
<<"\")"<<std::endl);
- return new Connection(from,output,to,input);
- /*
- Connection* c;
- // !!! WARNING : WE NEED TO TEST THE TYPE NAME EQUALITY
- // BECAUSE IN DIFFERENT DYN LIBS THE type_info EQUALITY CAN
- // BE FALSE (DIFFERENT INSTANCES !)
-
- std::string t1 ( from->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 "<<std::endl;
- std::string name;
- name = from->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 <"
- <<TypeName(from->bbGetOutputType(output))
- <<"> to <"
- <<TypeName(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);
}
//===================================================================
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
}
if (mPackage)
{
- GetGlobalFactory()->UnLoadPackage("user");
+ //GetGlobalFactory()->UnLoadPackage("user");
}
if(m_Fp)