bbtk::ComplexBlackBoxDescriptor Class Reference

Describes a ComplexBlackBox (constituents, connections) and is able to create an instance of it. More...

#include <bbtkComplexBlackBoxDescriptor.h>

List of all members.

Public Types

typedef ComplexBlackBoxDescriptor Self
typedef boost::shared_ptr< SelfPointer
typedef boost::weak_ptr< SelfWeakPointer

Public Member Functions

std::string GetObjectName () const
std::string GetObjectInfo () const
size_t GetObjectSize () const
size_t GetObjectInternalSize () const
size_t GetObjectRecursiveSize () const
void SetFactory (Factory::Pointer f)
 Sets the factory used.
Factory::Pointer GetFactory () const
 Gets the factory used.
virtual BlackBoxPointer NewBlackBox (const std::string &name)
 Releases the descriptor.
void Add (const std::string &type, const std::string &name)
 Adds a black box to the complex box.
void Remove (const std::string &name, bool remove_connections=true)
 Removes a black box from the complex box.
void Connect (const std::string &from, const std::string &output, const std::string &to, const std::string &input)
 Connects two black boxes of the complex box.
void DefineInput (const std::string &name, const std::string &box, const std::string &input, const std::string &help)
 Defines an input of the complex box.
void DefineOutput (const std::string &name, const std::string &box, const std::string &output, const std::string &help)
 Defines an output of the complex box.
void SetScriptFileName (const std::string &n)
 Sets the name of the script file from which it is defined.
std::string GetScriptFileName () const
 Gets the name of the script file from which it is defined.
void AddToExecutionList (const std::string &box)
 Adds a black box to the execution list.
ComplexBlackBoxPointer GetPrototype ()
void PrintBlackBoxes ()
void GetHelp (bool full=true) const
 Prints help on the black box.
void InsertHtmlHelp (std::ofstream &s, int detail, int level, const std::string &output_dir="", bool relative_link=false)
void InsertHTMLGraph (std::ofstream &s, int detail, int level, const std::string &output_dir="", bool relative_link=false)
virtual void Check (bool recursive=true) const
 Check.

Static Public Member Functions

static Pointer New (const std::string &name)

Protected Types

typedef BlackBoxDescriptor Superclass

Protected Member Functions

 ComplexBlackBoxDescriptor ()
 ComplexBlackBoxDescriptor (const ComplexBlackBoxDescriptor &)
 ~ComplexBlackBoxDescriptor ()
 Default dtor.
 ComplexBlackBoxDescriptor (const std::string &name)
 Default ctor with name is protected.

Private Attributes

Factory::WeakPointer mFactory
 The factory used.
ComplexBlackBoxPointer mPrototype
 The complex box in which boxes and connections are stored.
std::string mScriptFileName
 The name of the script file from which it was created.

Friends

struct Object::Deleter
class ComplexBlackBox


Detailed Description

Describes a ComplexBlackBox (constituents, connections) and is able to create an instance of it.

Definition at line 57 of file bbtkComplexBlackBoxDescriptor.h.


Member Typedef Documentation

typedef ComplexBlackBoxDescriptor bbtk::ComplexBlackBoxDescriptor::Self

Definition at line 60 of file bbtkComplexBlackBoxDescriptor.h.

typedef boost::shared_ptr<Self> bbtk::ComplexBlackBoxDescriptor::Pointer

Definition at line 60 of file bbtkComplexBlackBoxDescriptor.h.

typedef boost::weak_ptr<Self> bbtk::ComplexBlackBoxDescriptor::WeakPointer

Definition at line 60 of file bbtkComplexBlackBoxDescriptor.h.

typedef BlackBoxDescriptor bbtk::ComplexBlackBoxDescriptor::Superclass [protected]

Definition at line 60 of file bbtkComplexBlackBoxDescriptor.h.


Constructor & Destructor Documentation

bbtk::ComplexBlackBoxDescriptor::ComplexBlackBoxDescriptor (  )  [protected]

bbtk::ComplexBlackBoxDescriptor::ComplexBlackBoxDescriptor ( const ComplexBlackBoxDescriptor  )  [protected]

bbtk::ComplexBlackBoxDescriptor::~ComplexBlackBoxDescriptor (  )  [protected]

