#include <bbtkFactory.h>
Public Types | |
enum | IndexEntryType { Packages, Categories, Initials, Adaptors } |
typedef Factory | Self |
typedef boost::shared_ptr< Self > | Pointer |
typedef boost::weak_ptr< Self > | WeakPointer |
typedef std::map< std::string, Package::Pointer > | PackageMapType |
The type of map of packages. | |
Public Member Functions | |
std::string | GetObjectName () const |
std::string | GetObjectInfo () const |
size_t | GetObjectSize () const |
size_t | GetObjectInternalSize () const |
size_t | GetObjectRecursiveSize () const |
void | GetPackagesList (std::vector< std::string > &) |
void | LoadPackage (const std::string &name) |
Loads a package. | |
void | UnLoadPackage (const std::string &name) |
UnLoads a package. | |
void | PrintPackages (bool details=true, bool adaptors=false) const |
Displays the list of packages loaded. | |
void | HelpPackage (const std::string &name, bool adaptors=false) const |
Displays help on a package. | |
void | HelpBlackBox (const std::string &name, std::string &package, bool full=true) const |
void | ShowGraphTypes (const std::string &name) const |
void | InsertPackage (Package::Pointer) |
Inserts a package in the factory. | |
void | RemovePackage (Package::Pointer) |
Removes a package from the factory (and deletes it). | |
Package::Pointer | GetPackage (const std::string &name) const |
BlackBox::Pointer | NewBlackBox (const std::string &type, const std::string &name) const |
Creates an instance of a black box of type <type> with name <name>. | |
BlackBox::Pointer | NewAdaptor (const DataInfo &typein, const DataInfo &typeout, const std::string &name) const |
Creates an instance of a black box of type <type> with name <name>. | |
BlackBox::Pointer | NewWidgetAdaptor (const DataInfo &typein, const DataInfo &typeout, const std::string &name) const |
Creates an instance of a black box of type <type> with name <name>. | |
bool | FindAdaptor (const DataInfo &typein, const DataInfo &typeout, std::string &adaptor) const |
Creates an instance of a black box of type <type> with name <name>. | |
bool | FindWidgetAdaptor (const DataInfo &typein, const DataInfo &typeout, std::string &adaptor) const |
Creates an instance of a black box of type <type> with name <name>. | |
bool | FindWidgetAdaptor2 (const DataInfo &typein, const DataInfo &typeout, std::string &widget, std::string &adaptor) const |
Creates an instance of a black box of type <type> with name <name>. | |
Connection::Pointer | NewConnection (BlackBox::Pointer from, const std::string &output, BlackBox::Pointer to, const std::string &input) const |
Creates an instance of a connection. | |
void | WriteDotFilePackagesList (FILE *ff) |
void | Reset () |
void | CheckPackages () const |
void | CreateHtmlIndex (IndexEntryType type, const std::string &filename) |
void | SetExecuter (ExecuterPointer e) |
Sets the executer who created the factory (if any). | |
ExecuterPointer | GetExecuter () |
Gets the executer who created the factory (if any). | |
const PackageMapType & | GetPackageMap () const |
long | GetUseCount () |
Static Public Member Functions | |
static Pointer | New () |
Default ctor. | |
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 Types | |
typedef Object | Superclass |
Protected Member Functions | |
Factory () | |
Default ctor. | |
Factory (const Factory &) | |
~Factory () | |
Dtor. | |
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) |
Private Member Functions | |
bool | DoLoadPackage (std::string libname, std::string pkgname, std::string path) |
Gets the executer who created the factory (if any) - const. | |
void | CloseAllPackages () |
void | ClosePackage (PackageMapType::iterator &i) |
Close the package referenced by the iterator. | |
Private Attributes | |
PackageMapType | mPackageMap |
The map of packages. | |
ExecuterWeakPointer | mExecuter |
The executer which created the factory (if any). | |
Friends | |
struct | Object::Deleter |
Definition at line 53 of file bbtkFactory.h.
typedef Factory bbtk::Factory::Self |
Definition at line 55 of file bbtkFactory.h.
typedef boost::shared_ptr<Self> bbtk::Factory::Pointer |
typedef boost::weak_ptr<Self> bbtk::Factory::WeakPointer |
typedef Object bbtk::Factory::Superclass [protected] |
Definition at line 55 of file bbtkFactory.h.
typedef std::map< std::string, Package::Pointer > bbtk::Factory::PackageMapType |
enum bbtk::Factory::IndexEntryType |
Definition at line 110 of file bbtkFactory.h.
00111 { 00112 Packages, 00113 Categories, 00114 Initials, 00115 Adaptors 00116 }
bbtk::Factory::Factory | ( | ) | [protected] |
Default ctor.
Definition at line 67 of file bbtkFactory.cxx.
References bbtkDebugMessage.
00068 : mExecuter() 00069 { 00070 bbtkDebugMessage("Kernel",7,"Factory::Factory()"<<std::endl); 00071 }
bbtk::Factory::Factory | ( | const Factory & | ) | [protected] |
bbtk::Factory::~Factory | ( | ) | [protected] |
Dtor.
Definition at line 76 of file bbtkFactory.cxx.
References bbtkDebugDecTab, bbtkDebugMessageInc, and CloseAllPackages().
00077 { 00078 bbtkDebugMessageInc("Kernel",7,"Factory::~Factory()"<<std::endl); 00079 CloseAllPackages(); 00080 bbtkDebugDecTab("Kernel",7); 00081 }
std::string bbtk::Factory::GetObjectName | ( | ) | const [virtual] |
std::string bbtk::Factory::GetObjectInfo | ( | ) | const [virtual] |
Reimplemented from bbtk::Object.
Definition at line 1052 of file bbtkFactory.cxx.
01053 { 01054 std::stringstream i; 01055 return i.str(); 01056 }
size_t bbtk::Factory::GetObjectSize | ( | ) | const [virtual] |
Reimplemented from bbtk::Object.
Definition at line 1060 of file bbtkFactory.cxx.
01061 { 01062 size_t s = Superclass::GetObjectSize(); 01063 s += Factory::GetObjectInternalSize(); 01064 return s; 01065 }
size_t bbtk::Factory::GetObjectInternalSize | ( | ) | const [virtual] |
Reimplemented from bbtk::Object.
Definition at line 1068 of file bbtkFactory.cxx.
01069 { 01070 size_t s = sizeof(Factory); 01071 return s; 01072 }
size_t bbtk::Factory::GetObjectRecursiveSize | ( | ) | const [virtual] |
Reimplemented from bbtk::Object.
Definition at line 1075 of file bbtkFactory.cxx.
References mPackageMap.
01076 { 01077 size_t s = Superclass::GetObjectRecursiveSize(); 01078 s += Factory::GetObjectInternalSize(); 01079 01080 PackageMapType::const_iterator i; 01081 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i ) 01082 { 01083 s += i->second->GetObjectRecursiveSize(); 01084 } 01085 return s; 01086 }
Factory::Pointer bbtk::Factory::New | ( | ) | [static] |
Default ctor.
Definition at line 58 of file bbtkFactory.cxx.
References bbtkDebugMessage, and bbtk::Object::MakePointer().
00059 { 00060 bbtkDebugMessage("Kernel",9,"Factory::New()"<<std::endl); 00061 return MakePointer(new Factory()); 00062 }
void bbtk::Factory::GetPackagesList | ( | std::vector< std::string > & | ) |
void bbtk::Factory::LoadPackage | ( | const std::string & | name | ) |
Loads a package.
The name is the system-independant name of the package (the name of the instance of bbtk::Package). Tries to open the dynamic library :
Definition at line 140 of file bbtkFactory.cxx.
References bbtkDebugMessageInc, bbtkError, bbtkMessage, DoLoadPackage(), bbtk::i, and mPackageMap.
00141 { 00142 // Note : in the following : 00143 // name : the user supplied name 00144 // - abreviated name e.g. pkg pkg.so libbpkg libbbpkg.so 00145 // - relative full name e.g. ./libbbpkg.so ../../libbbpkg.so 00146 // - absolute full name e.g. /home/usrname/proj/lib/libbbpkg.so 00147 // same for Windows, with c:, d: ... 00148 // 00149 // lastname : string before the last / (if any), or user supplied name 00150 00151 bbtkDebugMessageInc("Kernel",7,"Factory::LoadPackage(\""<<name<<"\")"<<std::endl); 00152 bbtkMessage("debug",1,"Factory::LoadPackage(\""<<name<<"\")"<<std::endl); 00153 00154 std::vector<std::string> package_paths; 00155 std::string libname; // full path library name 00156 std::string pkgname; // e.g. libbb<pkgname>.so 00157 00158 std::string upath; 00159 pkgname = Utilities::ExtractPackageName(name,upath); 00160 00161 bbtkMessage("debug",1,"Package name ["<<pkgname<<"]"<<std::endl); 00162 bbtkMessage("debug",1,"Package path ["<<upath<<"]"<<std::endl); 00163 00164 // no loading package if already loaded 00165 PackageMapType::iterator iUnload; 00166 iUnload = mPackageMap.find(pkgname); 00167 if (iUnload != mPackageMap.end()) 00168 { 00169 bbtkMessage("Output",2,"["<< pkgname <<"] already loaded" << std::endl); 00170 return; 00171 } 00172 00173 // ================================================= 00174 // The following structure was checked to work 00175 // with any type of relative/absolute path. 00176 // Please don't modify it without checking 00177 // *all* the cases. JP 00178 //================================================== 00179 00180 //std::cout << "upath [" << upath << "]" << std::endl; 00181 00182 bool ok = false; 00183 bool foundFile = false; 00184 00185 // If path provided by user will be the first scanned : 00186 // push it into vector of paths 00187 if (upath.length()>0) // ------------------------------------- check user supplied location 00188 { 00189 if (name[0] != '.' && name[0] != '/' && name[1]!= ':') 00190 { 00191 bbtkError("Use absolute or relative path name! ["<<name<<"] is an illegal name"); 00192 return; 00193 } 00194 00195 // std::string path = Utilities::ExpandLibName(upath, false); 00196 std::string path = Utilities::ExpandLibName(name,false); // keep last item, here. 00197 00198 if (path != "") 00199 { 00200 std::string p2; 00201 Utilities::ExtractPackageName(path,p2); 00202 //libname = Utilities::MakeLibnameFromPath(path, pkgname); 00203 libname = Utilities::MakeLibnameFromPath(p2, pkgname); // remove last item 00204 // Check if library exists 00205 if ( !Utilities::FileExists(libname) ) 00206 { 00207 // The following is *NOT* a debug time message : 00208 // It's a user intended message. 00209 // Please don't remove it. 00210 bbtkMessage("Output",3," [" <<libname 00211 <<"] : doesn't exist" <<std::endl); 00212 } 00213 else 00214 { 00215 ok = DoLoadPackage( libname, pkgname, path); 00216 } 00217 } 00218 else 00219 { 00220 bbtkError("Path ["<<upath<<"] doesn't exist"); 00221 return; 00222 } 00223 } 00224 else // ----------------------------------------------------- iterate on the paths 00225 { 00226 00227 std::string path; 00228 package_paths = ConfigurationFile::GetInstance().Get_package_paths(); 00229 std::vector<std::string>::iterator i; 00230 for (i=package_paths.begin();i!=package_paths.end();++i) 00231 { 00232 foundFile = false; 00233 path = *i; 00234 00235 // we *really* want '.' to be the current working directory 00236 if (path == ".") 00237 { 00238 char buf[2048]; // for getcwd 00239 char * currentDir = getcwd(buf, 2048); 00240 std::string cwd(currentDir); 00241 path = currentDir; 00242 } 00243 00244 libname = Utilities::MakeLibnameFromPath(path, pkgname); 00245 00246 bbtkMessage("debug",2,"-> Trying to load [" << libname << "]" <<std::endl); 00247 00248 // Check if library exists 00249 if ( !Utilities::FileExists(libname) ) 00250 { 00251 // The following is *NOT* a debug time message : 00252 // It's a user intended message. 00253 // Please don't remove it. 00254 bbtkMessage("Output",3, 00255 " [" <<libname <<"] : doesn't exist" <<std::endl); 00256 continue; // try next path 00257 } 00258 foundFile = true; 00259 00260 // Try to Load the library 00261 00262 ok = DoLoadPackage( libname, pkgname, path); 00263 if (ok) 00264 { 00265 bbtkMessage("debug",2," OK"<<std::endl); 00266 } 00267 break; // we stop iterating even if error : have to signal it to user 00268 } //------------------ // end for ( package_paths.begin();i!=package_paths.end() ) 00269 00270 } 00271 00272 if( !ok ) // nothing was loaded 00273 { 00274 if (!foundFile) 00275 { 00276 bbtkError("Could not find package ["<<pkgname<< "]"); 00277 } 00278 else 00279 { 00280 #if defined(__GNUC__) 00281 bbtkError("Could not load package ["<< pkgname 00282 <<"] :" << std::endl 00283 << " Opening "<<libname<<" failed" 00284 << " Reason: "<< dlerror()); 00285 #elif defined(_WIN32) 00286 bbtkError("Could not load package ["<<pkgname 00287 <<"] :"<< std::endl << " Error loading " <<libname); 00288 00289 // look how to get the error message on win 00290 //<<dlerror()); 00291 // it is the bordel !! (the bloody fucking bordel, you mean?) 00292 // look : http://msdn2.microsoft.com/en-us/library/ms680582.aspx 00293 #endif 00294 } 00295 } 00296 bbtkMessage("Output",2,"[" << libname << "] loaded" << std::endl); 00297 00298 }
void bbtk::Factory::UnLoadPackage | ( | const std::string & | name | ) |
UnLoads a package.
The package must have been previously loaded by LoadPackage. If the entry is found in the map, calls ClosePackage
Definition at line 305 of file bbtkFactory.cxx.
References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkError, ClosePackage(), bbtk::i, and mPackageMap.
00306 { 00307 bbtkDebugMessageInc("Kernel",7,"Factory::UnLoadPackage(\"" 00308 <<name<<"\")"<<std::endl); 00309 00310 PackageMapType::iterator i; 00311 i = mPackageMap.find(name); 00312 if (i == mPackageMap.end()) 00313 { 00314 bbtkError("cannot unload package \""<<name 00315 <<"\" : package not loaded !"); 00316 } 00317 ClosePackage(i); 00318 bbtkDebugDecTab("Kernel",7); 00319 }
void bbtk::Factory::PrintPackages | ( | bool | details = true , |
|
bool | adaptors = false | |||
) | const |
Displays the list of packages loaded.
Definition at line 372 of file bbtkFactory.cxx.
References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkMessage, bbtk::i, and mPackageMap.
00373 { 00374 bbtkDebugMessageInc("Kernel",9,"Factory::PrintPackages"<<std::endl); 00375 00376 PackageMapType::const_iterator i; 00377 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i ) 00378 { 00379 bbtkMessage("Help",1, i->first << std::endl); 00380 if (details) { 00381 i->second->PrintBlackBoxes(false,adaptors); 00382 } 00383 } 00384 00385 bbtkDebugDecTab("Kernel",9); 00386 }
void bbtk::Factory::HelpPackage | ( | const std::string & | name, | |
bool | adaptors = false | |||
) | const |
Displays help on a package.
Definition at line 391 of file bbtkFactory.cxx.
References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkDecTab, bbtkError, bbtkIncTab, bbtkMessage, bbtkMessageCont, bbtk::i, and mPackageMap.
00392 { 00393 bbtkDebugMessageInc("Kernel",9,"Factory::HelpPackage(\""<<name<<"\")" 00394 <<std::endl); 00395 00396 PackageMapType::const_iterator i = mPackageMap.find(name); 00397 if ( i != mPackageMap.end() ) 00398 { 00399 bbtkMessage("Help",1, "Package "<<i->first<<" "); 00400 00401 if (i->second->GetVersion().length()>0) 00402 bbtkMessageCont("Help",1,"v" <<i->second->GetVersion()); 00403 00404 if (i->second->GetAuthor().length()>0) 00405 bbtkMessageCont("Help",1,"- "<<i->second->GetAuthor()); 00406 00407 if (i->second->GetCategory().length()>0) 00408 bbtkMessageCont("Help",1,"- "<<i->second->GetCategory()); 00409 00410 bbtkMessageCont("Help",1,std::endl); 00411 bbtkIncTab("Help",1); 00412 bbtkMessage("Help",1,i->second->GetDescription()<<std::endl); 00413 if (i->second->GetNumberOfBlackBoxes()>0) 00414 { 00415 bbtkMessage("Help",1, "Black boxes : "<<std::endl); 00416 i->second->PrintBlackBoxes(true,adaptors); 00417 } 00418 else 00419 { 00420 bbtkMessage("Help",1, "No black boxes"<<std::endl); 00421 } 00422 bbtkDecTab("Help",1); 00423 } 00424 else 00425 { 00426 bbtkDebugDecTab("Kernel",9); 00427 bbtkError("package \""<<name<<"\" unknown"); 00428 } 00429 00430 bbtkDebugDecTab("Kernel",9); 00431 }
void bbtk::Factory::HelpBlackBox | ( | const std::string & | name, | |
std::string & | package, | |||
bool | full = true | |||
) | const |
Prints help on the black box of type <name> Returns the package to which it belongs
Definition at line 437 of file bbtkFactory.cxx.
References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkError, bbtk::i, and mPackageMap.
00440 { 00441 bbtkDebugMessageInc("Kernel",9,"Factory::HelpBlackBox(\""<<name<<"\")" 00442 <<std::endl); 00443 00444 bool found = false; 00445 PackageMapType::const_iterator i; 00446 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i ) 00447 { 00448 if (i->second->ContainsBlackBox(name)) 00449 { 00450 i->second->HelpBlackBox(name,full); 00451 package = i->second->GetName(); 00452 found = true; 00453 } 00454 } 00455 00456 bbtkDebugDecTab("Kernel",9); 00457 if (!found) 00458 { 00459 bbtkError("No package of the factory contains any black box <" 00460 <<name<<">"); 00461 } 00462 }
void bbtk::Factory::ShowGraphTypes | ( | const std::string & | name | ) | const |
Definition at line 806 of file bbtkFactory.cxx.
References bbtkDebugDecTab, bbtkError, and mPackageMap.
00807 { 00808 00809 bool found = false; 00810 PackageMapType::const_iterator i; 00811 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i ) 00812 { 00813 if (i->second->ContainsBlackBox(name)) 00814 { 00815 std::string separator = ConfigurationFile::GetInstance().Get_file_separator (); 00816 00817 // Don't pollute the file store with "temp_dir" directories ... 00818 std::string default_doc_dir = ConfigurationFile::GetInstance().Get_default_temp_dir(); 00819 std::string directory = "\"" + default_doc_dir + separator + "temp_dir" +separator + "\""; 00820 std::string filename2 = default_doc_dir + separator + "temp_dir" + separator + "tmp.html"; 00821 00822 #if defined(_WIN32) 00823 std::string command("start \"Titre\" /D "); 00824 #else 00825 std::string command("gnome-open "); 00826 #endif 00827 command=command + directory +" tmp.html"; 00828 FILE *ff; 00829 ff=fopen(filename2.c_str(),"w"); 00830 00831 fprintf(ff,"<html><head><title>TMP</title> <script type=\"text/javascript\"> <!--\n"); 00832 fprintf(ff," window.location=\"%s#%s\";\n" , i->second->GetDocURL().c_str(),name.c_str() ); 00833 fprintf(ff,"//--></script></head><body></body></html>\n"); 00834 00835 00836 //fprintf(ff, "<a href=\"%s#%s\">Link</a>\n", i->second->GetDocURL().c_str(),name.c_str() ); 00837 fclose(ff); 00838 system( command.c_str() ); 00839 found = true; 00840 } 00841 } 00842 00843 bbtkDebugDecTab("Kernel",9); 00844 if (!found) 00845 { 00846 bbtkError("No package of the factory contains any black box <" 00847 <<name<<">"); 00848 } 00849 }
void bbtk::Factory::InsertPackage | ( | Package::Pointer | p | ) |
Inserts a package in the factory.
Definition at line 468 of file bbtkFactory.cxx.
References bbtkDebugDecTab, bbtkDebugMessageInc, and mPackageMap.
00469 { 00470 bbtkDebugMessageInc("Kernel",9,"Factory::InsertPackage(\""<< 00471 p->GetName()<<"\")"<<std::endl); 00472 00473 p->AddFactory(GetThisPointer<Factory>()); 00474 mPackageMap[p->GetName()] = p; 00475 00476 bbtkDebugDecTab("Kernel",9); 00477 }
void bbtk::Factory::RemovePackage | ( | Package::Pointer | p | ) |
Removes a package from the factory (and deletes it).
Definition at line 482 of file bbtkFactory.cxx.
References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkError, ClosePackage(), and mPackageMap.
00483 { 00484 bbtkDebugMessageInc("Kernel",9,"Factory::RemovePackage(\""<< 00485 p->GetName()<<"\")"<<std::endl); 00486 00487 PackageMapType::iterator i; 00488 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i ) 00489 { 00490 if (i->second == p) break; 00491 }; 00492 00493 if (i!=mPackageMap.end()) 00494 { 00495 ClosePackage(i); 00496 } 00497 else 00498 { 00499 bbtkError("Factory::RemovePackage(\""<< 00500 p->GetName()<<"\") : package absent from factory"); 00501 } 00502 00503 bbtkDebugDecTab("Kernel",9); 00504 }
Package::Pointer bbtk::Factory::GetPackage | ( | const std::string & | name | ) | const |
Definition at line 742 of file bbtkFactory.cxx.
References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkError, and mPackageMap.
Referenced by WriteDotFilePackagesList().
00743 { 00744 bbtkDebugMessageInc("Kernel",9,"Factory::GetPackage(\""<<name<<"\")" 00745 <<std::endl); 00746 00747 PackageMapType::const_iterator i = mPackageMap.find(name); 00748 if ( i != mPackageMap.end() ) 00749 { 00750 bbtkDebugDecTab("Kernel",9); 00751 return i->second; 00752 } 00753 else 00754 { 00755 bbtkDebugDecTab("Kernel",9); 00756 bbtkError("package \""<<name<<"\" unknown"); 00757 } 00758 00759 bbtkDebugDecTab("Kernel",9); 00760 }
BlackBox::Pointer bbtk::Factory::NewBlackBox | ( | const std::string & | type, | |
const std::string & | name | |||
) | const |
Creates an instance of a black box of type <type> with name <name>.
Definition at line 510 of file bbtkFactory.cxx.
References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkError, and mPackageMap.
00512 { 00513 bbtkDebugMessageInc("Kernel",7,"Factory::NewBlackBox(\"" 00514 <<type<<"\",\""<<name<<"\")"<<std::endl); 00515 00516 BlackBox::Pointer b; 00517 PackageMapType::const_iterator i; 00518 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i ) 00519 { 00520 b = i->second->NewBlackBox(type,name); 00521 if (b) break; 00522 } 00523 if (!b) 00524 { 00525 bbtkError("black box type \""<<type<<"\" unknown"); 00526 } 00527 00528 bbtkDebugDecTab("Kernel",7); 00529 return b; 00530 }
BlackBox::Pointer bbtk::Factory::NewAdaptor | ( | const DataInfo & | typein, | |
const DataInfo & | typeout, | |||
const std::string & | name | |||
) | const |
Creates an instance of a black box of type <type> with name <name>.
Definition at line 535 of file bbtkFactory.cxx.
References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkendl, bbtkError, and mPackageMap.
00538 { 00539 bbtkDebugMessageInc("Kernel",8,"Factory::NewAdaptor(" 00540 <<typein<<"," 00541 <<typeout<<",\"" 00542 <<name<<"\")"<<bbtkendl); 00543 00544 00545 BlackBox::Pointer b; 00546 PackageMapType::const_iterator i; 00547 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i ) 00548 { 00549 b = i->second->NewAdaptor(typein,typeout,name); 00550 if (b) break; 00551 } 00552 if (!b) 00553 { 00554 bbtkError("no "<<typein<<" to "<<typeout 00555 <<" adaptor available"); 00556 } 00557 00558 bbtkDebugDecTab("Kernel",7); 00559 return b; 00560 }
BlackBox::Pointer bbtk::Factory::NewWidgetAdaptor | ( | const DataInfo & | typein, | |
const DataInfo & | typeout, | |||
const std::string & | name | |||
) | const |
Creates an instance of a black box of type <type> with name <name>.
Definition at line 566 of file bbtkFactory.cxx.
References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkendl, bbtkError, and mPackageMap.
00569 { 00570 bbtkDebugMessageInc("Kernel",8,"Factory::NewWidgetAdaptor(<" 00571 <<typein<<">,<" 00572 <<typeout<<">,\"" 00573 <<name<<"\")"<<bbtkendl); 00574 00575 00576 BlackBox::Pointer b; 00577 PackageMapType::const_iterator i; 00578 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i ) 00579 { 00580 b = i->second->NewWidgetAdaptor(typein, 00581 typeout, 00582 name); 00583 if (b) break; 00584 } 00585 if (!b) 00586 { 00587 bbtkError("no "<<typein<<" to "<<typeout 00588 <<"> widget adaptor available"); 00589 } 00590 00591 bbtkDebugDecTab("Kernel",7); 00592 return b; 00593 }
bool bbtk::Factory::FindAdaptor | ( | const DataInfo & | typein, | |
const DataInfo & | typeout, | |||
std::string & | adaptor | |||
) | const |
Creates an instance of a black box of type <type> with name <name>.
Definition at line 598 of file bbtkFactory.cxx.
References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkendl, and mPackageMap.
Referenced by FindWidgetAdaptor2().
00601 { 00602 bbtkDebugMessageInc("Kernel",8,"Factory::FindAdaptor(<" 00603 <<typein<<">,<" 00604 <<typeout<<">)"<<bbtkendl); 00605 00606 bool b = false; 00607 PackageMapType::const_iterator i; 00608 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i ) 00609 { 00610 b = i->second->FindAdaptor(typein, 00611 typeout, 00612 adaptor); 00613 if (b) break; 00614 } 00615 /* 00616 if (!b) 00617 { 00618 bbtkError("no "<<typein<<" to "<<typeout 00619 <<"> widget adaptor available"); 00620 } 00621 */ 00622 00623 bbtkDebugDecTab("Kernel",7); 00624 return b; 00625 }
bool bbtk::Factory::FindWidgetAdaptor | ( | const DataInfo & | typein, | |
const DataInfo & | typeout, | |||
std::string & | adaptor | |||
) | const |
Creates an instance of a black box of type <type> with name <name>.
Definition at line 630 of file bbtkFactory.cxx.
References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkendl, and mPackageMap.
00633 { 00634 bbtkDebugMessageInc("Kernel",8,"Factory::FindWidgetAdaptor(<" 00635 <<typein<<">,<" 00636 <<typeout<<">)"<<bbtkendl); 00637 00638 bool b = false; 00639 PackageMapType::const_iterator i; 00640 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i ) 00641 { 00642 b = i->second->FindWidgetAdaptor(typein, 00643 typeout, 00644 adaptor); 00645 if (b) break; 00646 } 00647 bbtkDebugDecTab("Kernel",7); 00648 return b; 00649 }
bool bbtk::Factory::FindWidgetAdaptor2 | ( | const DataInfo & | typein, | |
const DataInfo & | typeout, | |||
std::string & | widget, | |||
std::string & | adaptor | |||
) | const |
Creates an instance of a black box of type <type> with name <name>.
Definition at line 654 of file bbtkFactory.cxx.
References bbtkDebugDecTab, bbtkDebugMessageInc, bbtkendl, bbtkMessage, FindAdaptor(), bbtk::DataInfo::GetNature(), bbtk::DataInfo::GetType(), and mPackageMap.
00658 { 00659 bbtkDebugMessageInc("Kernel",8,"Factory::FindWidgetAdaptor(<" 00660 <<typein<<">,<" 00661 <<typeout<<">)"<<bbtkendl); 00662 00663 bool b = false; 00664 adaptor = widget = ""; 00665 PackageMapType::const_iterator i; 00666 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i ) 00667 { 00668 b = i->second->FindWidgetAdaptor(typein, 00669 typeout, 00670 widget); 00671 if (b) break; 00672 } 00673 if (!b) 00674 { 00675 // Look for a widget adaptor with good nature out 00676 bbtkMessage("Kernel",5, 00677 "*** Looking for a two pieces widget adaptor for : " 00678 << typein << "->"<<typeout<<std::endl); 00679 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i ) 00680 { 00681 Package::AdaptorMapType::const_iterator j; 00682 for (j=i->second->GetAdaptorMap().begin(); 00683 j!=i->second->GetAdaptorMap().end(); 00684 ++j) 00685 { 00686 if ( ( j->first.mKind == 00687 BlackBoxDescriptor::DEFAULT_GUI) && 00688 //(j->first.mTypeIn == typein) && 00689 (j->first.mTypeOut.GetNature() == typeout.GetNature() ) 00690 ) 00691 { 00692 widget = j->second.lock()->GetTypeName(); 00693 bbtkMessage("Kernel",5, 00694 "===> Found first part : "<<widget 00695 << " "<<j->first.mTypeIn<<"->" 00696 <<j->first.mTypeOut<<std::endl); 00697 DataInfo ti( j->first.mTypeOut.GetType(), ""); 00698 DataInfo to( typeout.GetType(), ""); 00699 b = FindAdaptor( ti, to, adaptor ); 00700 if (b) 00701 { 00702 bbtkMessage("Kernel",5, 00703 "===> Found second part : "<<adaptor 00704 <<std::endl); 00705 break; 00706 } 00707 else 00708 { 00709 bbtkMessage("Kernel",5, 00710 "===> No second part found"<<std::endl); 00711 } 00712 } 00713 } 00714 if (b) break; 00715 } 00716 } 00717 bbtkDebugDecTab("Kernel",7); 00718 return b; 00719 }
Connection::Pointer bbtk::Factory::NewConnection | ( | BlackBox::Pointer | from, | |
const std::string & | output, | |||
BlackBox::Pointer | to, | |||
const std::string & | input | |||
) | const |
Creates an instance of a connection.
Definition at line 724 of file bbtkFactory.cxx.
References bbtkDebugMessage.
00728 { 00729 bbtkDebugMessage("Kernel",7,"Factory::NewConnection(\"" 00730 <<from->bbGetName()<<"\",\""<<output<<"\",\"" 00731 <<to->bbGetName()<<"\",\""<<input 00732 <<"\")"<<std::endl); 00733 00734 return Connection::New(from,output,to,input, 00735 GetThisPointer<Factory>()); 00736 }
void bbtk::Factory::WriteDotFilePackagesList | ( | FILE * | ff | ) |
Definition at line 780 of file bbtkFactory.cxx.
References bbtkDebugDecTab, bbtkDebugMessageInc, GetPackage(), and mPackageMap.
00781 { 00782 00783 bbtkDebugMessageInc("Kernel",9,"Factory::WriteDotFilePackagesList()" 00784 <<std::endl); 00785 00786 fprintf( ff , "\n"); 00787 fprintf( ff , "subgraph cluster_FACTORY {\n"); 00788 fprintf( ff , " label = \"PACKAGES\"%s\n", ";"); 00789 fprintf( ff , " style=filled%s\n",";"); 00790 fprintf( ff , " color=lightgrey%s\n",";"); 00791 fprintf( ff , " rankdir=TB%s\n",";"); 00792 00793 std::string url; 00794 PackageMapType::const_iterator i; 00795 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i ) 00796 { 00797 url=GetPackage(i->first)->GetDocURL(); 00798 fprintf(ff," %s [shape=ellipse, URL=\"%s\"]%s\n",i->first.c_str(),url.c_str(),";" ); 00799 } 00800 fprintf( ff , "}\n\n"); 00801 bbtkDebugDecTab("Kernel",9); 00802 }
void bbtk::Factory::Reset | ( | ) |
Definition at line 87 of file bbtkFactory.cxx.
References bbtkDebugDecTab, bbtkDebugMessageInc, and CloseAllPackages().
00088 { 00089 bbtkDebugMessageInc("Kernel",7,"Factory::Reset()"<<std::endl); 00090 CloseAllPackages(); 00091 bbtkDebugDecTab("Kernel",7); 00092 }
void bbtk::Factory::CheckPackages | ( | ) | const |
Definition at line 765 of file bbtkFactory.cxx.
References bbtkMessage, and mPackageMap.
00766 { 00767 bbtkMessage("debug",1,"****** Checking Factory "<<(void*)this 00768 <<std::endl); 00769 PackageMapType::const_iterator i; 00770 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i ) 00771 { 00772 i->second->CheckBoxes(); 00773 } 00774 bbtkMessage("debug",1,"****** Checking Factory "<<(void*)this 00775 <<" ... OK"<<std::endl); 00776 }
void bbtk::Factory::CreateHtmlIndex | ( | IndexEntryType | type, | |
const std::string & | filename | |||
) |
Definition at line 854 of file bbtkFactory.cxx.
References Adaptors, bbtkDebugDecTab, bbtkDebugMessageInc, bbtkendl, bbtkError, Categories, Initials, mPackageMap, and Packages.
00856 { 00857 bbtkDebugMessageInc("Kernel",9,"Factory::CreateHtmlIndex(\"" 00858 <<filename<<"\")"<<bbtkendl); 00859 00860 std::string title; 00861 00862 typedef std::map<std::string, 00863 std::vector<BlackBoxDescriptor::Pointer> > IndexType; 00864 IndexType index; 00865 // Builds the index map 00866 PackageMapType::const_iterator i; 00867 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i ) 00868 { 00869 Package::Pointer pack = i->second; 00870 if (pack->GetName()=="user") continue; 00871 Package::BlackBoxMapType::const_iterator j; 00872 for (j = pack->GetBlackBoxMap().begin(); 00873 j!= pack->GetBlackBoxMap().end(); 00874 ++j) 00875 { 00876 00877 // Skip adaptors 00878 if ( type==Adaptors ) 00879 { 00880 if (j->second->GetKind() == BlackBoxDescriptor::STANDARD ) 00881 continue; 00882 } 00883 else 00884 if (j->second->GetKind() != BlackBoxDescriptor::STANDARD ) 00885 continue; 00886 00887 std::vector<std::string> keys; 00888 if (type==Packages) 00889 { 00890 std::string k(""); 00891 k += pack->GetName(); 00892 keys.push_back(k); 00893 title = "Boxes by package"; 00894 } 00895 else if ((type==Initials) || (type==Adaptors)) 00896 { 00897 std::string init(" "); 00898 init[0] = std::toupper(j->second->GetTypeName()[0]); 00899 keys.push_back(init); 00900 title = "Alphabetical list"; 00901 } 00902 else if (type==Categories) 00903 { 00904 // Split the category string 00905 std::string delimiters = ";,"; 00906 Utilities::SplitString(j->second->GetCategory(), 00907 delimiters,keys); 00908 if (keys.size()==0) 00909 keys.push_back(" NONE"); 00910 title = "Boxes by category"; 00911 } 00912 00913 00914 std::vector<std::string>::const_iterator k; 00915 for (k=keys.begin(); k!=keys.end(); ++k ) 00916 { 00917 IndexType::iterator p; 00918 p = index.find(*k); 00919 if (p != index.end()) 00920 { 00921 p->second.push_back(j->second); 00922 } 00923 else 00924 { 00925 std::vector<BlackBoxDescriptor::Pointer> v; 00926 v.push_back(j->second); 00927 index[*k] = v; 00928 } 00929 } 00930 00931 } 00932 } 00933 // Creates the file 00934 //--------------------- 00935 // Open output file 00936 std::ofstream s; 00937 s.open(filename.c_str()); 00938 if (!s.good()) 00939 { 00940 bbtkError("Factory::CreateHtmlIndex : could not open file '" 00941 <<filename<<"'"); 00942 } 00943 00944 //---------------------- 00945 // Html head 00946 s << "<html lang=\"en\">\n"; 00947 s << "<head>\n"; 00948 s << "<title>"<<title<<"</title>\n"; 00949 s << "<meta http-equiv=\"Content-Type\" content=\"text/html\">\n"; 00950 s << "<meta name=\"description\" content=\""<<title<<"\">\n"; 00951 s << "<meta name=\"generator\" content=\"\">\n"; 00952 s << "<link title=\"Top\" rel=\"top\" href=\"#Top\">\n"; 00953 //<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 00954 s << "<meta http-equiv=\"Content-Style-Type\" content=\"text/css\"><style type=\"text/css\"><!--\n"; 00955 s << "pre.display { font-family:inherit }\n"; 00956 s << "pre.format { font-family:inherit }\n"; 00957 s << "pre.smalldisplay { font-family:inherit; font-size:smaller }\n"; 00958 s << "pre.smallformat { font-family:inherit; font-size:smaller }\n"; 00959 s << "pre.smallexample { font-size:smaller }\n"; 00960 s << "pre.smalllisp { font-size:smaller }\n"; 00961 s << "span.sc { font-variant:small-caps }\n"; 00962 s << "span.roman { font-family:serif; font-weight:normal; } \n"; 00963 s << "span.sansserif { font-family:sans-serif; font-weight:normal; }\n"; 00964 s << "--></style>\n"; 00965 s << "</head>\n"; 00966 //---------------------- 00967 00968 //---------------------- 00969 // Html body 00970 s << "<body>\n"; 00971 s << "<a name=\"Top\"></a>\n"; 00972 s << "<h1 class=\"settitle\">"<<title<<"</h1>\n"; 00973 s << "<p>\n"; 00974 IndexType::iterator ii; 00975 for (ii=index.begin();ii!=index.end();++ii) 00976 { 00977 s << "<a href=\"#"<<ii->first<<"\">"<<ii->first<<"</a> "; 00978 } 00979 00980 for (ii=index.begin();ii!=index.end();++ii) 00981 { 00982 s << "<p><hr>\n"; 00983 s << "<p><a href=\"#Top\">Top</a>"; 00984 if (type==Packages) 00985 { 00986 s << "<a name=\""<<ii->first<<"\"></a>\n"; 00987 s << "<p><a href=\""<<ii->first<<"/index.html\">" 00988 << ii->first<<"</a>\n"; 00989 00990 s << " - \n"; 00991 00992 s << "<a name=\"doxygen\"></a>\n"; 00993 s << "<a href=..\\doxygen\\" << ii->first << "/main.html>(Doxygen documentation of the source)</a>\n"; 00994 } 00995 else 00996 { 00997 s << "<a name=\""<<ii->first<<"\"></a>\n"; 00998 s << "<p><b>"<<ii->first<<"</b>\n"; 00999 } 01000 s << "<ul>\n"; 01001 01002 s << "<p><TABLE cellspacing=0 cellpadding=3>\n"; 01003 01004 std::vector<BlackBoxDescriptor::Pointer>::iterator di; 01005 for (di=ii->second.begin();di!=ii->second.end();++di) 01006 { 01007 std::string pack = (*di)->GetPackage()->GetName(); 01008 std::string name = (*di)->GetTypeName(); 01009 Utilities::html_format(name); 01010 std::string descr = (*di)->GetDescription(); 01011 Utilities::html_format(descr); 01012 s << "<TR>"; 01013 s << "<TD style='vertical-align: top;'>"; 01014 s << " <a href=\""<<pack 01015 <<"/index.html#"<<name<<"\">" 01016 <<pack<<"::"<<name<<"</a>"; 01017 s << "</TD> "; 01018 s << " <TD style='vertical-align: top;'>" << descr << " </TD>"; 01019 s << "</TR>\n"; 01020 } 01021 s << "</TABLE>\n"; 01022 s << "</ul>\n"; 01023 s << "</div>\n"; 01024 } 01025 //---------------------- 01026 // Footer 01027 time_t rawtime; 01028 tm * ptm; 01029 time ( &rawtime ); 01030 ptm = gmtime ( &rawtime ); 01031 01032 s << "<p><hr>\n"; 01033 s << "Automatically generated by <b>bbtk</b> on " 01034 << ptm->tm_mday << "/" << ptm->tm_mon << "/" << ptm->tm_year+1900 01035 << " - " << ptm->tm_hour << ":" << ptm->tm_min << " GMT\n"; 01036 s << "</body></html>\n"; 01037 s.close(); 01038 //---------------------- 01039 01040 // End 01041 bbtkDebugDecTab("Kernel",9); 01042 }
void bbtk::Factory::SetExecuter | ( | ExecuterPointer | e | ) | [inline] |
Sets the executer who created the factory (if any).
Definition at line 121 of file bbtkFactory.h.
00121 { mExecuter = e; }
ExecuterPointer bbtk::Factory::GetExecuter | ( | ) | [inline] |
Gets the executer who created the factory (if any).
Definition at line 123 of file bbtkFactory.h.
00123 { return mExecuter.lock(); }
bool bbtk::Factory::DoLoadPackage | ( | std::string | libname, | |
std::string | pkgname, | |||
std::string | path | |||
) | [private] |
Gets the executer who created the factory (if any) - const.
Definition at line 97 of file bbtkFactory.cxx.
References bbtkMessage, and mPackageMap.
Referenced by LoadPackage().
00100 { 00101 00102 Package::Pointer p = Package::CreateFromDynamicLibrary(libname, 00103 pkgname, 00104 path); 00105 if (p!=0) 00106 { 00107 //=================================================================== 00108 bbtkMessage("Output",2,p->GetName()<<" " 00109 <<p->GetVersion() 00110 <<" " 00111 <<p->GetAuthor() << " Category(s) :" 00112 <<p->GetCategory() 00113 <<std::endl); 00114 bbtkMessage("Output",2,p->GetDescription()<<std::endl); 00115 //=================================================================== 00116 p->AddFactory(GetThisPointer<Factory>()); 00117 mPackageMap[pkgname] = p; 00118 return true; 00119 } 00120 return false; 00121 00122 }
const PackageMapType& bbtk::Factory::GetPackageMap | ( | ) | const [inline] |
void bbtk::Factory::CloseAllPackages | ( | ) | [private] |
Definition at line 324 of file bbtkFactory.cxx.
References bbtkDebugDecTab, bbtkDebugMessageInc, ClosePackage(), bbtk::i, and mPackageMap.
Referenced by Reset(), and ~Factory().
00325 { 00326 bbtkDebugMessageInc("Kernel",7,"Factory::CloseAllPackages()"<<std::endl); 00327 while (mPackageMap.begin() != mPackageMap.end()) 00328 { 00329 PackageMapType::iterator i = mPackageMap.begin(); 00330 ClosePackage(i); 00331 } 00332 bbtkDebugDecTab("Kernel",7); 00333 }
void bbtk::Factory::ClosePackage | ( | PackageMapType::iterator & | i | ) | [private] |
Close the package referenced by the iterator.
First removes the factory from the set of factories which use the package If the set is empty then : If it is a dynamically loaded package :
Finally erases the package entry in the packages map
Definition at line 348 of file bbtkFactory.cxx.
References bbtkDebugDecTab, bbtkDebugMessageInc, and mPackageMap.
Referenced by CloseAllPackages(), RemovePackage(), and UnLoadPackage().
00349 { 00350 bbtkDebugMessageInc("Kernel",7,"Factory::ClosePackage(\"" 00351 <<i->second->GetName() 00352 <<"\")"<<std::endl); 00353 00354 00355 // Removes this from the set of factories which use the package 00356 i->second->RemoveFactory(GetThisPointer<Factory>()); 00357 Package::WeakPointer p = i->second; 00358 // remove the entry in the map 00359 mPackageMap.erase(i); 00360 // Release the package if not already destroyed 00361 if (p.lock()) Package::Release(p); 00362 00363 00364 bbtkDebugDecTab("Kernel",7); 00365 }
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(), 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 55 of file bbtkFactory.h.
PackageMapType bbtk::Factory::mPackageMap [private] |
The map of packages.
Definition at line 143 of file bbtkFactory.h.
Referenced by CheckPackages(), CloseAllPackages(), ClosePackage(), CreateHtmlIndex(), DoLoadPackage(), FindAdaptor(), FindWidgetAdaptor(), FindWidgetAdaptor2(), GetObjectRecursiveSize(), GetPackage(), HelpBlackBox(), HelpPackage(), InsertPackage(), LoadPackage(), NewAdaptor(), NewBlackBox(), NewWidgetAdaptor(), PrintPackages(), RemovePackage(), ShowGraphTypes(), UnLoadPackage(), and WriteDotFilePackagesList().
ExecuterWeakPointer bbtk::Factory::mExecuter [private] |