#include <bbtkBlackBoxDescriptor.h>
Public Types | |
enum | Kind { STANDARD = 0, ADAPTOR = 1, DEFAULT_ADAPTOR = 2, GUI = 3, DEFAULT_GUI = 4 } |
The kinds of black box. More... | |
typedef BlackBoxDescriptor | Self |
typedef boost::shared_ptr< Self > | Pointer |
typedef boost::weak_ptr< Self > | WeakPointer |
typedef BlackBoxInputDescriptor | InputDescriptor |
The type of descriptor of inputs. | |
typedef BlackBoxOutputDescriptor | OutputDescriptor |
The type of descriptor of outputs. | |
typedef std::map< std::string, InputDescriptor * > | InputDescriptorMapType |
The type of dictionnary of inputs = map of input descriptors pointers. | |
typedef std::map< std::string, OutputDescriptor * > | OutputDescriptorMapType |
The type of dictionnary of outputs= map of output descriptors pointers. | |
Public Member Functions | |
virtual BlackBoxPointer | NewBlackBox (const std::string &boxname)=0 |
Releases a descriptor. | |
const std::string & | GetTypeName () const |
Returns the name of the **TYPE** of the black box. | |
std::string | GetFullTypeName () const |
Returns the full name of the **TYPE** of the black box (+package name). | |
const std::string & | GetDescription () const |
Returns the description of the BlackBox. | |
const std::string & | GetAuthor () const |
Returns the author(s) of the BlackBox. | |
const std::string & | GetCategory () const |
Returns the category(s) of the BlackBox. | |
PackagePointer | GetPackage () const |
Returns the Package to which the box belongs (const pointer). | |
Kind | GetKind () const |
Returns the kind of box. | |
virtual void | GetHelp (bool full=true) const |
Prints help on the black box. | |
const InputDescriptorMapType & | GetInputDescriptorMap () const |
Returns a const ref on the map of input descriptors. | |
const OutputDescriptorMapType & | GetOutputDescriptorMap () const |
Returns a const ref on the map of output descriptors. | |
const InputDescriptor * | GetInputDescriptor (const std::string &name) const |
Returns a const pointer on the descriptor of the input of name <name>. | |
const OutputDescriptor * | GetOutputDescriptor (const std::string &name) const |
Returns a const pointer on the descriptor of the output of name <name>. | |
void | SetTypeName (const std::string &name) |
Sets the name of the **TYPE** of BlackBox. | |
void | AddToDescription (const std::string &, bool clear=false) |
Adds the string to the BlackBox description. | |
void | AddToAuthor (const std::string &, bool clear=false) |
Adds the string to the BlackBox author list. | |
void | AddToCategory (const std::string &, bool clear=false) |
Adds the string to the BlackBox category list. | |
void | SetPackage (PackagePointer package) |
Sets the Package to which the box belongs. | |
void | SetKind (Kind kind) |
Sets the kind of box. | |
virtual void | InsertHtmlHelp (std::ofstream &s, int detail, int level, const std::string &output_dir="", bool relative_link=false) |
virtual void | Check (bool recursive=true) const |
Check. | |
virtual std::string | GetObjectName () const |
virtual std::string | GetObjectInfo () const |
virtual size_t | GetObjectSize () const |
virtual size_t | GetObjectInternalSize () const |
virtual size_t | GetObjectRecursiveSize () const |
long | GetUseCount () |
Static Public Member Functions | |
static void | InsertInObjectList (Pointer) |
static void | RemoveFromObjectList (WeakPointer) |
static void | InsertInPackageList (Pointer) |
static void | ReleasePackages () |
static void | PrintObjectListInfo (const std::string &name) |
static void | PrintObjectInfo (const Pointer &o) |
static long | GetObjectsCount () |
Protected Member Functions | |
BlackBoxDescriptor () | |
Default ctor. | |
BlackBoxDescriptor (const BlackBoxDescriptor &) | |
Default ctor. | |
virtual | ~BlackBoxDescriptor () |
Dtor. | |
void | AddInputDescriptor (BlackBoxInputDescriptor *d) |
Adds an input descriptor. | |
void | AddOutputDescriptor (BlackBoxOutputDescriptor *d) |
Adds an output descriptor. | |
void | LockThis () |
void | UnLockThis () |
template<class U> | |
boost::shared_ptr< U > | GetThisPointer () const |
Static Protected Member Functions | |
template<class U> | |
static boost::shared_ptr< U > | MakePointer (U *s, bool lock=false) |
template<class U, class D> | |
static boost::shared_ptr< U > | MakePointer (U *s, const D &del, bool lock=false) |
Protected Attributes | |
std::string | mTypeName |
The name of the type of black box. | |
std::string | mDescription |
The description of the black box. | |
std::string | mAuthor |
The author of the black box. | |
std::string | mCategory |
The category of the black box. | |
Kind | mKind |
The kind of box (standard / adaptor). | |
PackagePointer | mPackage |
The Package to which the box belongs. | |
InputDescriptorMapType | mInput |
The inputs. | |
OutputDescriptorMapType | mOutput |
The outputs. | |
Friends | |
struct | Object::Deleter |
Definition at line 59 of file bbtkBlackBoxDescriptor.h.
typedef BlackBoxDescriptor bbtk::BlackBoxDescriptor::Self |
Definition at line 61 of file bbtkBlackBoxDescriptor.h.
typedef boost::shared_ptr<Self> bbtk::BlackBoxDescriptor::Pointer |
typedef boost::weak_ptr<Self> bbtk::BlackBoxDescriptor::WeakPointer |
typedef BlackBoxInputDescriptor bbtk::BlackBoxDescriptor::InputDescriptor |
typedef BlackBoxOutputDescriptor bbtk::BlackBoxDescriptor::OutputDescriptor |
typedef std::map<std::string, InputDescriptor*> bbtk::BlackBoxDescriptor::InputDescriptorMapType |
The type of dictionnary of inputs = map of input descriptors pointers.
Definition at line 68 of file bbtkBlackBoxDescriptor.h.
typedef std::map<std::string, OutputDescriptor*> bbtk::BlackBoxDescriptor::OutputDescriptorMapType |
The type of dictionnary of outputs= map of output descriptors pointers.
Definition at line 70 of file bbtkBlackBoxDescriptor.h.
enum bbtk::BlackBoxDescriptor::Kind |
The kinds of black box.
Definition at line 72 of file bbtkBlackBoxDescriptor.h.
00073 { 00074 STANDARD=0, 00075 ADAPTOR=1, 00076 DEFAULT_ADAPTOR=2, 00077 GUI=3, 00078 DEFAULT_GUI=4 00079 }
bbtk::BlackBoxDescriptor::BlackBoxDescriptor | ( | ) | [protected] |
Default ctor.
Definition at line 52 of file bbtkBlackBoxDescriptor.cxx.
References bbtkDebugMessage.
00053 : mTypeName("Unknown"), 00054 mDescription(""), 00055 mAuthor(""), 00056 mCategory(""), 00057 mKind(STANDARD), 00058 mPackage() 00059 { 00060 bbtkDebugMessage("object",4, 00061 "==> BlackBoxDescriptor::BlackBoxDescriptor()"<<std::endl); 00062 bbtkDebugMessage("object",4, 00063 "<== BlackBoxDescriptor::BlackBoxDescriptor()"<<std::endl); 00064 }
bbtk::BlackBoxDescriptor::BlackBoxDescriptor | ( | const BlackBoxDescriptor & | ) | [protected] |
bbtk::BlackBoxDescriptor::~BlackBoxDescriptor | ( | ) | [protected, virtual] |
Dtor.
Definition at line 74 of file bbtkBlackBoxDescriptor.cxx.
References bbtkDebugMessage, bbtk::i, mInput, mOutput, and mTypeName.
00075 { 00076 bbtkDebugMessage("object",4, 00077 "==> BlackBoxDescriptor::~BlackBoxDescriptor() [" 00078 <<mTypeName<<"]"<<std::endl); 00079 00080 // deletes all I/O descriptors 00081 InputDescriptorMapType::iterator i; 00082 for (i=mInput.begin(); i!=mInput.end(); ++i) delete i->second; 00083 OutputDescriptorMapType::iterator o; 00084 for (o=mOutput.begin(); o!=mOutput.end(); ++o) delete o->second; 00085 00086 bbtkDebugMessage("object",4, 00087 "<== BlackBoxDescriptor::~BlackBoxDescriptor() [" 00088 <<mTypeName<<"]"<<std::endl); 00089 }
virtual BlackBoxPointer bbtk::BlackBoxDescriptor::NewBlackBox | ( | const std::string & | boxname | ) | [pure virtual] |
Releases a descriptor.
Creates an instance with name boxname of the BlackBox of which this is the descriptor
const std::string& bbtk::BlackBoxDescriptor::GetTypeName | ( | ) | const [inline] |
Returns the name of the **TYPE** of the black box.
Definition at line 90 of file bbtkBlackBoxDescriptor.h.
Referenced by InsertHtmlHelp(), and bbtk::WxGUIPackageBrowser2::WxGUIBlackBoxListUserOnSelected().
00090 { return mTypeName; }
std::string bbtk::BlackBoxDescriptor::GetFullTypeName | ( | ) | const |
Returns the full name of the **TYPE** of the black box (+package name).
Definition at line 299 of file bbtkBlackBoxDescriptor.cxx.
References GetPackage(), and mTypeName.
Referenced by AddToAuthor(), AddToCategory(), AddToDescription(), GetHelp(), GetInputDescriptor(), GetOutputDescriptor(), and InsertHtmlHelp().
00300 { 00301 if (GetPackage()!=0) return GetPackage()->GetName() + "::" + mTypeName; 00302 return "::" + mTypeName; 00303 }
const std::string& bbtk::BlackBoxDescriptor::GetDescription | ( | ) | const [inline] |
Returns the description of the BlackBox.
Definition at line 96 of file bbtkBlackBoxDescriptor.h.
Referenced by GetHelp(), InsertHtmlHelp(), and bbtk::WxGUIBlackBoxInfo::UpdateInfo().
00096 { return mDescription; }
const std::string& bbtk::BlackBoxDescriptor::GetAuthor | ( | ) | const [inline] |
Returns the author(s) of the BlackBox.
Definition at line 99 of file bbtkBlackBoxDescriptor.h.
Referenced by GetHelp(), InsertHtmlHelp(), and bbtk::WxGUIBlackBoxInfo::UpdateInfo().
00099 { return mAuthor; }
const std::string& bbtk::BlackBoxDescriptor::GetCategory | ( | ) | const [inline] |
Returns the category(s) of the BlackBox.
Definition at line 102 of file bbtkBlackBoxDescriptor.h.
Referenced by GetHelp(), InsertHtmlHelp(), and bbtk::WxGUIBlackBoxInfo::UpdateInfo().
00102 { return mCategory; }
PackagePointer bbtk::BlackBoxDescriptor::GetPackage | ( | ) | const [inline] |
Returns the Package to which the box belongs (const pointer).
Definition at line 105 of file bbtkBlackBoxDescriptor.h.
Referenced by GetFullTypeName(), InsertHtmlHelp(), and bbtk::WxGUIPackageBrowser2::WxGUIBlackBoxListUserOnSelected().
00105 { return mPackage; }
Kind bbtk::BlackBoxDescriptor::GetKind | ( | ) | const [inline] |
Returns the kind of box.
Definition at line 108 of file bbtkBlackBoxDescriptor.h.
00108 { return mKind; }
void bbtk::BlackBoxDescriptor::GetHelp | ( | bool | full = true |
) | const [virtual] |
Prints help on the black box.
Definition at line 216 of file bbtkBlackBoxDescriptor.cxx.
References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkMessage, GetAuthor(), GetCategory(), GetDescription(), GetFullTypeName(), bbtk::i, mInput, and mOutput.
00217 { 00218 bbtkDebugMessageInc("Kernel",9,"BlackBoxDescriptor::GetHelp() ["<<GetFullTypeName()<<"]"<<std::endl); 00219 00220 bbtkMessage("Help",1,"Black Box <"<<GetFullTypeName()<<">"<<std::endl); 00221 bbtkMessage("Help",1," " <<GetDescription()<<std::endl); 00222 bbtkMessage("Help",1," By : " <<GetAuthor() <<std::endl); 00223 bbtkMessage("Help",1," Categories : " <<GetCategory() <<std::endl); 00224 if (mInput.size()) 00225 bbtkMessage("Help",1," * Inputs : "<<std::endl); 00226 else 00227 bbtkMessage("Help",1," * No inputs"<<std::endl); 00228 InputDescriptorMapType::const_iterator i; 00229 unsigned int namelmax = 0; 00230 unsigned int typelmax = 0; 00231 unsigned int natlmax = 0; 00232 for ( i = mInput.begin(); i != mInput.end(); ++i ) 00233 { 00234 if (i->second->GetName().size()>namelmax) 00235 namelmax = i->second->GetName().size(); 00236 if (i->second->GetHumanTypeName().size()>typelmax) 00237 typelmax = i->second->GetHumanTypeName().size(); 00238 if (i->second->GetNature().size()>natlmax) 00239 natlmax = i->second->GetNature().size(); 00240 } 00241 OutputDescriptorMapType::const_iterator o; 00242 for ( o = mOutput.begin(); o != mOutput.end(); ++o ) 00243 { 00244 if (o->second->GetName().size()>namelmax) 00245 namelmax = o->second->GetName().size(); 00246 if (o->second->GetHumanTypeName().size()>typelmax) 00247 typelmax = o->second->GetHumanTypeName().size(); 00248 if (o->second->GetNature().size()>natlmax) 00249 natlmax = o->second->GetNature().size(); 00250 } 00251 // 00252 for ( i = mInput.begin(); i != mInput.end(); ++i ) 00253 { 00254 std::string name(i->second->GetName()); 00255 name += "'"; 00256 name.append(1+namelmax-name.size(),' '); 00257 std::string type(i->second->GetHumanTypeName()); 00258 type += ">"; 00259 type.append(1+typelmax-type.size(),' '); 00260 std::string nature(i->second->GetNature()); 00261 nature += "]"; 00262 nature.append(1+natlmax-nature.size(),' '); 00263 bbtkMessage("Help",1, 00264 " '"<<name 00265 <<" <"<<type 00266 <<" ["<<nature 00267 <<" : "<<i->second->GetDescription()<<std::endl); 00268 } 00269 if (mOutput.size()) 00270 bbtkMessage("Help",1," * Outputs : "<<std::endl); 00271 else 00272 bbtkMessage("Help",1," * No outputs"<<std::endl); 00273 for ( o = mOutput.begin(); o != mOutput.end(); ++o ) 00274 { 00275 std::string name(o->second->GetName()); 00276 name += "'"; 00277 name.append(1+namelmax-name.size(),' '); 00278 std::string type(o->second->GetHumanTypeName()); 00279 type += ">"; 00280 type.append(1+typelmax-type.size(),' '); 00281 std::string nature(o->second->GetNature()); 00282 nature += "]"; 00283 nature.append(1+natlmax-nature.size(),' '); 00284 bbtkMessage("Help",1, 00285 " '"<<name 00286 <<" <"<<type 00287 <<" ["<<nature 00288 <<" : "<<o->second->GetDescription()<<std::endl); 00289 } 00290 00291 bbtkDebugDecTab("Kernel",9); 00292 00293 00294 }
const InputDescriptorMapType& bbtk::BlackBoxDescriptor::GetInputDescriptorMap | ( | ) | const [inline] |
Returns a const ref on the map of input descriptors.
Definition at line 114 of file bbtkBlackBoxDescriptor.h.
Referenced by InsertHtmlHelp(), and bbtk::WxGUIBlackBoxInfo::UpdateInfo().
00115 { return mInput; }
const OutputDescriptorMapType& bbtk::BlackBoxDescriptor::GetOutputDescriptorMap | ( | ) | const [inline] |
Returns a const ref on the map of output descriptors.
Definition at line 118 of file bbtkBlackBoxDescriptor.h.
Referenced by InsertHtmlHelp(), and bbtk::WxGUIBlackBoxInfo::UpdateInfo().
00119 { return mOutput; }
const BlackBoxDescriptor::InputDescriptor * bbtk::BlackBoxDescriptor::GetInputDescriptor | ( | const std::string & | name | ) | const |
Returns a const pointer on the descriptor of the input of name <name>.
Definition at line 181 of file bbtkBlackBoxDescriptor.cxx.
References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkError, GetFullTypeName(), bbtk::i, and mInput.
00182 { 00183 bbtkDebugMessageInc("Kernel",9,"BlackBoxDescriptor::GetInputDescriptor('" 00184 <<name<<"') ["<<GetFullTypeName()<<"]"<<std::endl); 00185 00186 InputDescriptorMapType::const_iterator i; 00187 i = mInput.find(name); 00188 if ( i == mInput.end() ) 00189 { 00190 bbtkError("input '"<<name<<"' does not exist"); 00191 } 00192 bbtkDebugDecTab("Kernel",9); 00193 return i->second; 00194 }
const BlackBoxDescriptor::OutputDescriptor * bbtk::BlackBoxDescriptor::GetOutputDescriptor | ( | const std::string & | name | ) | const |
Returns a const pointer on the descriptor of the output of name <name>.
Definition at line 199 of file bbtkBlackBoxDescriptor.cxx.
References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkError, GetFullTypeName(), bbtk::i, and mOutput.
00200 { 00201 bbtkDebugMessageInc("Kernel",9,"BlackBoxDescriptor::GetOutputDescriptor('" 00202 <<name<<"') ["<<GetFullTypeName()<<"]"<<std::endl); 00203 00204 OutputDescriptorMapType::const_iterator i; 00205 i = mOutput.find(name); 00206 if ( i == mOutput.end() ) 00207 { 00208 bbtkError("output '"<<name<<"' does not exist"); 00209 } 00210 bbtkDebugDecTab("Kernel",9); 00211 return i->second; 00212 }
void bbtk::BlackBoxDescriptor::SetTypeName | ( | const std::string & | name | ) | [inline] |
Sets the name of the **TYPE** of BlackBox.
Definition at line 128 of file bbtkBlackBoxDescriptor.h.
00128 { mTypeName=name; }
void bbtk::BlackBoxDescriptor::AddToDescription | ( | const std::string & | s, | |
bool | clear = false | |||
) |
Adds the string to the BlackBox description.
Definition at line 147 of file bbtkBlackBoxDescriptor.cxx.
References bbtkDebugMessage, GetFullTypeName(), and mDescription.
00148 { 00149 bbtkDebugMessage("Kernel",9,"BlackBoxDescriptor::AddToDescription(\""<<s<< 00150 "\") ["<<GetFullTypeName()<<"]"<<std::endl); 00151 if (clear) mDescription = s; 00152 else mDescription += s; 00153 }
void bbtk::BlackBoxDescriptor::AddToAuthor | ( | const std::string & | s, | |
bool | clear = false | |||
) |
Adds the string to the BlackBox author list.
Definition at line 158 of file bbtkBlackBoxDescriptor.cxx.
References bbtkDebugMessage, GetFullTypeName(), and mAuthor.
00159 { 00160 bbtkDebugMessage("Kernel",9,"BlackBoxDescriptor::AddToAuthor(\""<<s<<"\") [" 00161 <<GetFullTypeName()<<"]"<<std::endl); 00162 if (clear) mAuthor = s; 00163 else mAuthor += s; 00164 }
void bbtk::BlackBoxDescriptor::AddToCategory | ( | const std::string & | s, | |
bool | clear = false | |||
) |
Adds the string to the BlackBox category list.
Definition at line 169 of file bbtkBlackBoxDescriptor.cxx.
References bbtkDebugMessage, GetFullTypeName(), and mCategory.
00170 { 00171 bbtkDebugMessage("Kernel",9,"BlackBoxDescriptor::AddToCategory(\""<<s<<"\") [" 00172 <<GetFullTypeName()<<"]"<<std::endl); 00173 if (clear) mCategory = s; 00174 else mCategory += s; 00175 mCategory += ";"; 00176 }
void bbtk::BlackBoxDescriptor::SetPackage | ( | PackagePointer | package | ) | [inline] |
Sets the Package to which the box belongs.
Definition at line 140 of file bbtkBlackBoxDescriptor.h.
00140 { mPackage = package; }
void bbtk::BlackBoxDescriptor::SetKind | ( | Kind | kind | ) | [inline] |
Sets the kind of box.
Definition at line 143 of file bbtkBlackBoxDescriptor.h.
00143 { mKind = kind; }
void bbtk::BlackBoxDescriptor::InsertHtmlHelp | ( | std::ofstream & | s, | |
int | detail, | |||
int | level, | |||
const std::string & | output_dir = "" , |
|||
bool | relative_link = false | |||
) | [virtual] |
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 307 of file bbtkBlackBoxDescriptor.cxx.
References bbtkDebugDecTab, bbtkDebugMessageInc, GetAuthor(), GetCategory(), GetDescription(), GetFullTypeName(), GetInputDescriptorMap(), GetOutputDescriptorMap(), GetPackage(), and GetTypeName().
00311 { 00312 bbtkDebugMessageInc("Kernel",9,"BlackBoxDescriptor::InsertHtmlHelp() ["<<GetFullTypeName()<<"]"<<std::endl); 00313 00314 //------------- 00315 // General info 00316 std::string name = GetTypeName(); 00317 Utilities::html_format(name); 00318 00319 (s) << "<p><hr>\n"; 00320 (s) << "<a name=\""<<name<<"\"></a>\n"; 00321 (s) << //"Top: 00322 "<a rel=\"top\" accesskey=\"t\" href=\"#Top\">Top</a>\n"; 00323 // (s) << "Previous: <a rel="previous" accesskey="p" href="#dir">(dir)</a>, 00324 // (s) << "Up: <a rel="up" accesskey="u" href="#dir">(dir)</a> 00325 (s) << "<h2 class=\"section\">"<<name<<"</h2>\n"; 00326 00327 00328 std::string descr = GetDescription(); 00329 //Utilities::html_format(descr); 00330 std::string author = GetAuthor(); 00331 Utilities::html_format(author); 00332 00333 std::vector<std::string> categories; 00334 // Split the category string 00335 std::string delimiters = ";,"; 00336 Utilities::SplitString(GetCategory(), 00337 delimiters,categories); 00338 00339 00340 (s) << "<p><TABLE cellspacing=0 cellpadding=3>\n"; 00341 (s) << "<TR><TD style='vertical-align: top;'><b> Description </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'> " 00342 << descr << "</TD></TR>\n"; 00343 (s) << "<TR><TD style='vertical-align: top;'><b> Author(s) </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'> " 00344 << author << "</TD></TR>\n"; 00345 (s) << "<TR><TD style='vertical-align: top;'><b> Category(s) </b></TD><TD style='vertical-align: top;'> : </TD><TD style='vertical-align: top;'> "; 00346 std::vector<std::string>::iterator ci; 00347 for (ci=categories.begin(); ci!=categories.end(); ++ci) 00348 { 00349 s << "<a href=\"../index-category.html#"<< *ci <<"\">" << *ci 00350 << "</a> \n"; 00351 } 00352 s << "</TD></TR>\n"; 00353 00354 (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 " 00355 << GetPackage()->GetName() << "</TD></TR>\n"; 00356 (s) << "</TABLE>\n"; 00357 00358 //------------- 00359 // Graph 00360 //i->second->InsertHTMLGraph( &s , detail,level,dir); 00361 00362 //------------- 00363 // Inputs 00364 std::string titlecol("#BBBBFF"); 00365 std::string usercol("#FFFFFF"); 00366 std::string ubbcol("#DDFFFF"); 00367 std::string wxbbcol("#EEFFFF"); 00368 00369 00370 // (s) << "<h3 class=\"subsection\">Inputs</h3>\n"; 00371 (s) << "<p><TABLE border=1 cellspacing=0 cellpadding=3>\n"; 00372 (s) << "<TR><TD colspan=3 align=center bgcolor=\""<<titlecol 00373 <<"\">Inputs</TD></TR>\n"; 00374 00375 std::vector<std::string> user_defined; 00376 std::vector<std::string> ubb_defined; 00377 std::vector<std::string> wxbb_defined; 00378 00379 const BlackBoxDescriptor::InputDescriptorMapType& imap = 00380 GetInputDescriptorMap(); 00381 InputDescriptorMapType::const_iterator in; 00382 for ( in = imap.begin(); in != imap.end(); ++in ) 00383 { 00384 // Skips system-defined inputs 00385 std::string col(usercol); 00386 int iotype = 0; 00387 if (in->second->GetCreatorTypeInfo() == 00388 typeid(AtomicBlackBoxDescriptor)) 00389 { 00390 col = ubbcol; 00391 iotype = 1; 00392 } 00393 else if (in->second->GetCreatorTypeInfo() == 00394 typeid(WxBlackBoxDescriptor)) 00395 { 00396 col = wxbbcol; 00397 iotype = 2; 00398 } 00399 00400 std::string name(in->second->GetName()); 00401 Utilities::html_format(name); 00402 00403 std::string type("<"); 00404 type += in->second->GetTypeName(); 00405 type += ">"; 00406 Utilities::html_format(type); 00407 00408 std::string descr(in->second->GetDescription()); 00409 //Utilities::html_format(descr); 00410 00411 std::string out = 00412 "<TR><TD style='vertical-align: top;' bgcolor=\"" + col 00413 +"\"><B><PRE> "+name+" </PRE></B></TD>" 00414 + "<TD style='vertical-align: top;' bgcolor=\""+col 00415 +"\"><I><PRE> "+type+" </PRE></I></TD>" 00416 + "<TD style='vertical-align: top;' bgcolor=\""+col 00417 +"\">"+descr+"</TD></TR>\n"; 00418 00419 if (iotype==0) user_defined.push_back(out); 00420 else if (iotype==1) ubb_defined.push_back(out); 00421 else if (iotype==2) wxbb_defined.push_back(out); 00422 00423 } 00424 00425 std::vector<std::string>::iterator hi; 00426 for (hi=user_defined.begin();hi!=user_defined.end();++hi) s << *hi; 00427 for (hi=wxbb_defined.begin();hi!=wxbb_defined.end();++hi) s << *hi; 00428 for (hi=ubb_defined.begin();hi!=ubb_defined.end();++hi) s << *hi; 00429 00430 user_defined.clear(); 00431 ubb_defined.clear(); 00432 wxbb_defined.clear(); 00433 00434 //------------- 00435 // Outputs 00436 // (s) << "<h3 class=\"subsection\">Outputs</h3>\n"; 00437 // (s) << "<TABLE border=1 cellspacing=0>\n"; 00438 (s) << "<TR><TD colspan=3 align=center bgcolor=\""<<titlecol 00439 <<"\">Outputs</TD></TR>\n"; 00440 00441 const BlackBoxDescriptor::OutputDescriptorMapType& omap = 00442 GetOutputDescriptorMap(); 00443 00444 BlackBoxDescriptor::OutputDescriptorMapType::const_iterator o; 00445 00446 for ( o = omap.begin(); o != omap.end(); ++o ) 00447 { 00448 std::string col(usercol); 00449 int iotype = 0; 00450 if (o->second->GetCreatorTypeInfo() == 00451 typeid(AtomicBlackBoxDescriptor)) 00452 { 00453 col = ubbcol; 00454 iotype = 1; 00455 } 00456 else if (o->second->GetCreatorTypeInfo() == 00457 typeid(WxBlackBoxDescriptor)) 00458 { 00459 col = wxbbcol; 00460 iotype = 2; 00461 } 00462 00463 std::string name(o->second->GetName()); 00464 Utilities::html_format(name); 00465 00466 std::string type("<"); 00467 type += o->second->GetTypeName(); 00468 type += ">"; 00469 Utilities::html_format(type); 00470 00471 std::string descr(o->second->GetDescription()); 00472 //Utilities::html_format(descr); 00473 00474 std::string out = 00475 "<TR><TD style='vertical-align: top;' bgcolor=\"" + col 00476 +"\"><B><PRE> "+name+" </PRE></B></TD>" 00477 + "<TD style='vertical-align: top;' bgcolor=\""+col 00478 +"\"><I><PRE> "+type+" </PRE></I></TD>" 00479 + "<TD style='vertical-align: top;' bgcolor=\""+col 00480 +"\">"+descr+"</TD></TR>\n"; 00481 00482 if (iotype==0) user_defined.push_back(out); 00483 else if (iotype==1) ubb_defined.push_back(out); 00484 else if (iotype==2) wxbb_defined.push_back(out); 00485 00486 } 00487 00488 for (hi=user_defined.begin();hi!=user_defined.end();++hi) s << *hi; 00489 for (hi=wxbb_defined.begin();hi!=wxbb_defined.end();++hi) s << *hi; 00490 for (hi=ubb_defined.begin();hi!=ubb_defined.end();++hi) s << *hi; 00491 00492 (s) << "</TABLE>\n"; 00493 00494 //------------ 00495 // End 00496 00497 bbtkDebugDecTab("Kernel",9); 00498 }
void bbtk::BlackBoxDescriptor::Check | ( | bool | recursive = true |
) | const [virtual] |
void bbtk::BlackBoxDescriptor::AddInputDescriptor | ( | BlackBoxInputDescriptor * | d | ) | [inline, protected] |
Adds an input descriptor.
Definition at line 163 of file bbtkBlackBoxDescriptor.h.
References bbtk::BlackBoxInputOutputDescriptor::GetName().
00164 { mInput[d->GetName()] = d; }
void bbtk::BlackBoxDescriptor::AddOutputDescriptor | ( | BlackBoxOutputDescriptor * | d | ) | [inline, protected] |
Adds an output descriptor.
Definition at line 166 of file bbtkBlackBoxDescriptor.h.
References bbtk::BlackBoxInputOutputDescriptor::GetName().
00167 { mOutput[d->GetName()] = d; }
std::string bbtk::Object::GetObjectName | ( | ) | const [virtual, inherited] |
Reimplemented in bbtk::Connection, bbtk::Executer, bbtk::Factory, bbtk::Interpreter, bbtk::Package, and bbtk::Transcriptor.
Definition at line 91 of file bbtkObject.cxx.
Referenced by bbtk::BlackBox::Deleter::Delete(), and bbtk::Object::Deleter::operator()().
std::string bbtk::Object::GetObjectInfo | ( | ) | const [virtual, inherited] |
Reimplemented in bbtk::Connection, bbtk::Executer, bbtk::Factory, bbtk::Interpreter, bbtk::Package, and bbtk::Transcriptor.
Definition at line 98 of file bbtkObject.cxx.
virtual size_t bbtk::Object::GetObjectSize | ( | ) | const [inline, virtual, inherited] |
Reimplemented in bbtk::Connection, bbtk::Executer, bbtk::Factory, bbtk::Interpreter, bbtk::Package, and bbtk::Transcriptor.
Definition at line 60 of file bbtkObject.h.
00060 { return sizeof(Object); }
virtual size_t bbtk::Object::GetObjectInternalSize | ( | ) | const [inline, virtual, inherited] |
Reimplemented in bbtk::Connection, bbtk::Executer, bbtk::Factory, bbtk::Interpreter, bbtk::Package, and bbtk::Transcriptor.
Definition at line 61 of file bbtkObject.h.
00061 { return sizeof(Object); }
virtual size_t bbtk::Object::GetObjectRecursiveSize | ( | ) | const [inline, virtual, inherited] |
Reimplemented in bbtk::Connection, bbtk::Executer, bbtk::Factory, bbtk::Interpreter, bbtk::Package, and bbtk::Transcriptor.
Definition at line 62 of file bbtkObject.h.
00062 { return sizeof(Object); }
long bbtk::Object::GetUseCount | ( | ) | [inline, inherited] |
void bbtk::Object::InsertInObjectList | ( | Pointer | p | ) | [static, inherited] |
Definition at line 59 of file bbtkObject.cxx.
References bbtkDebugMessage, and bbtk::Object::mgObjectList.
00060 { 00061 bbtkDebugMessage("object",9,"##> Object::InsertInObjectList(\"" 00062 <<p->GetObjectName()<<"\" ["<<p<<"])"<<std::endl); 00063 boost::weak_ptr<Object> w(p); 00064 mgObjectList.insert(w); 00065 }
void bbtk::Object::RemoveFromObjectList | ( | WeakPointer | p | ) | [static, inherited] |
Definition at line 80 of file bbtkObject.cxx.
References bbtkDebugMessage, and bbtk::Object::mgObjectList.
00081 { 00082 bbtkDebugMessage("object",9,"##> Object::RemoveFromObjectList()" 00083 <<std::endl); 00084 mgObjectList.erase(p); 00085 00086 }
void bbtk::Object::InsertInPackageList | ( | Pointer | p | ) | [static, inherited] |
Definition at line 69 of file bbtkObject.cxx.
References bbtkDebugMessage, and bbtk::Object::mgPackageList.
00070 { 00071 bbtkDebugMessage("object",9,"##> Object::InsertInPackageList(\"" 00072 <<p->GetObjectName()<<"\" ["<<p<<"])"<<std::endl); 00073 boost::weak_ptr<Object> w(p); 00074 mgPackageList.insert(w); 00075 }
void bbtk::Object::ReleasePackages | ( | ) | [static, inherited] |
Definition at line 213 of file bbtkObject.cxx.
References bbtkDebugMessage, bbtk::i, and bbtk::Object::mgPackageList.
00214 { 00215 bbtkDebugMessage("object",1,"##> Object::ReleasePackages()"<<std::endl); 00216 // Release package pointers 00217 ObjectListType::iterator i; 00218 for (i = mgPackageList.begin(); 00219 i!= mgPackageList.end(); 00220 ++i) 00221 { 00222 if (i->use_count() != 0) 00223 { 00224 bbtkDebugMessage("object",1,"##> Releasing package '"<< 00225 i->lock()->GetThisPointer<Package>()->GetName() 00226 <<"'"<<std::endl); 00227 // Object::Pointer p(i->lock()); 00228 Package::WeakPointer w(i->lock()->GetThisPointer<Package>()); 00229 Package::Release(w); 00230 /* 00231 if (p->GetObjectName().find(name) != std::string::npos ) 00232 { 00233 std::cout << n << "/" << mgObjectList.size() << " "; 00234 PrintObjectInfo(p); 00235 m += p->GetObjectSize(); 00236 n++; 00237 } 00238 */ 00239 } 00240 } 00241 00242 }
void bbtk::Object::PrintObjectListInfo | ( | const std::string & | name | ) | [static, inherited] |
Definition at line 105 of file bbtkObject.cxx.
References bbtk::i, bbtk::Object::mgObjectList, and bbtk::Object::PrintObjectInfo().
00106 { 00107 00108 std::cout 00109 << "=============== Living bbtk::Object pointers ========="<<std::endl; 00110 00111 long n = 0; 00112 long u = 0; 00113 size_t m = 0; 00114 ObjectListType::iterator i; 00115 for (i = mgObjectList.begin(); 00116 i!=mgObjectList.end(); 00117 ++i) 00118 { 00119 if (i->use_count() == 0) 00120 { 00121 u++; 00122 } 00123 else 00124 { 00125 Object::Pointer p(i->lock()); 00126 if (p->GetObjectName().find(name) != std::string::npos ) 00127 { 00128 std::cout << n << "/" << mgObjectList.size() << " "; 00129 PrintObjectInfo(p); 00130 m += p->GetObjectSize(); 00131 n++; 00132 } 00133 } 00134 } 00135 std::cout 00136 << "------------------------------------------------------"<<std::endl; 00137 00138 std::cout << " Total : "<<n<<" objects - "<<m<<" b"<<std::endl; 00139 if (u==1) 00140 { 00141 std::cout<<"* Note : "<<u 00142 <<" object in list has 0 ref count, " 00143 <<"i.e. destroyed without removing itself from the living objects list ! (this is just an implementation error not a memory leak)"<<std::endl; 00144 } 00145 else if (u>1) 00146 { 00147 std::cout<<"* Note : "<<u 00148 <<" objects in list have 0 ref count, " 00149 <<"i.e. destroyed without removing themselves from the living objects list ! (this is just an implementation error not a memory leak)"<<std::endl; 00150 } 00151 std::cout 00152 << "============ EO Living bbtk::Object pointers ========="<<std::endl; 00153 00154 }
void bbtk::Object::PrintObjectInfo | ( | const Pointer & | o | ) | [static, inherited] |
Definition at line 180 of file bbtkObject.cxx.
Referenced by bbtk::Object::PrintObjectListInfo().
00181 { 00182 std::cout << "* [" << p << "] \t" 00183 << p.use_count()-1 << " r \t" 00184 << p->GetObjectRecursiveSize() << " (" 00185 << p->GetObjectSize() << ") b \t" 00186 << p->GetObjectName() 00187 << std::endl; 00188 std::cout << p->GetObjectInfo(); 00189 }
static long bbtk::Object::GetObjectsCount | ( | ) | [inline, static, inherited] |
void bbtk::Object::LockThis | ( | ) | [inline, protected, inherited] |
void bbtk::Object::UnLockThis | ( | ) | [inline, protected, inherited] |
boost::shared_ptr<U> bbtk::Object::GetThisPointer | ( | ) | const [inline, protected, inherited] |
Definition at line 92 of file bbtkObject.h.
00093 { 00094 return boost::dynamic_pointer_cast<U>(mThisPointer.lock()); 00095 }
static boost::shared_ptr<U> bbtk::Object::MakePointer | ( | U * | s, | |
bool | lock = false | |||
) | [inline, static, protected, inherited] |
Definition at line 97 of file bbtkObject.h.
Referenced by bbtk::Executer::Executer(), bbtk::Interpreter::Init(), bbtk::Transcriptor::New(), bbtk::Package::New(), bbtk::Interpreter::New(), bbtk::Factory::New(), and bbtk::Executer::New().
00098 { 00099 if (s->mThisPointer.lock()) 00100 { 00101 boost::shared_ptr<U> p = s->GetThisPointer<U>(); 00102 if (!lock) s->mThisPointerLocked.reset(); 00103 return p; 00104 } 00105 boost::shared_ptr<U> p = boost::shared_ptr<U>(s,Object::Deleter()); 00106 static_cast<Object::Deleter*> 00107 (p._internal_get_deleter(typeid(Object::Deleter))) 00108 ->mPointer = p; 00109 s->mThisPointer = p; 00110 Object::InsertInObjectList(p); 00111 if (lock) s->LockThis(); 00112 return p; 00113 }
static boost::shared_ptr<U> bbtk::Object::MakePointer | ( | U * | s, | |
const D & | del, | |||
bool | lock = false | |||
) | [inline, static, protected, inherited] |
Definition at line 115 of file bbtkObject.h.
00118 { 00119 if (s->mThisPointer.lock()) 00120 { 00121 boost::shared_ptr<U> p = s->GetThisPointer<U>(); 00122 if (!lock) s->mThisPointerLocked.reset(); 00123 return p; 00124 } 00125 boost::shared_ptr<U> p = boost::shared_ptr<U>(s,del); 00126 static_cast<D*> 00127 (p._internal_get_deleter(typeid(D))) 00128 ->mPointer = p; 00129 s->mThisPointer = p; 00130 Object::InsertInObjectList(p); 00131 if (lock) s->LockThis(); 00132 return p; 00133 }
friend struct Object::Deleter [friend] |
Definition at line 61 of file bbtkBlackBoxDescriptor.h.
std::string bbtk::BlackBoxDescriptor::mTypeName [protected] |
The name of the type of black box.
Definition at line 171 of file bbtkBlackBoxDescriptor.h.
Referenced by GetFullTypeName(), and ~BlackBoxDescriptor().
std::string bbtk::BlackBoxDescriptor::mDescription [protected] |
The description of the black box.
Definition at line 173 of file bbtkBlackBoxDescriptor.h.
Referenced by AddToDescription().
std::string bbtk::BlackBoxDescriptor::mAuthor [protected] |
The author of the black box.
Definition at line 175 of file bbtkBlackBoxDescriptor.h.
Referenced by AddToAuthor().
std::string bbtk::BlackBoxDescriptor::mCategory [protected] |
The category of the black box.
Definition at line 177 of file bbtkBlackBoxDescriptor.h.
Referenced by AddToCategory().
Kind bbtk::BlackBoxDescriptor::mKind [protected] |
PackagePointer bbtk::BlackBoxDescriptor::mPackage [protected] |
InputDescriptorMapType bbtk::BlackBoxDescriptor::mInput [protected] |
The inputs.
Definition at line 183 of file bbtkBlackBoxDescriptor.h.
Referenced by GetHelp(), GetInputDescriptor(), and ~BlackBoxDescriptor().
OutputDescriptorMapType bbtk::BlackBoxDescriptor::mOutput [protected] |
The outputs.
Definition at line 185 of file bbtkBlackBoxDescriptor.h.
Referenced by GetHelp(), GetOutputDescriptor(), and ~BlackBoxDescriptor().