Default dtor.

Definition at line 75 of file bbtkComplexBlackBoxDescriptor.cxx.

References bbtkDebugMessage, and mPrototype.

00076   {
00077     bbtkDebugMessage("object",2,"==> ComplexBlackBoxDescriptor::~ComplexBlackBoxDescriptor(\""<<GetTypeName()<<"\")"<<std::endl);
00078     //    mPrototype->Delete();
00079     mPrototype.reset();
00080     bbtkDebugMessage("object",2,"<== ComplexBlackBoxDescriptor::~ComplexBlackBoxDescriptor(\""<<GetTypeName()<<"\")"<<std::endl);
00081   }

bbtk::ComplexBlackBoxDescriptor::ComplexBlackBoxDescriptor ( const std::string &  name  )  [protected]

Default ctor with name is protected.

Default ctor.

Definition at line 59 of file bbtkComplexBlackBoxDescriptor.cxx.

References bbtkDebugMessage, and mPrototype.

00060   {
00061     bbtkDebugMessage("object",2,"==> ComplexBlackBoxDescriptor::ComplexBlackBoxDescriptor(\""<<name<<"\")"<<std::endl);
00062     SetTypeName(name);
00063     AddToCategory("complex box");
00064     mPrototype = ComplexBlackBox::New(name+std::string("Prototype"),
00065                                       MakePointer(this,true));
00066     mPrototype->SetAsPrototype();
00067     bbtkDebugMessage("object",2,"<== ComplexBlackBoxDescriptor::ComplexBlackBoxDescriptor(\""<<name<<"\")"<<std::endl);
00068   }


Member Function Documentation

std::string bbtk::ComplexBlackBoxDescriptor::GetObjectName (  )  const

Definition at line 609 of file bbtkComplexBlackBoxDescriptor.cxx.

00610   {
00611     return std::string("ComplexBlackBoxDescriptor '")+GetFullTypeName()
00612       +std::string("'");
00613   }

std::string bbtk::ComplexBlackBoxDescriptor::GetObjectInfo (  )  const

Definition at line 616 of file bbtkComplexBlackBoxDescriptor.cxx.

References bbtk::i.

00617   {
00618     std::string i;
00619     return i;     
00620   }

size_t bbtk::ComplexBlackBoxDescriptor::GetObjectSize (  )  const

Definition at line 623 of file bbtkComplexBlackBoxDescriptor.cxx.

00624 {
00625   size_t s = Superclass::GetObjectSize();
00626   s += ComplexBlackBoxDescriptor::GetObjectInternalSize();
00627   return s;
00628   }

size_t bbtk::ComplexBlackBoxDescriptor::GetObjectInternalSize (  )  const

Definition at line 631 of file bbtkComplexBlackBoxDescriptor.cxx.

00632 {
00633   size_t s = sizeof(ComplexBlackBoxDescriptor);
00634   return s;
00635   }

size_t bbtk::ComplexBlackBoxDescriptor::GetObjectRecursiveSize (  )  const

Definition at line 638 of file bbtkComplexBlackBoxDescriptor.cxx.

References mPrototype.

00639   {
00640     size_t s = Superclass::GetObjectRecursiveSize();
00641     s += ComplexBlackBoxDescriptor::GetObjectInternalSize();
00642     s += mPrototype->GetObjectRecursiveSize();
00643     return s;
00644   }

ComplexBlackBoxDescriptor::Pointer bbtk::ComplexBlackBoxDescriptor::New ( const std::string &  name  )  [static]

Definition at line 47 of file bbtkComplexBlackBoxDescriptor.cxx.

References bbtkDebugMessage.

00048   {
00049     bbtkDebugMessage("object",1,"##> ComplexBlackBoxDescriptor::New(\""<<name<<"\")"<<std::endl);
00050     ComplexBlackBoxDescriptor::Pointer p = 
00051       MakePointer(new ComplexBlackBoxDescriptor(name));
00052     bbtkDebugMessage("object",1,"<## ComplexBlackBoxDescriptor::New(\""<<name<<"\")"<<std::endl);
00053     return p;
00054   }

void bbtk::ComplexBlackBoxDescriptor::SetFactory ( Factory::Pointer  f  )  [inline]

