]> Creatis software - bbtk.git/blob - kernel/src/bbtkConnection.cxx
#3403 vtk8itk5wx3-macos
[bbtk.git] / kernel / src / bbtkConnection.cxx
1 /*
2  # ---------------------------------------------------------------------
3  #
4  # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5  #                        pour la SantÈ)
6  # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7  # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8  # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9  #
10  #  This software is governed by the CeCILL-B license under French law and
11  #  abiding by the rules of distribution of free software. You can  use,
12  #  modify and/ or redistribute the software under the terms of the CeCILL-B
13  #  license as circulated by CEA, CNRS and INRIA at the following URL
14  #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15  #  or in the file LICENSE.txt.
16  #
17  #  As a counterpart to the access to the source code and  rights to copy,
18  #  modify and redistribute granted by the license, users are provided only
19  #  with a limited warranty  and the software's author,  the holder of the
20  #  economic rights,  and the successive licensors  have only  limited
21  #  liability.
22  #
23  #  The fact that you are presently reading this means that you have had
24  #  knowledge of the CeCILL-B license and that you accept its terms.
25  # ------------------------------------------------------------------------ */
26
27
28 /*=========================================================================
29   Program:   bbtk
30   Module:    $RCSfile: bbtkConnection.cxx,v $
31   Language:  C++
32   Date:      $Date: 2012/11/16 08:49:01 $
33   Version:   $Revision: 1.22 $
34 =========================================================================*/
35
36                                                                         
37
38 /**
39  *\file
40  *\brief Class bbtk::Connection
41  */
42
43 #include "bbtkConnection.h"
44 #include "bbtkFactory.h"
45 #include "bbtkBlackBox.h"
46 #include "bbtkMessageManager.h"
47 #include "bbtkBlackBoxOutputConnector.h"
48
49 #define bbtkCMessage(key,level,mess) \
50   bbtkMessage(key,level,"["<<GetFullName()<<"] "<<mess)
51 #define bbtkCDebugMessage(key,level,mess)       \
52   bbtkDebugMessage(key,level,"["<<GetFullName()<<"] "<<mess)
53
54 namespace bbtk
55 {
56   const std::string IOSTATUS_STRING[3] = 
57     {"Up-to-date","Modified","Out-of-date"}; 
58   
59   const std::string& GetIOStatusString(IOStatus s)
60   { return IOSTATUS_STRING[s]; }
61
62   //==================================================================
63   Connection::Pointer Connection::New(BlackBox::Pointer from, 
64                                       const std::string& output,
65                                       BlackBox::Pointer to, 
66                                       const std::string& input ,
67                                       const Factory::Pointer f  )
68   {
69     bbtkDebugMessage("object",1,"##> Connection(\""
70                      <<from->bbGetName()<<"\",\""<<output<<"\",\""
71                      <<to->bbGetName()<<"\",\""<<input<<"\")"
72                      <<std::endl);
73     Connection::Pointer p = 
74       MakePointer(new Connection(from,output,to,input,f));
75     bbtkDebugMessage("object",1,"<## Connection(\""
76                      <<from->bbGetName()<<"\",\""<<output<<"\",\""
77                      <<to->bbGetName()<<"\",\""<<input<<"\")"
78                      <<std::endl);
79     return p;
80   }
81   //==================================================================
82
83   //==================================================================
84   /// Ctor with the black box from and to and their input and output.
85 /// Check the input and output compatibility
86 Connection::Connection(BlackBox::Pointer from, const std::string& output,
87                        BlackBox::Pointer to, const std::string& input ,
88                        const Factory::Pointer f  )
89     : mAdaptor(),
90       mFactory(f),
91       mFromAny(false),
92       mToAny(false)
93   {
94     bbtkDebugMessage("object",2,"==> Connection(\""
95                      <<from->bbGetName()<<"\",\""<<output<<"\",\""
96                      <<to->bbGetName()<<"\",\""<<input<<"\")"
97                      <<std::endl);    
98
99     bbtkDebugMessage("connection",1,"==> Connection(\""
100                      <<from->bbGetName()<<"\",\""<<output<<"\",\""
101                      <<to->bbGetName()<<"\",\""<<input<<"\")"
102                      <<std::endl);    
103
104     
105
106     if (! from->bbHasOutput(output) )
107       {
108         bbtkError("The box \""<<from->bbGetTypeName()<<
109                   "\" has no output \""<<output<<"\"");
110       }
111     if (! to->bbHasInput(input) )
112       {
113         bbtkError("The box \""<<to->bbGetTypeName()<<
114                   "\" has no input \""<<input<<"\"");
115       } 
116
117     if (to->bbGetInputConnectorMap().find(input)->second->IsConnected())
118       {
119         bbtkError("The input \""<<input<<"\" of the box \""<<to->bbGetName()
120                   <<"\" is already connected");
121       }
122
123
124       //EED2021-09-06  dlopen  flags for == !=    ->  bbtkDynamicLibraryHandling.h
125
126     //  std::string t1 ( from->bbGetOutputType(output).name() );
127     //   std::string t2 ( to->bbGetInputType(input).name() );
128     // if  //( t1 != t2 )
129       if ( from->bbGetOutputType(output) != to->bbGetInputType(input) )
130       {
131         if ( from->bbGetOutputType(output) == typeid(Data) )
132           {
133             bbtkWarning("Connection: '"<<from->bbGetName()<<"."<<output
134                         <<"' is of type <"
135                         <<HumanTypeName<Data>()
136                         <<"> : type compatibility with '"
137                         <<to->bbGetName()<<"."<<input
138                         <<"' will be resolved at run time"
139                         );
140             mFromAny = true;
141           } else if (  to->bbGetInputType(input) == typeid(Data) ) {
142             bbtkDebugMessage("kernel",8," -> '"<<input<<"' type is "
143                              <<TypeName<Data>()<<" : can receive any data"
144                              <<std::endl);
145             mToAny = true;
146           }     else  {
147             //   std::cout << "Adaptive connection "<<std::endl;
148             std::string name;
149             name = from->bbGetName() + "." + output + "-" 
150               + to->bbGetName() + "." + input; 
151             mAdaptor = mFactory.lock()
152               ->NewAdaptor(from->bbGetOutputType(output),
153                            to->bbGetInputType(input),
154                            name);
155             if (!mAdaptor)  
156               {  
157                 bbtkError("did not find any <"
158                           <<TypeName(from->bbGetOutputType(output))
159                           <<"> to <"
160                           <<TypeName(to->bbGetInputType(input))
161                           <<"> adaptor");
162               } 
163           }
164       }
165
166
167     mFrom                       = from;
168     mOriginalFrom       = from;
169     mTo                         = to;
170     mOriginalTo         = to;
171     mInput                      = mOriginalInput        = input;
172     mOutput             = mOriginalOutput       = output;
173
174      // Lock this pointer !!!
175     //Pointer p = MakePointer(this,true);
176     from->bbConnectOutput(output,this);
177     to->bbConnectInput(input,this);
178  
179     from->bbGetOutputConnector(output).AddChangeObserver(boost::bind(&bbtk::Connection::OnOutputChange,this, _1, _2, _3));
180
181     
182     bbtkDebugMessage("connection",1,"<== Connection(\""
183                      <<from->bbGetName()<<"\",\""<<output<<"\",\""
184                      <<to->bbGetName()<<"\",\""<<input<<"\")"
185                      <<std::endl);    
186
187     bbtkDebugMessage("object",2,"<== Connection(\""
188                      <<from->bbGetName()<<"\",\""<<output<<"\",\""
189                      <<to->bbGetName()<<"\",\""<<input<<"\")"
190                      <<std::endl);    
191   }
192  //==================================================================
193  
194   //==================================================================
195   Connection::Pointer Connection::New(BlackBox::Pointer from, 
196                                       const std::string& output,
197                                       BlackBox::Pointer to, 
198                                       const std::string& input )
199   {
200     bbtkDebugMessage("object",1,"##> Connection(\""
201                      <<from->bbGetName()<<"\",\""<<output<<"\",\""
202                      <<to->bbGetName()<<"\",\""<<input<<"\")"
203                      <<std::endl);
204     Connection::Pointer p = 
205       MakePointer(new Connection(from,output,to,input));
206     bbtkDebugMessage("object",1,"<## Connection(\""
207                      <<from->bbGetName()<<"\",\""<<output<<"\",\""
208                      <<to->bbGetName()<<"\",\""<<input<<"\")"
209                      <<std::endl);
210     return p;
211   }
212   //==================================================================
213
214   //==================================================================
215   /// Ctor with the black box from and to and their input and output.
216 /// Check the input and output compatibility
217 Connection::Connection(BlackBox::Pointer from, const std::string& output,
218                        BlackBox::Pointer to, const std::string& input )
219   : mAdaptor(),
220       mFactory(),
221       mFromAny(false),
222       mToAny(false)
223   {
224     bbtkDebugMessage("object",2,"==> Connection(\""
225                      <<from->bbGetName()<<"\",\""<<output<<"\",\""
226                      <<to->bbGetName()<<"\",\""<<input<<"\")"
227                      <<std::endl);    
228
229     bbtkDebugMessage("connection",1,"==> Connection(\""
230                      <<from->bbGetName()<<"\",\""<<output<<"\",\""
231                      <<to->bbGetName()<<"\",\""<<input<<"\")"
232                      <<std::endl);    
233
234     
235
236     if (! from->bbHasOutput(output) )
237       {
238         bbtkError("The box \""<<from->bbGetTypeName()<<
239                   "\" has no output \""<<output<<"\"");
240       }
241     if (! to->bbHasInput(input) )
242       {
243         bbtkError("The box \""<<to->bbGetTypeName()<<
244                   "\" has no input \""<<input<<"\"");
245       } 
246
247     if (to->bbGetInputConnectorMap().find(input)->second->IsConnected())
248       {
249         bbtkError("The input \""<<input<<"\" of the box \""<<to->bbGetName()
250                   <<"\" is already connected");
251       }
252     
253     //  std::string t1 ( from->bbGetOutputType(output).name() );
254     //   std::string t2 ( to->bbGetInputType(input).name() );
255     // if  //( t1 != t2 ) 
256     if ( from->bbGetOutputType(output) !=
257          to->bbGetInputType(input) )
258       {
259         if ( from->bbGetOutputType(output) == typeid(Data) )
260           {
261             bbtkWarning("Connection '"
262                         <<GetFullName()
263                         <<"' : '"<<from->bbGetName()<<"."<<output
264                         <<"' is of type <"
265                         <<HumanTypeName<Data>()
266                         <<"> : type compatibility with '"
267                         <<to->bbGetName()<<"."<<input
268                         <<"' will be resolved at run time"
269                         );
270             mFromAny = true;
271           }
272         else if (  to->bbGetInputType(input) == typeid(Data) )
273           {   
274             bbtkDebugMessage("kernel",8," -> '"<<input<<"' type is "
275                              <<TypeName<Data>()<<" : can receive any data"
276                              <<std::endl);
277             mToAny = true;
278           }
279         else 
280           {
281             bbtkError("Connection created between different types without Factory provided");
282           }
283       }
284
285
286     mFrom = from;
287     mOriginalFrom = from;
288     mTo = to;
289     mOriginalTo = to;
290     mInput = mOriginalInput = input;
291     mOutput = mOriginalOutput = output;
292
293      // Lock this pointer !!!
294     //Pointer p = MakePointer(this,true);
295     from->bbConnectOutput(output,this);
296     to->bbConnectInput(input,this);
297
298     from->bbGetOutputConnector(output).AddChangeObserver(boost::bind(&bbtk::Connection::OnOutputChange,this, _1, _2, _3));
299     
300     bbtkDebugMessage("connection",1,"<== Connection(\""
301                      <<from->bbGetName()<<"\",\""<<output<<"\",\""
302                      <<to->bbGetName()<<"\",\""<<input<<"\")"
303                      <<std::endl);    
304
305     bbtkDebugMessage("object",2,"==> Connection(\""
306                      <<from->bbGetName()<<"\",\""<<output<<"\",\""
307                      <<to->bbGetName()<<"\",\""<<input<<"\")"
308                      <<std::endl);    
309   }
310  //==================================================================
311  
312   //==================================================================
313   /// Dtor 
314   Connection::~Connection()
315   {
316     bbtkCDebugMessage("object",4,
317                      "==> ~Connection()"
318                      <<std::endl);
319
320     if (mAdaptor) mAdaptor.reset();
321     if (mFrom!=0) 
322       {
323         mFrom->bbDisconnectOutput(mOutput,this);
324         //                                GetThisPointer<Connection>());
325         mFrom.reset();
326       }
327     else 
328       {
329         bbtkInternalError("~Connection() : invalid initial box pointer");
330       }
331     if (mTo!=0) 
332       {
333         mTo->bbDisconnectInput(mInput,this);//   GetThisPointer<Connection>());
334         mTo.reset();
335       }
336     else 
337       {
338         bbtkInternalError("~Connection() : invalid final box pointer");
339       }
340
341
342     bbtkCDebugMessage("object",4,
343                       "<== ~Connection()"
344                       <<std::endl);
345   }
346   //==================================================================
347   
348   //==================================================================
349   /// Recursive execution
350   void Connection::RecursiveExecute()
351   {
352     bbtkCDebugMessage("process",4,
353                       "===> Connection::RecursiveExecute()"
354                       <<std::endl);
355
356     /*
357     // If box from already executing : nothing to do
358     if (mFrom->bbGetExecuting()) 
359       {
360         bbtkDebugMessage("process",3,
361                          " -> "<<mFrom->bbGetName()
362                          <<" already executing : abort"<<std::endl);
363         return; 
364
365       }
366     */
367
368     mFrom->bbRecursiveExecute(GetThisPointer<Connection>());
369
370     TransferData();
371
372     // Transfer status
373     IOStatus s = MODIFIED;
374     if ( mFrom->bbGetOutputConnector(mOutput).GetStatus() == OUTOFDATE) 
375       {
376         s = OUTOFDATE;
377       }
378     mTo->bbGetInputConnector(mInput).SetStatus(s);
379     
380     bbtkCDebugMessage("process",4,
381                      " --> '"<<mTo->bbGetName()<<"."<<mInput
382                      <<" ["<<&mTo->bbGetInputConnector(mInput)<<"] "
383                      <<"' new status '"
384                      <<GetIOStatusString(s)
385                      <<"'"
386                      << std::endl);
387
388     bbtkCDebugMessage("process",4,
389                      "<=== Connection::RecursiveExecute()"
390                       <<std::endl);
391     return; 
392   }
393   //==================================================================
394
395
396
397   //==================================================================
398   /// Transfers the data from the source output to the target input
399   /// doing necessary conversions (adaptation or pointer cast)
400   void Connection::TransferData()
401   {
402     bbtkCDebugMessage("data",3,
403                       "Connection::TransferData()"
404                       <<std::endl);
405     
406     
407     // If an adaptor was created we need to adapt the data
408     if (mAdaptor) 
409       {
410         mAdaptor->bbSetInput("In",mFrom->bbGetOutput(mOutput),false);
411         mAdaptor->bbExecute();
412         // LG : Connection Update does not set mTo as modified
413         mTo->bbSetInput(mInput, mAdaptor->bbGetOutput("Out"),false);
414         
415       }
416     // If no adaptor but source type is an any and target is not an any
417     else if ( mFromAny && (! mToAny) )
418       {
419         bbtkCDebugMessage("data",3,
420                          " * Source type is an "
421                          <<HumanTypeName<Data>()
422                          <<" which contains a <"
423                          <<HumanTypeName(mFrom->bbGetOutput(mOutput).type())
424                          <<">"<<std::endl);
425         bbtkCDebugMessage("data",3,
426                          " * Target type is <"
427                          <<HumanTypeName(mTo->bbGetInputType(mInput))
428                          <<">"<<std::endl);
429         
430         // 0) If from any contents void : nothing to do 
431         if (mFrom->bbGetOutput(mOutput).type() == typeid(void)) 
432           {
433             bbtkCDebugMessage("data",3,
434                              " -> Source is void : nothing to transfer!"<<std::endl);
435           }
436         // 1) Test strict type matching between any content and target
437         else if (mFrom->bbGetOutput(mOutput)
438             .contains( mTo->bbGetInputType(mInput) ) )
439           {
440             bbtkCDebugMessage("data",3,
441                              " -> Equal types : transfer ok"<<std::endl);
442             mTo->bbSetInput( mInput, 
443                              mFrom->bbGetOutput(mOutput),
444                              false);
445           }
446         else 
447           {
448             // 2) Look for an adaptor
449             bbtk::BlackBox::Pointer adaptor;
450             try 
451               {
452                 adaptor = mFactory.lock()
453                   ->NewAdaptor(mFrom->bbGetOutput(mOutput).type(),
454                                mTo->bbGetInputType(mInput),
455                                "");
456               }
457             catch (...)
458               {
459               }
460             if (adaptor)  
461               {
462                 bbtkCDebugMessage("data",3," -> Adaptor found : using it"
463                                  <<std::endl);
464                   adaptor->bbSetInput("In",mFrom->bbGetOutput(mOutput),false);
465                 adaptor->bbExecute();
466                 // LG : Connection Update does not set mTo as modified
467                 mTo->bbSetInput(mInput, adaptor->bbGetOutput("Out"),false);
468                 //      adaptor->bbDelete();
469               }
470             // 3) If no adaptor found but the any content is a pointer
471             //    and target type is also a pointer : we try run-time cast
472             else if ( (mFrom->bbGetOutput(mOutput).contains_pointer()) &&
473                       (mTo->bbGetDescriptor()->GetInputDescriptor(mInput)
474                        ->IsPointerType()) )
475               {
476                 bbtkCDebugMessage("data",3,
477                                  " -> No adaptor found but source and target types are both pointers : trying up or down cast"<<std::endl);
478                 
479                 void* nptr = 
480                   mFrom->bbGetOutput(mOutput)
481                   .get_pointer_to(mTo->bbGetInput(mInput).pointed_type());
482                 if (!nptr)  
483                   {
484                     bbtkError("Connection '"
485                               <<GetFullName()
486                               <<"' : <"
487                               <<HumanTypeName(mFrom->bbGetOutput(mOutput).type())
488                               <<"> to <"
489                               <<HumanTypeName(mTo->bbGetInputType(mInput))
490                               <<"> : no adaptor available and run-time up and down cast failed");
491                   }
492                 mTo->bbBruteForceSetInputPointer(mInput, nptr, false);
493               }
494             // 4) Nothing worked : error
495             else 
496               {
497                 bbtkError("Connection '"<<GetFullName()<<"' "
498                           <<"no adaptor found to convert <"
499                           <<HumanTypeName(mFrom->bbGetOutput(mOutput).type())
500                           <<"> to <"
501                           <<HumanTypeName(mTo->bbGetInputType(mInput))<<">");
502               }
503           }
504       }
505     // EO : mFromAny && ! mToAny
506     // Default case : types are the same; we use simple get-set
507     else 
508       {
509         // LG : Connection Update does not set mTo as modified
510         mTo->bbSetInput(mInput, mFrom->bbGetOutput(mOutput),false);
511       }
512   }
513   //==================================================================
514
515   //==================================================================
516   /// From.Output change propagation
517   void Connection::OnOutputChange(bbtk::BlackBox::Pointer, const std::string&, 
518                                   IOStatus status)
519   {
520     bbtkCDebugMessage("change",2,
521                      "==> Connection::OnOutputChange("
522                      <<GetIOStatusString(status)<<")"
523                      <<std::endl);
524     if (mAdaptor) 
525       {
526             BlackBoxInputConnector* ac = mAdaptor->bbGetInputConnectorMap().find("In")->second;
527             mAdaptor->bbSetStatusAndPropagate(ac,status);
528       }
529     
530     mTo->bbSetStatusAndPropagate( mTo->bbGetInputConnectorMap().find(mInput)->second, status);
531     
532  
533   }
534   //==================================================================
535
536   
537   //==================================================================
538   std::string Connection::GetFullName() const {
539     if (mFrom && mTo) 
540       {
541         std::string res = mFrom->bbGetName()+"."+mOutput+"--"
542           +mTo->bbGetName()+"."+mInput;
543         if ((!mOriginalFrom.expired()) && (!mOriginalTo.expired()) &&
544             ((mFrom!=mOriginalFrom.lock())||(mTo!=mOriginalTo.lock())))
545           {
546             res += "("+mOriginalFrom.lock()->bbGetName()
547               +"."+mOriginalOutput+"--"
548               + mOriginalTo.lock()->bbGetName()+"."+mOriginalInput+")";
549           }
550         return res;
551       }
552     return "***Invalid Connection***";
553   }
554   //==================================================================
555
556   //==================================================================
557   void Connection::Check() const
558   {
559     bbtkMessage("debug",1,"** Checking Connection "<<(void*)this<<" ["
560                 <<GetFullName()<<"]"
561                 <<std::endl);
562     if (mFrom==0) 
563       {
564         bbtkMessage("debug",2," - From = 0"<<std::endl);
565       }
566     else
567       {
568         bbtkMessage("debug",2," - From : "<<mFrom->bbGetName()<<std::endl);
569         if (!mFrom->bbHasOutput(mOutput))
570           {
571             bbtkError("** Checking Connection "<<(void*)this
572                        <<" ["<<GetFullName()<<"] : "
573                       << mFrom->bbGetName()<<" does not have output '"
574                       <<mOutput<<"'");
575           }     
576         bbtkMessage("debug",2," - From : Output '"<<mOutput<<"' exists"<<std::endl);
577         BlackBox::OutputConnectorMapType::const_iterator i 
578           = mFrom->bbGetOutputConnectorMap().find(mOutput);
579         if (i== mFrom->bbGetOutputConnectorMap().end())
580           {
581              bbtkError("** Checking Connection "<<(void*)this
582                        <<" ["<<GetFullName()<<"] : "
583                        <<mFrom->bbGetName()<<" output '"
584                        <<mOutput<<"' is not in OutputConnectorMap");
585           }
586         bbtkMessage("debug",2," - From : Output '"<<mOutput
587                     <<"' is in OutputConnectorMap"<<std::endl);
588
589         std::vector< Connection* >::const_iterator j;
590         /*
591         for (j  = i->second->GetConnectionVector().begin();
592              j != i->second->GetConnectionVector().end();
593              ++j)
594           {
595             if ((*j)==this) break;
596           }
597         */
598         j = find(i->second->GetConnectionVector().begin(),
599                  i->second->GetConnectionVector().end(),
600                  this);
601        
602         if (j==i->second->GetConnectionVector().end())
603           {
604             bbtkError("** Checking Connection "<<(void*)this
605                       <<" ["<<GetFullName()<<"] : "
606                       <<" OutputConnector '"
607                       <<mOutput<<"' of "<<mFrom->bbGetName()
608                       <<" does not point to this connection");
609             
610           }
611         bbtkMessage("debug",2," - From : This connection is in OutputConnector connection vector"<<std::endl);
612         bbtkMessage("debug",2," * Box from : Check successfull"<<std::endl);
613
614       }
615
616     if (mTo==0) 
617       {
618         bbtkMessage("debug",2," - To   = 0"<<std::endl);
619       }
620     else
621       {
622         bbtkMessage("debug",2," - To   : "<<mTo->bbGetName()<<std::endl);
623         //      std::cout << mTo << std::endl;
624         //      std::cout << mTo->bbGetDescriptor() << std::endl;
625         //      std::cout << mTo->bbGetDescriptor()->GetTypeName() << std::endl;
626         //      mTo->bbGetName();
627         bbtkMessage("debug",2," - To   : "<<mTo->bbGetName()<<std::endl);
628         if (!mTo->bbHasInput(mInput))
629           {
630             bbtkError("** Checking Connection "<<(void*)this
631                       <<" ["<<GetFullName()<<"] : "
632                       <<mTo->bbGetName()<<" does not have input '"
633                       <<mInput<<"'");
634           }     
635         bbtkMessage("debug",2," - To   : Input '"<<mInput<<"' exists"<<std::endl);
636         BlackBox::InputConnectorMapType::const_iterator i 
637           = mTo->bbGetInputConnectorMap().find(mInput);
638         if (i== mTo->bbGetInputConnectorMap().end())
639           {
640              bbtkError("** Checking Connection "<<(void*)this
641                        <<" ["<<GetFullName()<<"] : "
642                        <<mTo->bbGetName()<<" input '"
643                        <<mInput<<"' is not in InputConnectorMap");
644           }
645         bbtkMessage("debug",2," - To   : Input '"<<mInput
646                     <<"' is in InputConnectorMap"<<std::endl);
647
648         if (i->second->GetConnection()==0)
649           {
650             bbtkError("** Checking Connection "<<(void*)this
651                       <<" ["<<GetFullName()<<"] : "
652                       <<" InputConnector '"
653                       <<mInput<<"' of "<<mTo->bbGetName()
654                       <<" does not point to this connection");
655     
656           }
657         bbtkMessage("debug",2," - To   : This connection is in InputConnector connection vector"<<std::endl);
658         bbtkMessage("debug",2," * Box to   : Check successfull"<<std::endl);
659
660       }
661   }
662   //==================================================================
663  //==========================================================================
664   std::string Connection::GetObjectName() const
665   {
666     std::string s("Connection '");
667     s += GetFullName();
668     s += "'";
669     return s;
670   }
671   //==========================================================================
672   
673   //==========================================================================
674   std::string  Connection::GetObjectInfo() const 
675   {
676     std::stringstream i;
677     return i.str();
678   }
679   //==========================================================================
680
681  //==========================================================================
682 size_t  Connection::GetObjectSize() const 
683 {
684   size_t s = Superclass::GetObjectSize();
685   s += Connection::GetObjectInternalSize();
686   return s;
687   }
688   //==========================================================================
689   //==========================================================================
690 size_t  Connection::GetObjectInternalSize() const 
691 {
692   size_t s = sizeof(Connection);
693   return s;
694   }
695   //==========================================================================
696   //==========================================================================
697   size_t  Connection::GetObjectRecursiveSize() const 
698   {
699     size_t s = Superclass::GetObjectRecursiveSize();
700     s += Connection::GetObjectInternalSize();
701     return s;
702   }
703   //==========================================================================
704
705 }// namespace bbtk
706
707
708
709
710