]> Creatis software - bbtk.git/blob - kernel/src/bbtkComplexBlackBoxDescriptor.cxx
Obtaining the tree boxes related to a sigle box. The classes changed were Utilities...
[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
210   // Verify that a box with the same name does not exist already
211     BlackBox::Pointer bbfrom = mPrototype->bbGetBlackBox( from );
212     if ( !bbfrom ) 
213       {
214         bbtkError("the black box \""<<from<<"\" does not exist");
215       }
216     BlackBox::Pointer bbto = mPrototype->bbGetBlackBox( to );
217     if ( !bbto ) 
218       {
219         bbtkError("the black box \""<<to<<"\" does not exist");
220       }
221     
222     Connection::Pointer c 
223       = GetFactory()->NewConnection( bbfrom, output, bbto, input );
224
225     mPrototype->bbAddConnection(c);
226
227
228   }
229   //=======================================================================
230
231
232   //=======================================================================
233   /// Defines an input of the complex box
234   void ComplexBlackBoxDescriptor::DefineInput ( const std::string& name,
235                                                 const std::string& box,
236                                                 const std::string& input,
237                                                 const std::string& help)
238   {
239     bbtkDDebugMessage("kernel",5,
240                         "ComplexBlackBoxDescriptor::DefineInput(\""
241                         <<name<<"\",\""<<box<<"\",\""
242                         <<input<<"\",\""<<help
243                         <<"\")"
244                         <<std::endl);
245
246     BlackBox::Pointer bb = mPrototype->bbGetBlackBox( box );
247     if ( !bb ) 
248       {
249         bbtkError("the black box \""<<box<<"\" does not exist");
250       }
251
252     if (!bb->bbHasInput(input) )
253       {
254         bbtkError("the black box \""<<box<<"\" does not have input \""
255                   <<input<<"\"");
256       }
257     
258     const BlackBoxInputDescriptor* d = 
259       bb->bbGetDescriptor()->GetInputDescriptor(input);
260     AddInputDescriptor ( new ComplexBlackBoxInputDescriptor 
261                          ( typeid(ComplexBlackBoxDescriptor),
262                            name,
263                            help,
264                            d->GetNature(),
265                            box,
266                            input,
267                            d->GetTypeInfo()));
268     
269     
270
271   }
272   //=======================================================================
273
274   //=======================================================================
275   /// Defines an output of the complex box
276   void ComplexBlackBoxDescriptor::DefineOutput ( const std::string& name,
277                                                  const std::string& box,
278                                                  const std::string& output,
279                                                  const std::string& help)
280   {
281     bbtkDDebugMessage("kernel",5,
282                         "ComplexBlackBoxDescriptor::DefineOutput(\""
283                         <<name<<"\",\""<<box<<"\",\""
284                         <<output<<"\",\""<<help
285                         <<"\")"
286                         <<std::endl);
287
288     BlackBox::Pointer bb = mPrototype->bbGetBlackBox( box );
289     if ( !bb ) 
290       {
291         bbtkError("the black box \""<<box<<"\" does not exist");
292       }
293
294     if (!bb->bbHasOutput(output) )
295       {
296         bbtkError("the black box \""<<box<<"\" does not have output \""
297                   <<output<<"\"");
298       }
299     
300     const BlackBoxOutputDescriptor* d = 
301       bb->bbGetDescriptor()->GetOutputDescriptor(output);
302     AddOutputDescriptor ( new ComplexBlackBoxOutputDescriptor 
303                           ( typeid(ComplexBlackBoxDescriptor),
304                             name,
305                             help,
306                             d->GetNature(),
307                             box,
308                             output,
309                             d->GetTypeInfo()));
310     
311     
312
313   }
314   //=======================================================================
315
316   //=======================================================================
317   void ComplexBlackBoxDescriptor::PrintBlackBoxes()
318   {
319     mPrototype->bbPrintBlackBoxes(); 
320   }
321   //=======================================================================
322
323
324   //=======================================================================
325   void ComplexBlackBoxDescriptor::InsertHTMLGraph( std::ofstream& s , 
326                                                    int detail, int level, 
327                                                    const std::string& output_dir, bool relative_link )   
328   {
329     this->mPrototype->bbInsertHTMLGraph( s, 
330                                          detail, level, 
331                                          false, 
332                                          output_dir,
333                                          relative_link );
334   }
335   //=======================================================================
336
337   //=========================================================================
338   void ComplexBlackBoxDescriptor::InsertHtmlHelp ( std::ofstream& s, 
339                                                    int detail, int level,
340                                                    const std::string& output_dir, bool relative_link)
341   {
342     bbtkDDebugMessage("kernel",9,
343                       "ComplexBlackBoxDescriptor::InsertHtmlHelp()"
344                        <<std::endl);
345     
346     //-------------
347     // General info 
348     std::string name = GetTypeName();
349     Utilities::html_format(name);
350
351     //   std::ofstream* s = &s1;
352
353     (s) << "<p><hr>\n";
354     (s) << "<a name=\""<<name<<"\"></a>\n";
355     (s) << //"Top:&nbsp;
356       "<a rel=\"top\" accesskey=\"t\" href=\"#Top\">Top</a>\n";
357     // (s) << "Previous:&nbsp;<a rel="previous" accesskey="p" href="#dir">(dir)</a>,
358     // (s) << "Up:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
359     (s) << "<h2 class=\"section\">"<<name<<"</h2>\n";
360
361
362     std::string descr = GetDescription();
363     //Utilities::html_format(descr);
364     
365     std::string author = GetAuthor();
366     Utilities::html_format(author);
367     
368     std::vector<std::string> categories;
369     // Split the category string 
370     std::string delimiters = ";,";
371     Utilities::SplitString(GetCategory(),
372                            delimiters,categories);
373
374         
375     (s) << "<p><TABLE cellspacing=0  cellpadding=3>\n";
376     (s) << "<TR><TD style='vertical-align: top;'><b> Description </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'> " 
377         << descr << "</TD></TR>\n";
378
379     (s) << "<TR><TD style='vertical-align: top;'><b> Author(s) </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'>  " 
380         << author << "</TD></TR>\n";
381
382     (s) << "<TR><TD style='vertical-align: top;'><b> Category(s) </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'>  ";
383     std::vector<std::string>::iterator ci;
384     for (ci=categories.begin(); ci!=categories.end(); ++ci)
385       {
386         s << "<a href=\"../index-category.html#"<< *ci <<"\">" << *ci 
387           << "</a>&nbsp;\n";
388       }
389     s << "</TD></TR>\n";      
390     std::string inc = GetScriptFileName();
391     if (inc.size()>0) 
392       {
393         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 ";
394         // s << inc << "&nbsp;&nbsp;<a href=\"../../../bbs/"<<inc<<"\">[source]</a>";
395         // LG TODO : USE PACKAGE BBS PATH
396         s << inc << "&nbsp;&nbsp;<a href=\""<<inc<<"\">[source]</a>";
397         s << "</TD></TR>\n";
398         
399       }
400     
401     const ComplexBlackBox::BlackBoxMapType& B = mPrototype->bbGetBlackBoxMap();
402         
403     if (B.size()) 
404     {
405            (s) << "<TR><TD style='vertical-align: top;'><b> Uses </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'>  ";
406
407            std::set<BlackBoxDescriptor::Pointer> pdeps;
408            ComplexBlackBox::BlackBoxMapType::const_iterator b;
409            for ( b = B.begin(); b != B.end(); ++b ) 
410            {
411              BlackBoxDescriptor::Pointer d = b->second->bbGetDescriptor();
412               if (pdeps.find(d) != pdeps.end()) 
413             continue;
414               pdeps.insert(d);
415
416               Package::Pointer p = d->GetPackage();
417             
418               std::string name = b->second->bbGetTypeName();
419                                 
420               std::string url;
421               if (relative_link) 
422                  url = p->GetDocRelativeURL();
423               else 
424                  url = p->GetDocURL();
425                    
426               s << "<a href=\"" <<url<<"#"<<name<<"\">" 
427                 << p->GetName()<<"::"<<name<<"</a>\n";
428             }   // for
429         
430             (s) << "</TD></TR>\n";
431
432      } // If B.size
433
434      (s) << "</TABLE>\n";
435
436  
437    //-------------
438     // Graph
439     InsertHTMLGraph( s , detail,level, output_dir, relative_link);
440     
441     //-------------
442     // Inputs
443     std::string col("#CCCCFF");
444     
445     //  (s) << "<h3 class=\"subsection\">Inputs</h3>\n";
446     (s) << "<p><TABLE border=1 cellspacing=0 cellpadding=3>\n";
447     (s) << "<TR><TD colspan=3 align=center bgcolor=\""<<col
448       <<"\">Inputs</TD></TR>\n";
449     const BlackBoxDescriptor::InputDescriptorMapType& imap = 
450       GetInputDescriptorMap();
451     
452     InputDescriptorMapType::const_iterator in;
453     
454     for ( in = imap.begin();  in != imap.end(); ++in ) 
455       {
456         std::string name(in->second->GetName());
457         Utilities::html_format(name);
458         
459         std::string type("<");
460         type += in->second->GetTypeName();    
461         type += ">";
462         Utilities::html_format(type);
463         
464         std::string descr(in->second->GetDescription());
465         //Utilities::html_format(descr);
466
467 /*EED 10/11/2009
468         (s) << "<TR><TD style='vertical-align: top;'><B><PRE> "<<name<<" </PRE></B></TD>"
469           << "<TD style='vertical-align: top;'><I><PRE> "<<type<<" </PRE></I></TD>"
470           << "<TD style='vertical-align: top;'>"<<descr<<"</TD></TR>\n";
471 */
472
473         (s) << "<TR><TD style='vertical-align: top;'><B><PRE> "<<name<<" </PRE></B></TD>"
474           << "<TD style='vertical-align: top;'><I><PRE> "<<descr<<" </PRE></I></TD>"
475           << "<TD style='vertical-align: top;'>"<<type<<"</TD></TR>\n";
476         
477       }
478     //  (s) << "</TABLE>\n";
479     
480     
481     //-------------
482     // Outputs
483     //  (s) << "<h3 class=\"subsection\">Outputs</h3>\n";
484     //  (s) << "<TABLE border=1 cellspacing=0>\n";
485     (s) << "<TR><TD colspan=3 align=center bgcolor=\""<<col
486       <<"\">Outputs</TD></TR>\n";
487     
488     const BlackBoxDescriptor::OutputDescriptorMapType& omap = 
489       GetOutputDescriptorMap();
490     
491     BlackBoxDescriptor::OutputDescriptorMapType::const_iterator o;
492     
493     for ( o = omap.begin();  o != omap.end(); ++o ) 
494       {
495         std::string name(o->second->GetName());
496         Utilities::html_format(name);
497         
498         std::string type("<");
499         type += o->second->GetTypeName();    
500         type += ">";
501         Utilities::html_format(type);
502         
503         std::string descr(o->second->GetDescription());
504         //Utilities::html_format(descr);
505         
506 /*EED 10/11/2009
507         (s) << "<TR><TD style='vertical-align: top;'><B><PRE> "<<name<<" </PRE></B></TD>"
508           << "<TD style='vertical-align: top;'><I><PRE> "<<type<<" </PRE></I></TD>"
509           << "<TD style='vertical-align: top;'>"<<descr<<"</TD></TR>\n";
510 */      
511         (s) << "<TR><TD style='vertical-align: top;'><B><PRE> "<<name<<" </PRE></B></TD>"
512           << "<TD style='vertical-align: top;'><I><PRE> "<<descr<<" </PRE></I></TD>"
513           << "<TD style='vertical-align: top;'>"<<type<<"</TD></TR>\n";
514
515       }
516     (s) << "</TABLE>\n";
517
518     //------------
519     // End
520
521
522    }
523   //=========================================================================
524  
525
526   //=======================================================================
527   void ComplexBlackBoxDescriptor::GetHelp(bool full) const
528   {
529     if (full) bbtkMessage("help",1,"Complex Black Box <"<<
530                           GetPackage()->GetName()<<"::"
531                           <<GetTypeName()<<">"<<std::endl);
532     bbtkMessage("help",1," "                << GetDescription() <<std::endl);
533     bbtkMessage("help",1," By : "           << GetAuthor()      <<std::endl);
534     bbtkMessage("help",1," Category(s) : "  << GetCategory()     <<std::endl);    
535     if (mInput.size()) 
536       bbtkMessage("help",1," * Inputs : "<<std::endl);
537     else 
538       bbtkMessage("help",1," * No inputs"<<std::endl);
539     InputDescriptorMapType::const_iterator i;
540     unsigned int namelmax = 0;
541     unsigned int typelmax = 0;
542     unsigned int natlmax = 0;
543     for ( i = mInput.begin();  i != mInput.end(); ++i ) 
544     {
545            if (i->second->GetName().size()>namelmax) 
546              namelmax = i->second->GetName().size();
547            if (i->second->GetTypeName().size()>typelmax) 
548              typelmax = i->second->GetTypeName().size();
549            if (i->second->GetNature().size()>natlmax) 
550              natlmax = i->second->GetNature().size();
551     }
552     OutputDescriptorMapType::const_iterator o;
553     if (full) 
554     {
555            for ( o = mOutput.begin();  o != mOutput.end(); ++o ) 
556            {
557              if (o->second->GetName().size()>namelmax) 
558                namelmax = o->second->GetName().size();
559             if (o->second->GetTypeName().size()>typelmax) 
560                typelmax = o->second->GetTypeName().size();
561            if (o->second->GetNature().size()>natlmax) 
562              natlmax = o->second->GetNature().size();
563            }
564     }
565     //
566
567     for ( i = mInput.begin();  i != mInput.end(); ++i ) 
568     {
569            std::string name(i->second->GetName());
570            name += "'";
571            name.append(1+namelmax-name.size(),' ');
572            std::string type(i->second->GetTypeName());
573            type += ">";
574            type.append(1+typelmax-type.size(),' ');
575            std::string nature(i->second->GetNature());
576            nature += "]";
577            nature.append(1+natlmax-nature.size(),' ');
578            bbtkMessage("help",1,
579                        "    '"<<name
580                        <<" <"<<type
581                        <<" ["<<nature
582                        <<" : "<<i->second->GetDescription()<<std::endl);
583     }
584     if (full) 
585     {
586            if (mOutput.size()) 
587              bbtkMessage("help",1," * Outputs : "<<std::endl);
588            else 
589              bbtkMessage("help",1," * No outputs"<<std::endl);
590            for ( o = mOutput.begin();  o != mOutput.end(); ++o ) 
591            {
592              std::string name(o->second->GetName());
593              name += "'";
594              name.append(1+namelmax-name.size(),' ');
595              std::string type(o->second->GetTypeName());
596              type += ">";
597              type.append(1+typelmax-type.size(),' ');
598              std::string nature(o->second->GetNature());
599              nature += "]";
600              nature.append(1+natlmax-nature.size(),' ');
601              bbtkMessage("help",1,
602                        "    '"<<name
603                          <<" <"<<type
604                          <<" ["<<nature
605                          <<" : "<<o->second->GetDescription()<<std::endl);
606            }
607     }
608     if (full) 
609     {
610            const ComplexBlackBox::BlackBoxMapType& B = mPrototype->bbGetBlackBoxMap();
611         
612            if (B.size()) 
613              bbtkMessage("help",1," * Boxes : "<<std::endl);
614            else 
615              bbtkMessage("help",1," * No boxes"<<std::endl);
616         
617            ComplexBlackBox::BlackBoxMapType::const_iterator b;
618            for ( b = B.begin(); b != B.end(); ++b ) 
619            {
620              bbtkMessage("help",1,"    '"<<b->second->bbGetName()<<
621                          "' <"
622                          << b->second->bbGetDescriptor()->GetPackage()->GetName() 
623                          <<"::"
624                          <<b->second->bbGetTypeName()<<">"<<std::endl);
625            }
626     }
627
628   }   
629   //=======================================================================
630
631   //==========================================================================
632   std::string ComplexBlackBoxDescriptor::GetObjectName() const
633   {
634     return std::string("ComplexBlackBoxDescriptor '")+GetFullTypeName()
635       +std::string("'");
636   }
637   //==========================================================================
638   //=======================================================================
639   std::string ComplexBlackBoxDescriptor::GetObjectInfo() const
640   {
641     std::string i;
642     return i;     
643   }
644   //=======================================================================
645  //==========================================================================
646 size_t  ComplexBlackBoxDescriptor::GetObjectSize() const 
647 {
648   size_t s = Superclass::GetObjectSize();
649   s += ComplexBlackBoxDescriptor::GetObjectInternalSize();
650   return s;
651   }
652   //==========================================================================
653   //==========================================================================
654 size_t  ComplexBlackBoxDescriptor::GetObjectInternalSize() const 
655 {
656   size_t s = sizeof(ComplexBlackBoxDescriptor);
657   return s;
658   }
659   //==========================================================================
660   //==========================================================================
661   size_t  ComplexBlackBoxDescriptor::GetObjectRecursiveSize() const 
662   {
663     size_t s = Superclass::GetObjectRecursiveSize();
664     s += ComplexBlackBoxDescriptor::GetObjectInternalSize();
665     s += mPrototype->GetObjectRecursiveSize();
666     return s;
667   }
668   //==========================================================================
669 void ComplexBlackBoxDescriptor::GetBoxesInside (NodeTreeC& tree, std::vector<std::string>& list, int cont) 
670         {
671
672                 std::string name = GetTypeName();
673     std::string descr = GetDescription();
674     std::string author = GetAuthor();
675         list.push_back(name);
676                 tree.setData(name);
677    //   list.push_back(descr);
678    //   list.push_back(author);
679                 int k = 0;
680     const ComplexBlackBox::BlackBoxMapType& B = mPrototype->bbGetBlackBoxMap();
681         
682     if (B.size()) 
683     {
684            std::set<BlackBoxDescriptor::Pointer> pdeps;
685            ComplexBlackBox::BlackBoxMapType::const_iterator b;
686            for ( b = B.begin(); b != B.end(); ++b ) 
687            {
688                 BlackBoxDescriptor::Pointer d = b->second->bbGetDescriptor();
689                                 
690                                 
691               //if (pdeps.find(d) != pdeps.end()) 
692         //    continue;
693               //pdeps.insert(d);
694
695               Package::Pointer p = d->GetPackage();
696               std::string nameBox = b->second->bbGetTypeName();
697                                 std::string packageBox = p->GetName();
698                                 
699                                 tree.insertChild(nameBox);
700
701                                 list.push_back(nameBox);
702                                 list.push_back(packageBox);
703
704                                 d->GetBoxesInside (tree.childs[k],list, cont+1);
705                                 k++;
706             }   // for
707
708      } // If B.size
709
710         }
711
712 //===================================================
713
714          //==========================================================================
715 }