Sets the factory used.

Definition at line 67 of file bbtkComplexBlackBoxDescriptor.h.

00067 { mFactory = f; }

Factory::Pointer bbtk::ComplexBlackBoxDescriptor::GetFactory (  )  const [inline]

Gets the factory used.

Definition at line 69 of file bbtkComplexBlackBoxDescriptor.h.

Referenced by Add(), and Connect().

00069 { return mFactory.lock(); }

Here is the caller graph for this function:

BlackBox::Pointer bbtk::ComplexBlackBoxDescriptor::NewBlackBox ( const std::string &  name  )  [virtual]

Releases the descriptor.

Creates an instance of name <name> of the ComplexBlackBox of which this is the descriptor.

Gets the factory used (const) Creates an instance of name <name> of the ComplexBlackBox of which this is the descriptor

Definition at line 95 of file bbtkComplexBlackBoxDescriptor.cxx.

References bbtkDebugDecTab, bbtkDebugMessageInc, and mPrototype.

Referenced by Add().

00096   {
00097     bbtkDebugMessageInc("Kernel",5,
00098                         "ComplexBlackBoxDescriptor::NewBlackBox(\""
00099                         <<name<<"\") ["
00100                         <<GetTypeName()<<"]"<<std::endl);
00101     
00102     return mPrototype->bbClone(name);
00103 
00104     bbtkDebugDecTab("Kernel",5);
00105   }

Here is the caller graph for this function:

void bbtk::ComplexBlackBoxDescriptor::Add ( const std::string &  type,
const std::string &  name 
)

Adds a black box to the complex box.

Adds a black box to the complex box Needs a factory set !

Definition at line 119 of file bbtkComplexBlackBoxDescriptor.cxx.

References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkError, GetFactory(), mPrototype, and NewBlackBox().

00122   {
00123     bbtkDebugMessageInc("Kernel",5,
00124                         "ComplexBlackBoxDescriptor::Add(\""
00125                         <<type<<"\",\""<<name<<"\") ["
00126                         <<GetTypeName()<<"]"<<std::endl);
00127     
00128     // 
00129     if (!GetFactory()) 
00130       { 
00131         bbtkError("ComplexBlackBoxDescriptor::Add : no factory set");
00132       }
00133     
00134     // Verify that a box with the same name does not exist already
00135     if ( mPrototype->bbUnsafeGetBlackBox( name ) ) 
00136       {
00137         bbtkError("a black box \""<<name<<"\" already exists");
00138       }
00139     // ok : create new one
00140     mPrototype->bbAddBlackBox ( GetFactory()->NewBlackBox(type,name) );
00141 
00142     bbtkDebugDecTab("Kernel",5);
00143   }

Here is the call graph for this function:

void bbtk::ComplexBlackBoxDescriptor::Remove ( const std::string &  name,
bool  remove_connections = true 
)

Removes a black box from the complex box.

Definition at line 148 of file bbtkComplexBlackBoxDescriptor.cxx.

References mPrototype.

00150   {    
00151     mPrototype->bbRemoveBlackBox(name,remove_connections);
00152   }

void bbtk::ComplexBlackBoxDescriptor::Connect ( const std::string &  from,
const std::string &  output,
const std::string &  to,
const std::string &  input 
)

Connects two black boxes of the complex box.

Connects two black boxes of the complex box Needs a factory set !

Definition at line 179 of file bbtkComplexBlackBoxDescriptor.cxx.

References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkError, GetFactory(), and mPrototype.

00184   {
00185     bbtkDebugMessageInc("Kernel",5,
00186                         "ComplexBlackBoxDescriptor::Connect(\""
00187                         <<from<<"\",\""<<output<<"\",\""
00188                         <<to<<"\",\""<<input
00189                         <<"\") ["
00190                         <<GetTypeName()<<"]"<<std::endl);
00191   // 
00192     if (!GetFactory()) 
00193       { 
00194         bbtkError("ComplexBlackBoxDescriptor::Connect : no factory set");
00195       }
00196     
00197 
00198   // Verify that a box with the same name does not exist already
00199     BlackBox::Pointer bbfrom = mPrototype->bbGetBlackBox( from );
00200     if ( !bbfrom ) 
00201       {
00202         bbtkError("the black box \""<<from<<"\" does not exist");
00203       }
00204     BlackBox::Pointer bbto = mPrototype->bbGetBlackBox( to );
00205     if ( !bbto ) 
00206       {
00207         bbtkError("the black box \""<<to<<"\" does not exist");
00208       }
00209     
00210     Connection::Pointer c 
00211       = GetFactory()->NewConnection( bbfrom, output, bbto, input );
00212 
00213     mPrototype->bbAddConnection(c);
00214 
00215     bbtkDebugDecTab("Kernel",5);
00216   }

