Program: bbtk
Module: $RCSfile: bbtkConnection.cxx,v $
Language: C++
- Date: $Date: 2008/01/22 15:02:00 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2008/03/18 12:51:26 $
+ Version: $Revision: 1.4 $
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)
{
- bbtkDebugMessageInc("Core",7,"Connection::Connection(\""
+ bbtkDebugMessageInc("Kernel",7,"Connection::Connection(\""
<<from->bbGetName()<<"\",\""<<output<<"\",\""
<<to->bbGetName()<<"\",\""<<input<<"\")"
<<std::endl);
if (to->bbGetInputConnectorMap().find(input)->second->IsConnected())
{
- bbtkError("The input \""<<input<<"\" of the box \""<<to->bbGetTypeName()
+ bbtkError("The input \""<<input<<"\" of the box \""<<to->bbGetName()
<<"\" is already connected");
}
}
else if ( to->bbGetInputType(input) == typeid(Data) )
{
- bbtkDebugMessage("Core",8," -> '"<<input<<"' type is "
+ bbtkDebugMessage("Kernel",8," -> '"<<input<<"' type is "
<<TypeName<Data>()<<" : can receive any data"
<<std::endl);
mToAny = true;
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)
from->bbConnectOutput(output,this);
to->bbConnectInput(input,this);
- bbtkDebugDecTab("Core",7);
+ bbtkDebugDecTab("Kernel",7);
}
//==================================================================
/// Dtor
Connection::~Connection()
{
- bbtkDebugMessageInc("Core",7,
+ bbtkDebugMessageInc("Kernel",7,
"Connection::~Connection() ["
<<GetFullName()<<"]"<<std::endl);
mTo->bbDisconnectInput(mInput,this);
if (mAdaptor) mAdaptor->bbDelete();
- bbtkDebugDecTab("Core",7);
+ bbtkDebugDecTab("Kernel",7);
}
//==================================================================
bbtk::BlackBox* adaptor = 0;
try
{
- adaptor = NewAdaptor(mFrom->bbGetOutput(mOutput).type(),
+ adaptor = mFactory->NewAdaptor(mFrom->bbGetOutput(mOutput).type(),
mTo->bbGetInputType(mInput),
"");
}