X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=kernel%2Fsrc%2FbbtkConnection.cxx;h=2c99b6e2518a8a274b59357c1bfa45eadc2f6c54;hb=6c5d7746e8e4cb0b5d6e164b917008a7137910fb;hp=50496582f7b9f544d80485495029085aea06c4c3;hpb=71376d8384d5d21b5c56d36ecc8cbf31315c039a;p=bbtk.git
diff --git a/kernel/src/bbtkConnection.cxx b/kernel/src/bbtkConnection.cxx
index 5049658..2c99b6e 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/04/08 06:59:30 $
+ Version: $Revision: 1.5 $
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)
{
@@ -61,7 +63,7 @@ namespace bbtk
if (to->bbGetInputConnectorMap().find(input)->second->IsConnected())
{
- bbtkError("The input \""<bbGetTypeName()
+ bbtkError("The input \""<bbGetName()
<<"\" is already connected");
}
@@ -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)
@@ -120,7 +122,13 @@ namespace bbtk
//==================================================================
-
+ void Connection::Clear()
+ {
+ mFrom = 0;
+ mTo = 0;
+ mAdaptor = 0;
+ }
+
//==================================================================
/// Dtor
Connection::~Connection()
@@ -129,8 +137,8 @@ namespace bbtk
"Connection::~Connection() ["
<bbDisconnectOutput(mOutput,this);
- mTo->bbDisconnectInput(mInput,this);
+ if (mFrom) mFrom->bbDisconnectOutput(mOutput,this);
+ if (mTo) mTo->bbDisconnectInput(mInput,this);
if (mAdaptor) mAdaptor->bbDelete();
bbtkDebugDecTab("Kernel",7);
@@ -229,7 +237,7 @@ namespace bbtk
bbtk::BlackBox* adaptor = 0;
try
{
- adaptor = NewAdaptor(mFrom->bbGetOutput(mOutput).type(),
+ adaptor = mFactory->NewAdaptor(mFrom->bbGetOutput(mOutput).type(),
mTo->bbGetInputType(mInput),
"");
}