Here is the call graph for this function:

void bbtk::ComplexBlackBoxDescriptor::DefineInput ( const std::string &  name,
const std::string &  box,
const std::string &  input,
const std::string &  help 
)

Defines an input of the complex box.

Definition at line 222 of file bbtkComplexBlackBoxDescriptor.cxx.

References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkError, bbtk::BlackBoxInputOutputDescriptor::GetNature(), bbtk::BlackBoxInputOutputDescriptor::GetTypeInfo(), and mPrototype.

00226   {
00227     bbtkDebugMessageInc("Kernel",5,
00228                         "ComplexBlackBoxDescriptor::DefineInput(\""
00229                         <<name<<"\",\""<<box<<"\",\""
00230                         <<input<<"\",\""<<help
00231                         <<"\") ["
00232                         <<GetTypeName()<<"]"<<std::endl);
00233 
00234     BlackBox::Pointer bb = mPrototype->bbGetBlackBox( box );
00235     if ( !bb ) 
00236       {
00237         bbtkError("the black box \""<<box<<"\" does not exist");
00238       }
00239 
00240     if (!bb->bbHasInput(input) )
00241       {
00242         bbtkError("the black box \""<<box<<"\" does not have input \""
00243                   <<input<<"\"");
00244       }
00245     
00246     const BlackBoxInputDescriptor* d = 
00247       bb->bbGetDescriptor()->GetInputDescriptor(input);
00248     AddInputDescriptor ( new ComplexBlackBoxInputDescriptor 
00249                          ( typeid(ComplexBlackBoxDescriptor),
00250                            name,
00251                            help,
00252                            d->GetNature(),
00253                            box,
00254                            input,
00255                            d->GetTypeInfo()));
00256     
00257     
00258     bbtkDebugDecTab("Kernel",5);
00259   }

Here is the call graph for this function:

void bbtk::ComplexBlackBoxDescriptor::DefineOutput ( const std::string &  name,
const std::string &  box,
const std::string &  output,
const std::string &  help 
)

Defines an output of the complex box.

Definition at line 264 of file bbtkComplexBlackBoxDescriptor.cxx.

References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkError, bbtk::BlackBoxInputOutputDescriptor::GetNature(), bbtk::BlackBoxInputOutputDescriptor::GetTypeInfo(), and mPrototype.

00268   {
00269     bbtkDebugMessageInc("Kernel",5,
00270                         "ComplexBlackBoxDescriptor::DefineOutput(\""
00271                         <<name<<"\",\""<<box<<"\",\""
00272                         <<output<<"\",\""<<help
00273                         <<"\") ["
00274                         <<GetTypeName()<<"]"<<std::endl);
00275 
00276     BlackBox::Pointer bb = mPrototype->bbGetBlackBox( box );
00277     if ( !bb ) 
00278       {
00279         bbtkError("the black box \""<<box<<"\" does not exist");
00280       }
00281 
00282     if (!bb->bbHasOutput(output) )
00283       {
00284         bbtkError("the black box \""<<box<<"\" does not have output \""
00285                   <<output<<"\"");
00286       }
00287     
00288     const BlackBoxOutputDescriptor* d = 
00289       bb->bbGetDescriptor()->GetOutputDescriptor(output);
00290     AddOutputDescriptor ( new ComplexBlackBoxOutputDescriptor 
00291                           ( typeid(ComplexBlackBoxDescriptor),
00292                             name,
00293                             help,
00294                             d->GetNature(),
00295                             box,
00296                             output,
00297                             d->GetTypeInfo()));
00298     
00299     
00300     bbtkDebugDecTab("Kernel",5);
00301   }

