]> Creatis software - bbtk.git/blob - kernel/src/bbtkComplexBlackBoxDescriptor.cxx
#3508 ConcatString_tool Reactivity 2
[bbtk.git] / kernel / src / bbtkComplexBlackBoxDescriptor.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: bbtkComplexBlackBoxDescriptor.cxx,v $
31   Language:  C++
32   Date:      $Date: 2012/11/16 08:49:01 $
33   Version:   $Revision: 1.23 $
34 =========================================================================*/
35
36                                                                     
37   
38
39 /**
40  *  \file 
41  *  \brief Class bbtk::ComplexBlackBoxDescriptor : describes a ComplexBlackBox (constituents, connections) and is able to create an instance of it.
42  */
43 #include "bbtkComplexBlackBoxDescriptor.h"
44 #include "bbtkComplexBlackBox.h"
45 //#include "bbtkFactory.h"
46 #include "bbtkMessageManager.h"
47 #include "bbtkUtilities.h"
48
49 #define bbtkDMessage(key,level,mess) \
50   bbtkMessage(key,level,"["<<GetFullTypeName()<<"] "<<mess)
51 #define bbtkDDebugMessage(key,level,mess)       \
52   bbtkDebugMessage(key,level,"["<<GetFullTypeName()<<"] "<<mess)
53
54 namespace bbtk
55 {
56    //=======================================================================
57   /// 
58   ComplexBlackBoxDescriptor::Pointer 
59   ComplexBlackBoxDescriptor::New(const std::string& name)
60   {
61     bbtkDebugMessage("object",1,"##> ComplexBlackBoxDescriptor::New(\""<<name<<"\")"<<std::endl);
62     ComplexBlackBoxDescriptor::Pointer p = 
63       MakePointer(new ComplexBlackBoxDescriptor(name));
64     bbtkDebugMessage("object",1,"<## ComplexBlackBoxDescriptor::New(\""<<name<<"\")"<<std::endl);
65     return p;
66   }
67   //=======================================================================
68
69   //=======================================================================
70   /// Default ctor
71   ComplexBlackBoxDescriptor::ComplexBlackBoxDescriptor(const std::string& name)
72   {
73     bbtkDDebugMessage("object",2,"==> ComplexBlackBoxDescriptor(\""<<name<<"\")"<<std::endl);
74         SetTypeOfScript(TS_SCRIPT_COMPLEXBOX);
75     SetTypeName(name);
76     AddToCategory("complex box");
77     mPrototype = ComplexBlackBox::New(name+std::string("Prototype"),
78                                       MakePointer(this,true));
79     mPrototype->SetAsPrototype();
80     bbtkDDebugMessage("object",2,"<== ComplexBlackBoxDescriptor(\""<<name<<"\")"<<std::endl);
81   }
82   //=======================================================================
83
84
85
86   //=======================================================================
87   /// Default dtor
88   ComplexBlackBoxDescriptor::~ComplexBlackBoxDescriptor()
89   {
90     bbtkDDebugMessage("object",2,"==> ~ComplexBlackBoxDescriptor()"<<std::endl);
91     mPrototype.reset();
92     bbtkDDebugMessage("object",2,"<== ~ComplexBlackBoxDescriptor()"<<std::endl);
93   }
94   //=======================================================================
95
96   //=========================================================================
97   /// Check
98   void ComplexBlackBoxDescriptor::Check(bool recursive) const
99   {
100     mPrototype->Check(recursive);
101   }
102   //=========================================================================
103
104   //=======================================================================
105   /// Creates an instance of name <name> of the ComplexBlackBox of which this is the descriptor 
106   BlackBox::Pointer 
107   ComplexBlackBoxDescriptor::NewBlackBox(const std::string& name)
108   {
109     bbtkDDebugMessage("kernel",5,
110                       "ComplexBlackBoxDescriptor::NewBlackBox(\""
111                       <<name<<"\")"
112                       <<std::endl);
113     
114     return mPrototype->bbClone(name);
115
116
117   }
118   //=======================================================================
119
120   /*
121   //=======================================================================
122   /// Release
123   void ComplexBlackBoxDescriptor::Release(bool release_package)
124   {
125   }
126   //=======================================================================
127   */
128
129   //=======================================================================
130   /// Adds a black box to the complex box
131   void ComplexBlackBoxDescriptor::Add ( const std::string& type,
132                                         const std::string& name
133                                         )
134   {
135     bbtkDDebugMessage("kernel",5,
136                         "ComplexBlackBoxDescriptor::Add(\""
137                         <<type<<"\",\""<<name<<"\")"
138                         <<std::endl);
139     
140     // 
141     if (!GetFactory()) 
142       { 
143         bbtkError("ComplexBlackBoxDescriptor::Add : no factory set");
144       }
145     
146     // Verify that a box with the same name does not exist already
147     if ( mPrototype->bbUnsafeGetBlackBox( name ) ) 
148       {
149         bbtkError("a black box \""<<name<<"\" already exists");
150       }
151     // ok : create new one
152     mPrototype->bbAddBlackBox ( GetFactory()->NewBlackBox(type,name) );
153
154
155   }
156   //=======================================================================
157   
158   //=======================================================================
159   /// Removes a black box from the complex box
160   void ComplexBlackBoxDescriptor::Remove( const std::string& name, 
161                                           bool remove_connections)
162   {    
163     mPrototype->bbRemoveBlackBox(name,remove_connections);
164   }
165   //=======================================================================
166
167
168   //=======================================================================
169   /// Adds a black box to the execution list 
170   void ComplexBlackBoxDescriptor::AddToExecutionList ( const std::string& box)
171   {
172     bbtkDDebugMessage("kernel",5,
173                       "ComplexBlackBoxDescriptor::AddToExecutionList(\""
174                       <<box<<"\""
175                       <<std::endl);
176     // Verify that the box exists
177     BlackBox::Pointer b = mPrototype->bbUnsafeGetBlackBox( box ); 
178     if ( !b ) 
179       {
180         bbtkError("the black box \""<<box<<"\" does not exist");
181       }
182     // ok 
183     mPrototype->bbAddToExecutionList ( box  );
184
185
186     }
187
188
189   //=======================================================================
190   /// Connects two black boxes of the complex box
191   void ComplexBlackBoxDescriptor::Connect ( const std::string& from,
192                                             const std::string& output,
193                                             const std::string& to,
194                                             const std::string& input
195                                             )
196   {
197     bbtkDDebugMessage("kernel",5,
198                         "ComplexBlackBoxDescriptor::Connect(\""
199                         <<from<<"\",\""<<output<<"\",\""
200                         <<to<<"\",\""<<input
201                         <<"\")"
202                         <<std::endl);
203   // 
204     if (!GetFactory()) 
205     {
206         bbtkError("ComplexBlackBoxDescriptor::Connect : no factory set");
207     }
208     
209   // Verify that a box with the same name does not exist already
210     BlackBox::Pointer bbfrom = mPrototype->bbGetBlackBox( from );
211     if ( !bbfrom ) 
212     {
213         bbtkError("the black box \""<<from<<"\" does not exist");
214     }
215     BlackBox::Pointer bbto = mPrototype->bbGetBlackBox( to );
216     if ( !bbto ) 
217     {
218         bbtkError("the black box \""<<to<<"\" does not exist");
219     }
220     Connection::Pointer c = GetFactory()->NewConnection( bbfrom, output, bbto, input );
221     mPrototype->bbAddConnection(c);
222   }
223   //=======================================================================
224
225
226   //=======================================================================
227   /// Defines an input of the complex box
228   void ComplexBlackBoxDescriptor::DefineInput ( const std::string& name,
229                                                 const std::string& box,
230                                                 const std::string& input,
231                                                 const std::string& help)
232   {
233     bbtkDDebugMessage("kernel",5,
234                         "ComplexBlackBoxDescriptor::DefineInput(\""
235                         <<name<<"\",\""<<box<<"\",\""
236                         <<input<<"\",\""<<help
237                         <<"\")"
238                         <<std::endl);
239
240     BlackBox::Pointer bb = mPrototype->bbGetBlackBox( box );
241     if ( !bb ) 
242       {
243         bbtkError("the black box \""<<box<<"\" does not exist");
244       }
245
246     if (!bb->bbHasInput(input) )
247       {
248         bbtkError("the black box \""<<box<<"\" does not have input \""
249                   <<input<<"\"");
250       }
251     
252     const BlackBoxInputDescriptor* d = 
253       bb->bbGetDescriptor()->GetInputDescriptor(input);
254     AddInputDescriptor ( new ComplexBlackBoxInputDescriptor 
255                          ( typeid(ComplexBlackBoxDescriptor),
256                            name,
257                            help,
258                            d->GetNature(),
259                            box,
260                            input,
261                            d->GetTypeInfo()));
262     
263     
264
265   }
266   //=======================================================================
267
268   //=======================================================================
269   /// Defines an output of the complex box
270   void ComplexBlackBoxDescriptor::DefineOutput ( const std::string& name,
271                                                  const std::string& box,
272                                                  const std::string& output,
273                                                  const std::string& help)
274   {
275     bbtkDDebugMessage("kernel",5,
276                         "ComplexBlackBoxDescriptor::DefineOutput(\""
277                         <<name<<"\",\""<<box<<"\",\""
278                         <<output<<"\",\""<<help
279                         <<"\")"
280                         <<std::endl);
281
282     BlackBox::Pointer bb = mPrototype->bbGetBlackBox( box );
283     if ( !bb ) 
284       {
285         bbtkError("the black box \""<<box<<"\" does not exist");
286       }
287
288     if (!bb->bbHasOutput(output) )
289       {
290         bbtkError("the black box \""<<box<<"\" does not have output \""
291                   <<output<<"\"");
292       }
293     
294     const BlackBoxOutputDescriptor* d = 
295       bb->bbGetDescriptor()->GetOutputDescriptor(output);
296     AddOutputDescriptor ( new ComplexBlackBoxOutputDescriptor 
297                           ( typeid(ComplexBlackBoxDescriptor),
298                             name,
299                             help,
300                             d->GetNature(),
301                             box,
302                             output,
303                             d->GetTypeInfo()));
304     
305     
306
307   }
308   //=======================================================================
309
310   //=======================================================================
311   void ComplexBlackBoxDescriptor::PrintBlackBoxes()
312   {
313     mPrototype->bbPrintBlackBoxes(); 
314   }
315   //=======================================================================
316
317
318   //=======================================================================
319   void ComplexBlackBoxDescriptor::InsertHTMLGraph( std::ofstream& s , 
320                                                    int detail, int level, 
321                                                    const std::string& output_dir, bool relative_link )   
322   {
323     this->mPrototype->bbInsertHTMLGraph( s, 
324                                          detail, level, 
325                                          false, 
326                                          output_dir,
327                                          relative_link );
328   }
329   //=======================================================================
330
331   //=========================================================================
332   void ComplexBlackBoxDescriptor::InsertHtmlHelp ( std::ofstream& s, 
333                                                    int detail, int level,
334                                                    const std::string& output_dir, bool relative_link)
335   {
336     bbtkDDebugMessage("kernel",9,
337                       "ComplexBlackBoxDescriptor::InsertHtmlHelp()"
338                        <<std::endl);
339     
340     //-------------
341     // General info 
342     std::string name = GetTypeName();
343     Utilities::html_format(name);
344
345     //   std::ofstream* s = &s1;
346
347     (s) << "<p><hr>\n";
348     (s) << "<a name=\""<<name<<"\"></a>\n";
349     (s) << //"Top:&nbsp;
350       "<a rel=\"top\" accesskey=\"t\" href=\"#Top\">Top</a>\n";
351     // (s) << "Previous:&nbsp;<a rel="previous" accesskey="p" href="#dir">(dir)</a>,
352     // (s) << "Up:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
353     (s) << "<h2 class=\"section\">"<<name<<"</h2>\n";
354
355
356     std::string descr = GetDescription();
357     //Utilities::html_format(descr);
358     
359     std::string author = GetAuthor();
360     Utilities::html_format(author);
361     
362     std::vector<std::string> categories;
363     // Split the category string 
364     std::string delimiters = ";,";
365     Utilities::SplitString(GetCategory(),
366                            delimiters,categories);
367
368         
369     (s) << "<p><TABLE cellspacing=0  cellpadding=3>\n";
370     (s) << "<TR><TD style='vertical-align: top;'><b> Description </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'> " 
371         << descr << "</TD></TR>\n";
372
373     (s) << "<TR><TD style='vertical-align: top;'><b> Author(s) </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'>  " 
374         << author << "</TD></TR>\n";
375
376     (s) << "<TR><TD style='vertical-align: top;'><b> Category(s) </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'>  ";
377     std::vector<std::string>::iterator ci;
378     for (ci=categories.begin(); ci!=categories.end(); ++ci)
379       {
380         s << "<a href=\"../index-category.html#"<< *ci <<"\">" << *ci 
381           << "</a>&nbsp;\n";
382       }
383     s << "</TD></TR>\n";      
384     std::string inc = GetScriptFileName();
385     if (inc.size()>0) 
386       {
387         s << "<TR><TD style='vertical-align: top;'><b> To use it </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'> include ";
388         // s << inc << "&nbsp;&nbsp;<a href=\"../../../bbs/"<<inc<<"\">[source]</a>";
389         // LG TODO : USE PACKAGE BBS PATH
390         s << inc << "&nbsp;&nbsp;<a href=\""<<inc<<"\">[source]</a>";
391         s << "</TD></TR>\n";
392         
393       }
394     
395     const ComplexBlackBox::BlackBoxMapType& B = mPrototype->bbGetBlackBoxMap();
396         
397     if (B.size()) 
398     {
399            (s) << "<TR><TD style='vertical-align: top;'><b> Uses </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'>  ";
400
401            std::set<BlackBoxDescriptor::Pointer> pdeps;
402            ComplexBlackBox::BlackBoxMapType::const_iterator b;
403            for ( b = B.begin(); b != B.end(); ++b ) 
404            {
405              BlackBoxDescriptor::Pointer d = b->second->bbGetDescriptor();
406               if (pdeps.find(d) != pdeps.end()) 
407             continue;
408               pdeps.insert(d);
409
410               Package::Pointer p = d->GetPackage();
411             
412               std::string name = b->second->bbGetTypeName();
413                                 
414               std::string url;
415               if (relative_link) 
416                  url = p->GetDocRelativeURL();
417               else 
418                  url = p->GetDocURL();
419                    
420               s << "<a href=\"" <<url<<"#"<<name<<"\">" 
421                 << p->GetName()<<"::"<<name<<"</a>\n";
422             }   // for
423         
424             (s) << "</TD></TR>\n";
425
426      } // If B.size
427
428      (s) << "</TABLE>\n";
429
430  
431    //-------------
432     // Graph
433     InsertHTMLGraph( s , detail,level, output_dir, relative_link);
434     
435     //-------------
436     // Inputs
437     std::string col("#CCCCFF");
438     
439     //  (s) << "<h3 class=\"subsection\">Inputs</h3>\n";
440     (s) << "<p><TABLE border=1 cellspacing=0 cellpadding=3>\n";
441     (s) << "<TR><TD colspan=3 align=center bgcolor=\""<<col
442       <<"\">Inputs</TD></TR>\n";
443     const BlackBoxDescriptor::InputDescriptorMapType& imap = 
444       GetInputDescriptorMap();
445     
446     InputDescriptorMapType::const_iterator in;
447     
448     for ( in = imap.begin();  in != imap.end(); ++in ) 
449       {
450         std::string name(in->second->GetName());
451         Utilities::html_format(name);
452         
453         std::string type("<");
454         type += in->second->GetTypeName();    
455         type += ">";
456         Utilities::html_format(type);
457         
458         std::string descr(in->second->GetDescription());
459         //Utilities::html_format(descr);
460
461 /*EED 10/11/2009
462         (s) << "<TR><TD style='vertical-align: top;'><B><PRE> "<<name<<" </PRE></B></TD>"
463           << "<TD style='vertical-align: top;'><I><PRE> "<<type<<" </PRE></I></TD>"
464           << "<TD style='vertical-align: top;'>"<<descr<<"</TD></TR>\n";
465 */
466
467         (s) << "<TR><TD style='vertical-align: top;'><B><PRE> "<<name<<" </PRE></B></TD>"
468           << "<TD style='vertical-align: top;'><I><PRE> "<<descr<<" </PRE></I></TD>"
469           << "<TD style='vertical-align: top;'>"<<type<<"</TD></TR>\n";
470         
471       }
472     //  (s) << "</TABLE>\n";
473     
474     
475     //-------------
476     // Outputs
477     //  (s) << "<h3 class=\"subsection\">Outputs</h3>\n";
478     //  (s) << "<TABLE border=1 cellspacing=0>\n";
479     (s) << "<TR><TD colspan=3 align=center bgcolor=\""<<col
480       <<"\">Outputs</TD></TR>\n";
481     
482     const BlackBoxDescriptor::OutputDescriptorMapType& omap = 
483       GetOutputDescriptorMap();
484     
485     BlackBoxDescriptor::OutputDescriptorMapType::const_iterator o;
486     
487     for ( o = omap.begin();  o != omap.end(); ++o ) 
488       {
489         std::string name(o->second->GetName());
490         Utilities::html_format(name);
491         
492         std::string type("<");
493         type += o->second->GetTypeName();    
494         type += ">";
495         Utilities::html_format(type);
496         
497         std::string descr(o->second->GetDescription());
498         //Utilities::html_format(descr);
499         
500 /*EED 10/11/2009
501         (s) << "<TR><TD style='vertical-align: top;'><B><PRE> "<<name<<" </PRE></B></TD>"
502           << "<TD style='vertical-align: top;'><I><PRE> "<<type<<" </PRE></I></TD>"
503           << "<TD style='vertical-align: top;'>"<<descr<<"</TD></TR>\n";
504 */      
505         (s) << "<TR><TD style='vertical-align: top;'><B><PRE> "<<name<<" </PRE></B></TD>"
506           << "<TD style='vertical-align: top;'><I><PRE> "<<descr<<" </PRE></I></TD>"
507           << "<TD style='vertical-align: top;'>"<<type<<"</TD></TR>\n";
508
509       }
510     (s) << "</TABLE>\n";
511
512     //------------
513     // End
514
515
516    }
517   //=========================================================================
518  
519
520   //=======================================================================
521   void ComplexBlackBoxDescriptor::GetHelp(bool full) const
522   {
523     if (full) bbtkMessage("help",1,"Complex Black Box <"<<
524                           GetPackage()->GetName()<<"::"
525                           <<GetTypeName()<<">"<<std::endl);
526     bbtkMessage("help",1," "                << GetDescription() <<std::endl);
527     bbtkMessage("help",1," By : "           << GetAuthor()      <<std::endl);
528     bbtkMessage("help",1," Category(s) : "  << GetCategory()     <<std::endl);    
529     if (mInput.size()) 
530       bbtkMessage("help",1," * Inputs : "<<std::endl);
531     else 
532       bbtkMessage("help",1," * No inputs"<<std::endl);
533     InputDescriptorMapType::const_iterator i;
534     unsigned int namelmax = 0;
535     unsigned int typelmax = 0;
536     unsigned int natlmax = 0;
537     for ( i = mInput.begin();  i != mInput.end(); ++i ) 
538     {
539            if (i->second->GetName().size()>namelmax) 
540              namelmax = i->second->GetName().size();
541            if (i->second->GetTypeName().size()>typelmax) 
542              typelmax = i->second->GetTypeName().size();
543            if (i->second->GetNature().size()>natlmax) 
544              natlmax = i->second->GetNature().size();
545     }
546     OutputDescriptorMapType::const_iterator o;
547     if (full) 
548     {
549            for ( o = mOutput.begin();  o != mOutput.end(); ++o ) 
550            {
551              if (o->second->GetName().size()>namelmax) 
552                namelmax = o->second->GetName().size();
553             if (o->second->GetTypeName().size()>typelmax) 
554                typelmax = o->second->GetTypeName().size();
555            if (o->second->GetNature().size()>natlmax) 
556              natlmax = o->second->GetNature().size();
557            }
558     }
559     //
560
561     for ( i = mInput.begin();  i != mInput.end(); ++i ) 
562     {
563            std::string name(i->second->GetName());
564            name += "'";
565            name.append(1+namelmax-name.size(),' ');
566            std::string type(i->second->GetTypeName());
567            type += ">";
568            type.append(1+typelmax-type.size(),' ');
569            std::string nature(i->second->GetNature());
570            nature += "]";
571            nature.append(1+natlmax-nature.size(),' ');
572            bbtkMessage("help",1,
573                        "    '"<<name
574                        <<" <"<<type
575                        <<" ["<<nature
576                        <<" : "<<i->second->GetDescription()<<std::endl);
577     }
578     if (full) 
579     {
580            if (mOutput.size()) 
581              bbtkMessage("help",1," * Outputs : "<<std::endl);
582            else 
583              bbtkMessage("help",1," * No outputs"<<std::endl);
584            for ( o = mOutput.begin();  o != mOutput.end(); ++o ) 
585            {
586              std::string name(o->second->GetName());
587              name += "'";
588              name.append(1+namelmax-name.size(),' ');
589              std::string type(o->second->GetTypeName());
590              type += ">";
591              type.append(1+typelmax-type.size(),' ');
592              std::string nature(o->second->GetNature());
593              nature += "]";
594              nature.append(1+natlmax-nature.size(),' ');
595              bbtkMessage("help",1,
596                        "    '"<<name
597                          <<" <"<<type
598                          <<" ["<<nature
599                          <<" : "<<o->second->GetDescription()<<std::endl);
600            }
601     }
602     if (full) 
603     {
604            const ComplexBlackBox::BlackBoxMapType& B = mPrototype->bbGetBlackBoxMap();
605         
606            if (B.size()) 
607              bbtkMessage("help",1," * Boxes : "<<std::endl);
608            else 
609              bbtkMessage("help",1," * No boxes"<<std::endl);
610         
611            ComplexBlackBox::BlackBoxMapType::const_iterator b;
612            for ( b = B.begin(); b != B.end(); ++b ) 
613            {
614              bbtkMessage("help",1,"    '"<<b->second->bbGetName()<<
615                          "' <"
616                          << b->second->bbGetDescriptor()->GetPackage()->GetName() 
617                          <<"::"
618                          <<b->second->bbGetTypeName()<<">"<<std::endl);
619            }
620     }
621
622   }   
623   //=======================================================================
624
625   //==========================================================================
626   std::string ComplexBlackBoxDescriptor::GetObjectName() const
627   {
628     return std::string("ComplexBlackBoxDescriptor '")+GetFullTypeName()
629       +std::string("'");
630   }
631   //==========================================================================
632   //=======================================================================
633   std::string ComplexBlackBoxDescriptor::GetObjectInfo() const
634   {
635     std::string i;
636     return i;     
637   }
638   //=======================================================================
639  //==========================================================================
640 size_t  ComplexBlackBoxDescriptor::GetObjectSize() const 
641 {
642   size_t s = Superclass::GetObjectSize();
643   s += ComplexBlackBoxDescriptor::GetObjectInternalSize();
644   return s;
645   }
646   //==========================================================================
647   //==========================================================================
648 size_t  ComplexBlackBoxDescriptor::GetObjectInternalSize() const 
649 {
650   size_t s = sizeof(ComplexBlackBoxDescriptor);
651   return s;
652   }
653   //==========================================================================
654   //==========================================================================
655   size_t  ComplexBlackBoxDescriptor::GetObjectRecursiveSize() const 
656   {
657     size_t s = Superclass::GetObjectRecursiveSize();
658     s += ComplexBlackBoxDescriptor::GetObjectInternalSize();
659     s += mPrototype->GetObjectRecursiveSize();
660     return s;
661   }
662   //==========================================================================
663 void ComplexBlackBoxDescriptor::GetBoxesInside (NodeTreeC& tree, int cont) 
664         {
665                 std::cout<<"getBoxesInside recursivo "<<std::endl;
666                 cont++;
667                 std::string name = GetTypeName();
668                 std::cout<<"despues de getTypeName : "<<name<<std::endl;
669     std::string descr = GetDescription();
670     std::string author = GetAuthor();
671         
672         //list.push_back(name);
673                 tree.setData(name);
674         //list.push_back(descr);
675         //list.push_back(author);
676                 int k = 0;
677                 
678     const ComplexBlackBox::BlackBoxMapType& B = mPrototype->bbGetBlackBoxMap();
679
680                 std::cout<<"----B size "<< B.size() << std::endl;
681                 std::cout<<"----antes if "<<std::endl;
682     if (B.size()) 
683     {
684            std::set<BlackBoxDescriptor::Pointer> pdeps;
685            ComplexBlackBox::BlackBoxMapType::const_iterator b;
686                         std::cout<<"----antes for "<<std::endl;
687            for ( b = B.begin(); b != B.end(); ++b ) 
688            {
689                                 BlackBoxDescriptor::Pointer d = b->second->bbGetDescriptor();
690                                 //std::cout<<"nombre objeto d "<< d->GetObjectName() <<std::endl;
691                                 
692               //if (pdeps.find(d) != pdeps.end()) 
693         //    continue;
694               //pdeps.insert(d);
695                                 std::cout<<"----1~ "<<std::endl;
696               Package::Pointer p = d->GetPackage();
697               std::string nameBox = b->second->bbGetTypeName();
698                                 std::string packageBox = p->GetName();
699                                 tree.insertChild(nameBox);
700                                 std::cout<<"----2~ "<<std::endl;
701                                 //list.push_back(nameBox);
702                                 //list.push_back(packageBox);
703                                 std::cout<<"-----cont "<<cont<<std::endl;
704                                 //tree.treeTour(cont);
705                                 d->GetBoxesInside (tree.childs[k], cont);
706                                 std::cout<<"----3~ "<<std::endl;
707                                 //std::cout<<"--despues de la recursion "<<k<<std::endl;
708                                 k++;
709             }   // for
710                         std::cout<<"----despues for "<<std::endl;
711      } // If B.size
712                         std::cout<<"----despues if "<<std::endl;
713                         std::cout<<"end getBoxesInside recursivo"<<std::endl;
714         }
715
716 //===================================================
717
718          //==========================================================================
719 }