Here is the call graph for this function:

void bbtk::ComplexBlackBoxDescriptor::SetScriptFileName ( const std::string &  n  )  [inline]

Sets the name of the script file from which it is defined.

Definition at line 109 of file bbtkComplexBlackBoxDescriptor.h.

00109 { mScriptFileName = n; }

std::string bbtk::ComplexBlackBoxDescriptor::GetScriptFileName (  )  const [inline]

Gets the name of the script file from which it is defined.

Definition at line 111 of file bbtkComplexBlackBoxDescriptor.h.

Referenced by InsertHtmlHelp().

00111 { return mScriptFileName; }

Here is the caller graph for this function:

void bbtk::ComplexBlackBoxDescriptor::AddToExecutionList ( const std::string &  box  ) 

Adds a black box to the execution list.

Definition at line 158 of file bbtkComplexBlackBoxDescriptor.cxx.

References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkError, and mPrototype.

00159   {
00160     bbtkDebugMessageInc("Kernel",5,
00161                         "ComplexBlackBoxDescriptor::AddToExecutionList(\""
00162                         <<box<<"\" ["
00163                         <<GetTypeName()<<"]"<<std::endl);
00164     // Verify that the box exists
00165     BlackBox::Pointer b = mPrototype->bbUnsafeGetBlackBox( box ); 
00166     if ( !b ) 
00167       {
00168         bbtkError("the black box \""<<box<<"\" does not exist");
00169       }
00170     // ok 
00171     mPrototype->bbAddToExecutionList ( box  );
00172 
00173     bbtkDebugDecTab("Kernel",5);
00174     }

ComplexBlackBoxPointer bbtk::ComplexBlackBoxDescriptor::GetPrototype (  )  [inline]

Definition at line 116 of file bbtkComplexBlackBoxDescriptor.h.

00116 { return mPrototype; }

void bbtk::ComplexBlackBoxDescriptor::PrintBlackBoxes (  ) 

Definition at line 305 of file bbtkComplexBlackBoxDescriptor.cxx.

References mPrototype.

00306   {
00307     mPrototype->bbPrintBlackBoxes(); 
00308   }

void bbtk::ComplexBlackBoxDescriptor::GetHelp ( bool  full = true  )  const

Prints help on the black box.

Definition at line 504 of file bbtkComplexBlackBoxDescriptor.cxx.

References bbtkMessage, bbtk::i, and mPrototype.

00505   {
00506     if (full) bbtkMessage("Help",1,"Complex Black Box <"<<
00507                           GetPackage()->GetName()<<"::"
00508                           <<GetTypeName()<<">"<<std::endl);
00509     bbtkMessage("Help",1," "                << GetDescription() <<std::endl);
00510     bbtkMessage("Help",1," By : "           << GetAuthor()      <<std::endl);
00511     bbtkMessage("Help",1," Category(s) : "  << GetCategory()     <<std::endl);    
00512     if (mInput.size()) 
00513       bbtkMessage("Help",1," * Inputs : "<<std::endl);
00514     else 
00515       bbtkMessage("Help",1," * No inputs"<<std::endl);
00516     InputDescriptorMapType::const_iterator i;
00517     unsigned int namelmax = 0;
00518     unsigned int typelmax = 0;
00519     unsigned int natlmax = 0;
00520     for ( i = mInput.begin();  i != mInput.end(); ++i ) 
00521     {
00522            if (i->second->GetName().size()>namelmax) 
00523              namelmax = i->second->GetName().size();
00524            if (i->second->GetTypeName().size()>typelmax) 
00525              typelmax = i->second->GetTypeName().size();
00526            if (i->second->GetNature().size()>natlmax) 
00527              natlmax = i->second->GetNature().size();
00528     }
00529     OutputDescriptorMapType::const_iterator o;
00530     if (full) 
00531     {
00532            for ( o = mOutput.begin();  o != mOutput.end(); ++o ) 
00533            {
00534              if (o->second->GetName().size()>namelmax) 
00535                namelmax = o->second->GetName().size();
00536             if (o->second->GetTypeName().size()>typelmax) 
00537                typelmax = o->second->GetTypeName().size();
00538            if (o->second->GetNature().size()>natlmax) 
00539              natlmax = o->second->GetNature().size();
00540            }
00541     }
00542     //
00543 
00544     for ( i = mInput.begin();  i != mInput.end(); ++i ) 
00545     {
00546            std::string name(i->second->GetName());
00547            name += "'";
00548            name.append(1+namelmax-name.size(),' ');
00549            std::string type(i->second->GetTypeName());
00550            type += ">";
00551            type.append(1+typelmax-type.size(),' ');
00552            std::string nature(i->second->GetNature());
00553            nature += "]";
00554            nature.append(1+natlmax-nature.size(),' ');
00555            bbtkMessage("Help",1,
00556                        "    '"<<name
00557                        <<" <"<<type
00558                        <<" ["<<nature
00559                        <<" : "<<i->second->GetDescription()<<std::endl);
00560     }
00561     if (full) 
00562     {
00563            if (mOutput.size()) 
00564              bbtkMessage("Help",1," * Outputs : "<<std::endl);
00565            else 
00566              bbtkMessage("Help",1," * No outputs"<<std::endl);
00567            for ( o = mOutput.begin();  o != mOutput.end(); ++o ) 
00568            {
00569              std::string name(o->second->GetName());
00570              name += "'";
00571              name.append(1+namelmax-name.size(),' ');
00572              std::string type(o->second->GetTypeName());
00573              type += ">";
00574              type.append(1+typelmax-type.size(),' ');
00575              std::string nature(o->second->GetNature());
00576              nature += "]";
00577              nature.append(1+natlmax-nature.size(),' ');
00578              bbtkMessage("Help",1,
00579                        "    '"<<name
00580                          <<" <"<<type
00581                          <<" ["<<nature
00582                          <<" : "<<o->second->GetDescription()<<std::endl);
00583            }
00584     }
00585     if (full) 
00586     {
00587            const ComplexBlackBox::BlackBoxMapType& B = mPrototype->bbGetBlackBoxMap();
00588         
00589            if (B.size()) 
00590              bbtkMessage("Help",1," * Boxes : "<<std::endl);
00591            else 
00592              bbtkMessage("Help",1," * No boxes"<<std::endl);
00593         
00594            ComplexBlackBox::BlackBoxMapType::const_iterator b;
00595            for ( b = B.begin(); b != B.end(); ++b ) 
00596            {
00597              bbtkMessage("Help",1,"    '"<<b->second->bbGetName()<<
00598                          "' <"
00599                          << b->second->bbGetDescriptor()->GetPackage()->GetName() 
00600                          <<"::"
00601                          <<b->second->bbGetTypeName()<<">"<<std::endl);
00602            }
00603     }
00604 
00605   }   

void bbtk::ComplexBlackBoxDescriptor::InsertHtmlHelp ( std::ofstream &  s,
int  detail,
int  level,
const std::string &  output_dir = "",
bool  relative_link = false 
)

Writes html formatted help into the output file stream. detail and level are used for graphical representation of complex black boxes (see ComplexBlackBox::InsertHTMLGraph) output_dir is the directory in which to write auxilliary files (.dot/.png/.cmap)

Definition at line 326 of file bbtkComplexBlackBoxDescriptor.cxx.

References bbtkDebugDecTab, bbtkDebugMessageInc, GetScriptFileName(), InsertHTMLGraph(), and mPrototype.

00329   {
00330     bbtkDebugMessageInc("Kernel",9,
00331                         "ComplexBlackBoxDescriptor::InsertHtmlHelp() ["
00332                         <<GetTypeName()<<"]"<<std::endl);
00333     
00334     //-------------
00335     // General info 
00336     std::string name = GetTypeName();
00337     Utilities::html_format(name);
00338 
00339     //   std::ofstream* s = &s1;
00340 
00341     (s) << "<p><hr>\n";
00342     (s) << "<a name=\""<<name<<"\"></a>\n";
00343     (s) << //"Top:&nbsp;
00344       "<a rel=\"top\" accesskey=\"t\" href=\"#Top\">Top</a>\n";
00345     // (s) << "Previous:&nbsp;<a rel="previous" accesskey="p" href="#dir">(dir)</a>,
00346     // (s) << "Up:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
00347     (s) << "<h2 class=\"section\">"<<name<<"</h2>\n";
00348 
00349 
00350     std::string descr = GetDescription();
00351     //Utilities::html_format(descr);
00352     
00353     std::string author = GetAuthor();
00354     Utilities::html_format(author);
00355     
00356     std::vector<std::string> categories;
00357     // Split the category string 
00358     std::string delimiters = ";,";
00359     Utilities::SplitString(GetCategory(),
00360                            delimiters,categories);
00361 
00362         
00363     (s) << "<p><TABLE cellspacing=0  cellpadding=3>\n";
00364     (s) << "<TR><TD style='vertical-align: top;'><b> Description </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'> " 
00365         << descr << "</TD></TR>\n";
00366 
00367     (s) << "<TR><TD style='vertical-align: top;'><b> Author(s) </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'>  " 
00368         << author << "</TD></TR>\n";
00369 
00370     (s) << "<TR><TD style='vertical-align: top;'><b> Category(s) </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'>  ";
00371     std::vector<std::string>::iterator ci;
00372     for (ci=categories.begin(); ci!=categories.end(); ++ci)
00373       {
00374         s << "<a href=\"../index-category.html#"<< *ci <<"\">" << *ci 
00375           << "</a>&nbsp;\n";
00376       }
00377     s << "</TD></TR>\n";      
00378     std::string inc = GetScriptFileName();
00379     if (inc.size()>0) 
00380       {
00381         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 ";
00382         // s << inc << "&nbsp;&nbsp;<a href=\"../../../bbs/"<<inc<<"\">[source]</a>";
00383         // LG TODO : USE PACKAGE BBS PATH
00384         s << inc << "&nbsp;&nbsp;<a href=\""<<inc<<"\">[source]</a>";
00385         s << "</TD></TR>\n";
00386         
00387       }
00388     
00389     const ComplexBlackBox::BlackBoxMapType& B = mPrototype->bbGetBlackBoxMap();
00390         
00391     if (B.size()) 
00392     {
00393            (s) << "<TR><TD style='vertical-align: top;'><b> Uses </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'>  ";
00394 
00395            std::set<BlackBoxDescriptor::Pointer> pdeps;
00396            ComplexBlackBox::BlackBoxMapType::const_iterator b;
00397            for ( b = B.begin(); b != B.end(); ++b ) 
00398            {
00399              BlackBoxDescriptor::Pointer d = b->second->bbGetDescriptor();
00400               if (pdeps.find(d) != pdeps.end()) 
00401             continue;
00402               pdeps.insert(d);
00403 
00404               Package::Pointer p = d->GetPackage();
00405             
00406               std::string name = b->second->bbGetTypeName();
00407 
00408               std::string url;
00409               if (relative_link) 
00410                  url = p->GetDocRelativeURL();
00411               else 
00412                  url = p->GetDocURL();
00413 
00414               s << "<a href=\"" <<url<<"#"<<name<<"\">" 
00415                 << p->GetName()<<"::"<<name<<"</a>\n";
00416             }   
00417         
00418             (s) << "</TD></TR>\n";
00419 
00420      }
00421 
00422      (s) << "</TABLE>\n";
00423 
00424  
00425    //-------------
00426     // Graph
00427     InsertHTMLGraph( s , detail,level, output_dir, relative_link);
00428     
00429     //-------------
00430     // Inputs
00431     std::string col("#CCCCFF");
00432     
00433     //  (s) << "<h3 class=\"subsection\">Inputs</h3>\n";
00434     (s) << "<p><TABLE border=1 cellspacing=0 cellpadding=3>\n";
00435     (s) << "<TR><TD colspan=3 align=center bgcolor=\""<<col
00436       <<"\">Inputs</TD></TR>\n";
00437     const BlackBoxDescriptor::InputDescriptorMapType& imap = 
00438       GetInputDescriptorMap();
00439     
00440     InputDescriptorMapType::const_iterator in;
00441     
00442     for ( in = imap.begin();  in != imap.end(); ++in ) 
00443       {
00444         std::string name(in->second->GetName());
00445         Utilities::html_format(name);
00446         
00447         std::string type("<");
00448         type += in->second->GetTypeName();    
00449         type += ">";
00450         Utilities::html_format(type);
00451         
00452         std::string descr(in->second->GetDescription());
00453         //Utilities::html_format(descr);
00454 
00455         (s) << "<TR><TD style='vertical-align: top;'><B><PRE> "<<name<<" </PRE></B></TD>"
00456           << "<TD style='vertical-align: top;'><I><PRE> "<<type<<" </PRE></I></TD>"
00457           << "<TD style='vertical-align: top;'>"<<descr<<"</TD></TR>\n";
00458         
00459       }
00460     //  (s) << "</TABLE>\n";
00461     
00462     
00463     //-------------
00464     // Outputs
00465     //  (s) << "<h3 class=\"subsection\">Outputs</h3>\n";
00466     //  (s) << "<TABLE border=1 cellspacing=0>\n";
00467     (s) << "<TR><TD colspan=3 align=center bgcolor=\""<<col
00468       <<"\">Outputs</TD></TR>\n";
00469     
00470     const BlackBoxDescriptor::OutputDescriptorMapType& omap = 
00471       GetOutputDescriptorMap();
00472     
00473     BlackBoxDescriptor::OutputDescriptorMapType::const_iterator o;
00474     
00475     for ( o = omap.begin();  o != omap.end(); ++o ) 
00476       {
00477         std::string name(o->second->GetName());
00478         Utilities::html_format(name);
00479         
00480         std::string type("<");
00481         type += o->second->GetTypeName();    
00482         type += ">";
00483         Utilities::html_format(type);
00484         
00485         std::string descr(o->second->GetDescription());
00486         //Utilities::html_format(descr);
00487         
00488         (s) << "<TR><TD style='vertical-align: top;'><B><PRE> "<<name<<" </PRE></B></TD>"
00489           << "<TD style='vertical-align: top;'><I><PRE> "<<type<<" </PRE></I></TD>"
00490           << "<TD style='vertical-align: top;'>"<<descr<<"</TD></TR>\n";
00491         
00492       }
00493     (s) << "</TABLE>\n";
00494 
00495     //------------
00496     // End
00497 
00498     bbtkDebugDecTab("Kernel",9);
00499    }

Here is the call graph for this function:

void bbtk::ComplexBlackBoxDescriptor::InsertHTMLGraph ( std::ofstream &  s,
int  detail,
int  level,
const std::string &  output_dir = "",
bool  relative_link = false 
)

Generates a png image representing the pipeline graph of the complex box and writes html code to insert it into the output file stream. detail : level : depth of nested complex boxes graph development (0:only this box level output_dir is the directory in which to write the files (.dot/.png/.cmap)

Definition at line 313 of file bbtkComplexBlackBoxDescriptor.cxx.

References mPrototype.

Referenced by InsertHtmlHelp().

00316   {
00317     this->mPrototype->bbInsertHTMLGraph( s, 
00318                                          detail, level, 
00319                                          false, 
00320                                          output_dir,
00321                                          relative_link );
00322   }

Here is the caller graph for this function:

void bbtk::ComplexBlackBoxDescriptor::Check ( bool  recursive = true  )  const [virtual]

Check.

Definition at line 86 of file bbtkComplexBlackBoxDescriptor.cxx.

References mPrototype.

00087   {
00088     mPrototype->Check(recursive);
00089   }


Friends And Related Function Documentation

friend struct Object::Deleter [friend]

Definition at line 60 of file bbtkComplexBlackBoxDescriptor.h.

friend class ComplexBlackBox [friend]

Definition at line 63 of file bbtkComplexBlackBoxDescriptor.h.


Member Data Documentation

Factory::WeakPointer bbtk::ComplexBlackBoxDescriptor::mFactory [private]

The factory used.

Definition at line 157 of file bbtkComplexBlackBoxDescriptor.h.

ComplexBlackBoxPointer bbtk::ComplexBlackBoxDescriptor::mPrototype [private]

std::string bbtk::ComplexBlackBoxDescriptor::mScriptFileName [private]

The name of the script file from which it was created.

Definition at line 161 of file bbtkComplexBlackBoxDescriptor.h.


The documentation for this class was generated from the following files:

Generated on Wed Nov 12 11:38:39 2008 for BBTK by  doxygen 1.5.6