1 /*=========================================================================
4 Module: $RCSfile: bbtkFactory.cxx,v $
7 Date: $Date: 2008/10/02 12:29:26 $
8 Version: $Revision: 1.39 $
11 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
12 l'Image). All rights reserved. See doc/license.txt or
13 http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
15 This software is distributed WITHOUT ANY WARRANTY; without even
16 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
17 PURPOSE. See the above copyright notices for more information.
19 =========================================================================*/
22 *\brief Class bbtk::Factory : can load and unload dynamic libraries containing
23 * black boxes packages and create instances of the black boxes registered
24 * in the packages loaded.
26 #include "bbtkFactory.h"
27 #include "bbtkMessageManager.h"
28 #include "bbtkConnection.h"
29 #include "bbtkConfigurationFile.h"
30 #include "bbtkUtilities.h"
32 #include <sys/stat.h> // for struct stat stFileInfo
35 #include <direct.h> // for getcwd
38 #include <cctype> // std::toupper
45 //===================================================================
47 Factory::Pointer Factory::New()
49 bbtkDebugMessage("Kernel",9,"Factory::New()"<<std::endl);
50 return MakePointer(new Factory());
52 //===================================================================
54 //===================================================================
59 bbtkDebugMessage("Kernel",7,"Factory::Factory()"<<std::endl);
61 //===================================================================
63 //===================================================================
67 bbtkDebugMessageInc("Kernel",7,"Factory::~Factory()"<<std::endl);
69 bbtkDebugDecTab("Kernel",7);
71 //===================================================================
75 //===================================================================
78 bbtkDebugMessageInc("Kernel",7,"Factory::Reset()"<<std::endl);
80 bbtkDebugDecTab("Kernel",7);
82 //===================================================================
85 // ===================================================================
86 bool Factory::DoLoadPackage(std::string libname,
91 Package::Pointer p = Package::CreateFromDynamicLibrary(libname,
96 //===================================================================
97 bbtkMessage("Output",2,p->GetName()<<" "
100 <<p->GetAuthor() << " Category(s) :"
103 bbtkMessage("Output",2,p->GetDescription()<<std::endl);
104 //===================================================================
105 p->AddFactory(GetThisPointer<Factory>());
106 mPackageMap[pkgname] = p;
113 //===================================================================
114 /// \brief Loads a package.
116 /// The name is the system-independant name of the package (the name of the instance of bbtk::Package).
117 /// Tries to open the dynamic library :
118 /// - "libbb<name>.so" for linux systems,
119 /// - "bb<name>.dll" for windows systems.
120 /// If it succeeds, then tries to load the symbols "<name>GetPackage" and "<name>DeletePackage".
121 /// "<name>GetPackage" is called to get the pointer on the bbtk::Package of the library
122 /// ("<name>DeletePackage" is not used, its presence is just checked before loading the package).
124 /// now, filename is only the last name (no longer the full name!)
125 /// it will be searched within *all* the paths given in bbtk_config.xml
129 void Factory::LoadPackage( const std::string& name )
131 // Note : in the following :
132 // name : the user supplied name
133 // - abreviated name e.g. pkg pkg.so libbpkg libbbpkg.so
134 // - relative full name e.g. ./libbbpkg.so ../../libbbpkg.so
135 // - absolute full name e.g. /home/usrname/proj/lib/libbbpkg.so
136 // same for Windows, with c:, d: ...
138 // lastname : string before the last / (if any), or user supplied name
140 bbtkDebugMessageInc("Kernel",7,"Factory::LoadPackage(\""<<name<<"\")"<<std::endl);
141 bbtkMessage("debug",1,"Factory::LoadPackage(\""<<name<<"\")"<<std::endl);
143 std::vector<std::string> package_paths;
144 std::string libname; // full path library name
145 std::string pkgname; // e.g. libbb<pkgname>.so
148 pkgname = Utilities::ExtractPackageName(name,upath);
150 bbtkMessage("debug",1,"Package name ["<<pkgname<<"]"<<std::endl);
151 bbtkMessage("debug",1,"Package path ["<<upath<<"]"<<std::endl);
153 // no loading package if already loaded
154 PackageMapType::iterator iUnload;
155 iUnload = mPackageMap.find(pkgname);
156 if (iUnload != mPackageMap.end())
158 bbtkMessage("Output",2,"["<< pkgname <<"] already loaded" << std::endl);
162 // =================================================
163 // The following structure was checked to work
164 // with any type of relative/absolute path.
165 // Please don't modify it without checking
166 // *all* the cases. JP
167 //==================================================
169 //std::cout << "upath [" << upath << "]" << std::endl;
172 bool foundFile = false;
174 // If path provided by user will be the first scanned :
175 // push it into vector of paths
176 if (upath.length()>0) // ------------------------------------- check user supplied location
178 if (name[0] != '.' && name[0] != '/' && name[1]!= ':')
180 bbtkError("Use absolute or relative path name! ["<<name<<"] is an illegal name");
184 // std::string path = Utilities::ExpandLibName(upath, false);
185 std::string path = Utilities::ExpandLibName(name,false); // keep last item, here.
190 Utilities::ExtractPackageName(path,p2);
191 //libname = Utilities::MakeLibnameFromPath(path, pkgname);
192 libname = Utilities::MakeLibnameFromPath(p2, pkgname); // remove last item
193 // Check if library exists
194 if ( !Utilities::FileExists(libname) )
196 // The following is *NOT* a debug time message :
197 // It's a user intended message.
198 // Please don't remove it.
199 bbtkMessage("Output",3," [" <<libname
200 <<"] : doesn't exist" <<std::endl);
204 ok = DoLoadPackage( libname, pkgname, path);
209 bbtkError("Path ["<<upath<<"] doesn't exist");
213 else // ----------------------------------------------------- iterate on the paths
217 package_paths = ConfigurationFile::GetInstance().Get_package_paths();
218 std::vector<std::string>::iterator i;
219 for (i=package_paths.begin();i!=package_paths.end();++i)
224 // we *really* want '.' to be the current working directory
227 char buf[2048]; // for getcwd
228 char * currentDir = getcwd(buf, 2048);
229 std::string cwd(currentDir);
233 libname = Utilities::MakeLibnameFromPath(path, pkgname);
235 bbtkMessage("debug",2,"-> Trying to load [" << libname << "]" <<std::endl);
237 // Check if library exists
238 if ( !Utilities::FileExists(libname) )
240 // The following is *NOT* a debug time message :
241 // It's a user intended message.
242 // Please don't remove it.
243 bbtkMessage("Output",3,
244 " [" <<libname <<"] : doesn't exist" <<std::endl);
245 continue; // try next path
249 // Try to Load the library
251 ok = DoLoadPackage( libname, pkgname, path);
254 bbtkMessage("debug",2," OK"<<std::endl);
256 break; // we stop iterating even if error : have to signal it to user
257 } //------------------ // end for ( package_paths.begin();i!=package_paths.end() )
261 if( !ok ) // nothing was loaded
265 bbtkError("Could not find package ["<<pkgname<< "]");
269 #if defined(__GNUC__)
270 bbtkError("Could not load package ["<< pkgname
272 << " Opening "<<libname<<" failed"
273 << " Reason: "<< dlerror());
274 #elif defined(_WIN32)
275 bbtkError("Could not load package ["<<pkgname
276 <<"] :"<< std::endl << " Error loading " <<libname);
278 // look how to get the error message on win
280 // it is the bordel !! (the bloody fucking bordel, you mean?)
281 // look : http://msdn2.microsoft.com/en-us/library/ms680582.aspx
285 bbtkMessage("Output",2,"[" << libname << "] loaded" << std::endl);
289 //===================================================================
290 /// \brief UnLoads a package.
292 /// The package must have been previously loaded by LoadPackage.
293 /// If the entry is found in the map, calls ClosePackage
294 void Factory::UnLoadPackage( const std::string& name )
296 bbtkDebugMessageInc("Kernel",7,"Factory::UnLoadPackage(\""
297 <<name<<"\")"<<std::endl);
299 PackageMapType::iterator i;
300 i = mPackageMap.find(name);
301 if (i == mPackageMap.end())
303 bbtkError("cannot unload package \""<<name
304 <<"\" : package not loaded !");
307 bbtkDebugDecTab("Kernel",7);
309 //===================================================================
312 //===================================================================
313 void Factory::CloseAllPackages()
315 bbtkDebugMessageInc("Kernel",7,"Factory::CloseAllPackages()"<<std::endl);
316 while (mPackageMap.begin() != mPackageMap.end())
318 PackageMapType::iterator i = mPackageMap.begin();
321 bbtkDebugDecTab("Kernel",7);
323 //===================================================================
325 //===================================================================
326 /// \brief Close the package referenced by the iterator
328 /// First removes the factory from the set of factories which use the package
329 /// If the set is empty then :
330 /// If it is a dynamically loaded package :
331 /// - Loads and calls the function "<name>DeletePackage" of the dynamic library (responsible for package desallocation)
332 /// - Closes the dynamic library
334 /// - deletes the package normally
336 /// Finally erases the package entry in the packages map
337 void Factory::ClosePackage(PackageMapType::iterator& i)
339 bbtkDebugMessageInc("Kernel",7,"Factory::ClosePackage(\""
340 <<i->second->GetName()
344 // Removes this from the set of factories which use the package
345 i->second->RemoveFactory(GetThisPointer<Factory>());
346 Package::WeakPointer p = i->second;
347 // remove the entry in the map
348 mPackageMap.erase(i);
349 // Release the package if not already destroyed
350 if (p.lock()) Package::Release(p);
353 bbtkDebugDecTab("Kernel",7);
355 //===================================================================
359 //===================================================================
360 /// Displays the list of packages loaded
361 void Factory::PrintPackages(bool details, bool adaptors) const
363 bbtkDebugMessageInc("Kernel",9,"Factory::PrintPackages"<<std::endl);
365 PackageMapType::const_iterator i;
366 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
368 bbtkMessage("Help",1, i->first << std::endl);
370 i->second->PrintBlackBoxes(false,adaptors);
374 bbtkDebugDecTab("Kernel",9);
376 //===================================================================
378 //===================================================================
379 /// Displays help on a package
380 void Factory::HelpPackage(const std::string& name, bool adaptors) const
382 bbtkDebugMessageInc("Kernel",9,"Factory::HelpPackage(\""<<name<<"\")"
385 PackageMapType::const_iterator i = mPackageMap.find(name);
386 if ( i != mPackageMap.end() )
388 bbtkMessage("Help",1, "Package "<<i->first<<" ");
390 if (i->second->GetVersion().length()>0)
391 bbtkMessageCont("Help",1,"v" <<i->second->GetVersion());
393 if (i->second->GetAuthor().length()>0)
394 bbtkMessageCont("Help",1,"- "<<i->second->GetAuthor());
396 if (i->second->GetCategory().length()>0)
397 bbtkMessageCont("Help",1,"- "<<i->second->GetCategory());
399 bbtkMessageCont("Help",1,std::endl);
400 bbtkIncTab("Help",1);
401 bbtkMessage("Help",1,i->second->GetDescription()<<std::endl);
402 if (i->second->GetNumberOfBlackBoxes()>0)
404 bbtkMessage("Help",1, "Black boxes : "<<std::endl);
405 i->second->PrintBlackBoxes(true,adaptors);
409 bbtkMessage("Help",1, "No black boxes"<<std::endl);
411 bbtkDecTab("Help",1);
415 bbtkDebugDecTab("Kernel",9);
416 bbtkError("package \""<<name<<"\" unknown");
419 bbtkDebugDecTab("Kernel",9);
421 //===================================================================
423 //===================================================================
424 /// Prints help on the black box of type <name>
425 /// Returns the package to which it belongs
426 void Factory::HelpBlackBox(const std::string& name,
427 std::string& package,
430 bbtkDebugMessageInc("Kernel",9,"Factory::HelpBlackBox(\""<<name<<"\")"
434 PackageMapType::const_iterator i;
435 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
437 if (i->second->ContainsBlackBox(name))
439 i->second->HelpBlackBox(name,full);
440 package = i->second->GetName();
445 bbtkDebugDecTab("Kernel",9);
448 bbtkError("No package of the factory contains any black box <"
452 //===================================================================
455 //===================================================================
456 /// Inserts a package in the factory
457 void Factory::InsertPackage( Package::Pointer p )
459 bbtkDebugMessageInc("Kernel",9,"Factory::InsertPackage(\""<<
460 p->GetName()<<"\")"<<std::endl);
462 p->AddFactory(GetThisPointer<Factory>());
463 mPackageMap[p->GetName()] = p;
465 bbtkDebugDecTab("Kernel",9);
467 //===================================================================
469 //===================================================================
470 /// Removes a package from the factory (and deletes it)
471 void Factory::RemovePackage( Package::Pointer p )
473 bbtkDebugMessageInc("Kernel",9,"Factory::RemovePackage(\""<<
474 p->GetName()<<"\")"<<std::endl);
476 PackageMapType::iterator i;
477 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
479 if (i->second == p) break;
482 if (i!=mPackageMap.end())
488 bbtkError("Factory::RemovePackage(\""<<
489 p->GetName()<<"\") : package absent from factory");
492 bbtkDebugDecTab("Kernel",9);
494 //===================================================================
497 //===================================================================
498 /// Creates an instance of a black box of type <type> with name <name>
499 BlackBox::Pointer Factory::NewBlackBox(const std::string& type,
500 const std::string& name) const
502 bbtkDebugMessageInc("Kernel",7,"Factory::NewBlackBox(\""
503 <<type<<"\",\""<<name<<"\")"<<std::endl);
506 PackageMapType::const_iterator i;
507 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
509 b = i->second->NewBlackBox(type,name);
514 bbtkError("black box type \""<<type<<"\" unknown");
517 bbtkDebugDecTab("Kernel",7);
520 //===================================================================
522 //===================================================================
523 /// Creates an instance of a black box of type <type> with name <name>
524 BlackBox::Pointer Factory::NewAdaptor(const DataInfo& typein,
525 const DataInfo& typeout,
526 const std::string& name) const
528 bbtkDebugMessageInc("Kernel",8,"Factory::NewAdaptor("
531 <<name<<"\")"<<bbtkendl);
535 PackageMapType::const_iterator i;
536 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
538 b = i->second->NewAdaptor(typein,typeout,name);
543 bbtkError("no "<<typein<<" to "<<typeout
544 <<" adaptor available");
547 bbtkDebugDecTab("Kernel",7);
550 //===================================================================
553 //===================================================================
554 /// Creates an instance of a black box of type <type> with name <name>
555 BlackBox::Pointer Factory::NewWidgetAdaptor(const DataInfo& typein,
556 const DataInfo& typeout,
557 const std::string& name) const
559 bbtkDebugMessageInc("Kernel",8,"Factory::NewWidgetAdaptor(<"
562 <<name<<"\")"<<bbtkendl);
566 PackageMapType::const_iterator i;
567 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
569 b = i->second->NewWidgetAdaptor(typein,
576 bbtkError("no "<<typein<<" to "<<typeout
577 <<"> widget adaptor available");
580 bbtkDebugDecTab("Kernel",7);
583 //===================================================================
585 //===================================================================
586 /// Creates an instance of a black box of type <type> with name <name>
587 bool Factory::FindAdaptor(const DataInfo& typein,
588 const DataInfo& typeout,
589 std::string& adaptor) const
591 bbtkDebugMessageInc("Kernel",8,"Factory::FindAdaptor(<"
593 <<typeout<<">)"<<bbtkendl);
596 PackageMapType::const_iterator i;
597 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
599 b = i->second->FindAdaptor(typein,
607 bbtkError("no "<<typein<<" to "<<typeout
608 <<"> widget adaptor available");
612 bbtkDebugDecTab("Kernel",7);
615 //===================================================================
617 //===================================================================
618 /// Creates an instance of a black box of type <type> with name <name>
619 bool Factory::FindWidgetAdaptor(const DataInfo& typein,
620 const DataInfo& typeout,
621 std::string& adaptor) const
623 bbtkDebugMessageInc("Kernel",8,"Factory::FindWidgetAdaptor(<"
625 <<typeout<<">)"<<bbtkendl);
628 PackageMapType::const_iterator i;
629 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
631 b = i->second->FindWidgetAdaptor(typein,
636 bbtkDebugDecTab("Kernel",7);
639 //===================================================================
641 //===================================================================
642 /// Creates an instance of a black box of type <type> with name <name>
643 bool Factory::FindWidgetAdaptor2(const DataInfo& typein,
644 const DataInfo& typeout,
646 std::string& adaptor) const
648 bbtkDebugMessageInc("Kernel",8,"Factory::FindWidgetAdaptor(<"
650 <<typeout<<">)"<<bbtkendl);
653 adaptor = widget = "";
654 PackageMapType::const_iterator i;
655 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
657 b = i->second->FindWidgetAdaptor(typein,
664 // Look for a widget adaptor with good nature out
665 bbtkMessage("Kernel",5,
666 "*** Looking for a two pieces widget adaptor for : "
667 << typein << "->"<<typeout<<std::endl);
668 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
670 Package::AdaptorMapType::const_iterator j;
671 for (j=i->second->GetAdaptorMap().begin();
672 j!=i->second->GetAdaptorMap().end();
675 if ( ( j->first.mKind ==
676 BlackBoxDescriptor::DEFAULT_GUI) &&
677 //(j->first.mTypeIn == typein) &&
678 (j->first.mTypeOut.GetNature() == typeout.GetNature() )
681 widget = j->second.lock()->GetTypeName();
682 bbtkMessage("Kernel",5,
683 "===> Found first part : "<<widget
684 << " "<<j->first.mTypeIn<<"->"
685 <<j->first.mTypeOut<<std::endl);
686 DataInfo ti( j->first.mTypeOut.GetType(), "");
687 DataInfo to( typeout.GetType(), "");
688 b = FindAdaptor( ti, to, adaptor );
691 bbtkMessage("Kernel",5,
692 "===> Found second part : "<<adaptor
698 bbtkMessage("Kernel",5,
699 "===> No second part found"<<std::endl);
706 bbtkDebugDecTab("Kernel",7);
709 //===================================================================
711 //===================================================================
712 /// Creates an instance of a connection
713 Connection::Pointer Factory::NewConnection(BlackBox::Pointer from,
714 const std::string& output,
715 BlackBox::Pointer to,
716 const std::string& input) const
718 bbtkDebugMessage("Kernel",7,"Factory::NewConnection(\""
719 <<from->bbGetName()<<"\",\""<<output<<"\",\""
720 <<to->bbGetName()<<"\",\""<<input
723 return Connection::New(from,output,to,input,
724 GetThisPointer<Factory>());
726 //===================================================================
730 //===================================================================
731 Package::Pointer Factory::GetPackage(const std::string& name) const
733 bbtkDebugMessageInc("Kernel",9,"Factory::GetPackage(\""<<name<<"\")"
736 PackageMapType::const_iterator i = mPackageMap.find(name);
737 if ( i != mPackageMap.end() )
739 bbtkDebugDecTab("Kernel",9);
744 bbtkDebugDecTab("Kernel",9);
745 bbtkError("package \""<<name<<"\" unknown");
748 bbtkDebugDecTab("Kernel",9);
750 //===================================================================
753 //===================================================================
754 void Factory::CheckPackages() const
756 bbtkMessage("debug",1,"****** Checking Factory "<<(void*)this
758 PackageMapType::const_iterator i;
759 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
761 i->second->CheckBoxes();
763 bbtkMessage("debug",1,"****** Checking Factory "<<(void*)this
764 <<" ... OK"<<std::endl);
766 //===================================================================
768 //===================================================================
769 void Factory::WriteDotFilePackagesList(FILE *ff)
772 bbtkDebugMessageInc("Kernel",9,"Factory::WriteDotFilePackagesList()"
776 fprintf( ff , "subgraph cluster_FACTORY {\n");
777 fprintf( ff , " label = \"PACKAGES\"%s\n", ";");
778 fprintf( ff , " style=filled%s\n",";");
779 fprintf( ff , " color=lightgrey%s\n",";");
780 fprintf( ff , " rankdir=TB%s\n",";");
783 PackageMapType::const_iterator i;
784 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
786 url=GetPackage(i->first)->GetDocURL();
787 fprintf(ff," %s [shape=ellipse, URL=\"%s\"]%s\n",i->first.c_str(),url.c_str(),";" );
789 fprintf( ff , "}\n\n");
790 bbtkDebugDecTab("Kernel",9);
792 //===================================================================
795 void Factory::ShowGraphTypes(const std::string& name) const
799 PackageMapType::const_iterator i;
800 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
802 if (i->second->ContainsBlackBox(name))
804 std::string separator = ConfigurationFile::GetInstance().Get_file_separator ();
806 // Don't pollute the file store with "temp_dir" directories ...
807 std::string default_doc_dir = ConfigurationFile::GetInstance().Get_default_temp_dir();
808 std::string directory = "\"" + default_doc_dir + separator + "temp_dir" +separator + "\"";
809 std::string filename2 = default_doc_dir + separator + "temp_dir" + separator + "tmp.html";
812 std::string command("start \"Titre\" /D ");
814 std::string command("gnome-open ");
816 command=command + directory +" tmp.html";
818 ff=fopen(filename2.c_str(),"w");
820 fprintf(ff,"<html><head><title>TMP</title> <script type=\"text/javascript\"> <!--\n");
821 fprintf(ff," window.location=\"%s#%s\";\n" , i->second->GetDocURL().c_str(),name.c_str() );
822 fprintf(ff,"//--></script></head><body></body></html>\n");
825 //fprintf(ff, "<a href=\"%s#%s\">Link</a>\n", i->second->GetDocURL().c_str(),name.c_str() );
827 system( command.c_str() );
832 bbtkDebugDecTab("Kernel",9);
835 bbtkError("No package of the factory contains any black box <"
843 void Factory::CreateHtmlIndex(IndexEntryType type,
844 const std::string& filename)
846 bbtkDebugMessageInc("Kernel",9,"Factory::CreateHtmlIndex(\""
847 <<filename<<"\")"<<bbtkendl);
851 typedef std::map<std::string,
852 std::vector<BlackBoxDescriptor::Pointer> > IndexType;
854 // Builds the index map
855 PackageMapType::const_iterator i;
856 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
858 Package::Pointer pack = i->second;
859 if (pack->GetName()=="user") continue;
860 Package::BlackBoxMapType::const_iterator j;
861 for (j = pack->GetBlackBoxMap().begin();
862 j!= pack->GetBlackBoxMap().end();
867 if ( type==Adaptors )
869 if (j->second->GetKind() == BlackBoxDescriptor::STANDARD )
873 if (j->second->GetKind() != BlackBoxDescriptor::STANDARD )
876 std::vector<std::string> keys;
880 k += pack->GetName();
882 title = "Boxes by package";
884 else if ((type==Initials) || (type==Adaptors))
886 std::string init(" ");
887 init[0] = std::toupper(j->second->GetTypeName()[0]);
888 keys.push_back(init);
889 title = "Alphabetical list";
891 else if (type==Categories)
893 // Split the category string
894 std::string delimiters = ";,";
895 Utilities::SplitString(j->second->GetCategory(),
898 keys.push_back(" NONE");
899 title = "Boxes by category";
903 std::vector<std::string>::const_iterator k;
904 for (k=keys.begin(); k!=keys.end(); ++k )
906 IndexType::iterator p;
908 if (p != index.end())
910 p->second.push_back(j->second);
914 std::vector<BlackBoxDescriptor::Pointer> v;
915 v.push_back(j->second);
923 //---------------------
926 s.open(filename.c_str());
929 bbtkError("Factory::CreateHtmlIndex : could not open file '"
933 //----------------------
935 s << "<html lang=\"en\">\n";
937 s << "<title>"<<title<<"</title>\n";
938 s << "<meta http-equiv=\"Content-Type\" content=\"text/html\">\n";
939 s << "<meta name=\"description\" content=\""<<title<<"\">\n";
940 s << "<meta name=\"generator\" content=\"\">\n";
941 s << "<link title=\"Top\" rel=\"top\" href=\"#Top\">\n";
942 //<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
943 s << "<meta http-equiv=\"Content-Style-Type\" content=\"text/css\"><style type=\"text/css\"><!--\n";
944 s << "pre.display { font-family:inherit }\n";
945 s << "pre.format { font-family:inherit }\n";
946 s << "pre.smalldisplay { font-family:inherit; font-size:smaller }\n";
947 s << "pre.smallformat { font-family:inherit; font-size:smaller }\n";
948 s << "pre.smallexample { font-size:smaller }\n";
949 s << "pre.smalllisp { font-size:smaller }\n";
950 s << "span.sc { font-variant:small-caps }\n";
951 s << "span.roman { font-family:serif; font-weight:normal; } \n";
952 s << "span.sansserif { font-family:sans-serif; font-weight:normal; }\n";
953 s << "--></style>\n";
955 //----------------------
957 //----------------------
960 s << "<a name=\"Top\"></a>\n";
961 s << "<h1 class=\"settitle\">"<<title<<"</h1>\n";
963 IndexType::iterator ii;
964 for (ii=index.begin();ii!=index.end();++ii)
966 s << "<a href=\"#"<<ii->first<<"\">"<<ii->first<<"</a> ";
969 for (ii=index.begin();ii!=index.end();++ii)
972 s << "<p><a href=\"#Top\">Top</a>";
975 s << "<a name=\""<<ii->first<<"\"></a>\n";
976 s << "<p><a href=\""<<ii->first<<"/index.html\">"
977 << ii->first<<"</a>\n";
979 s << " - \n";
981 s << "<a name=\"doxygen\"></a>\n";
982 s << "<a href=..\\doxygen\\" << ii->first << "/main.html>(Doxygen documentation of the source)</a>\n";
986 s << "<a name=\""<<ii->first<<"\"></a>\n";
987 s << "<p><b>"<<ii->first<<"</b>\n";
991 s << "<p><TABLE cellspacing=0 cellpadding=3>\n";
993 std::vector<BlackBoxDescriptor::Pointer>::iterator di;
994 for (di=ii->second.begin();di!=ii->second.end();++di)
996 std::string pack = (*di)->GetPackage()->GetName();
997 std::string name = (*di)->GetTypeName();
998 Utilities::html_format(name);
999 std::string descr = (*di)->GetDescription();
1000 Utilities::html_format(descr);
1002 s << "<TD style='vertical-align: top;'>";
1003 s << " <a href=\""<<pack
1004 <<"/index.html#"<<name<<"\">"
1005 <<pack<<"::"<<name<<"</a>";
1007 s << " <TD style='vertical-align: top;'>" << descr << " </TD>";
1014 //----------------------
1019 ptm = gmtime ( &rawtime );
1022 s << "Automatically generated by <b>bbtk</b> on "
1023 << ptm->tm_mday << "/" << ptm->tm_mon << "/" << ptm->tm_year+1900
1024 << " - " << ptm->tm_hour << ":" << ptm->tm_min << " GMT\n";
1025 s << "</body></html>\n";
1027 //----------------------
1030 bbtkDebugDecTab("Kernel",9);
1033 //==========================================================================
1034 std::string Factory::GetObjectName() const
1036 return std::string("Factory");
1038 //==========================================================================
1040 //==========================================================================
1041 std::string Factory::GetObjectInfo() const
1043 std::stringstream i;
1046 //==========================================================================
1048 //==========================================================================
1049 size_t Factory::GetObjectSize() const
1051 size_t s = Superclass::GetObjectSize();
1052 s += Factory::GetObjectInternalSize();
1055 //==========================================================================
1056 //==========================================================================
1057 size_t Factory::GetObjectInternalSize() const
1059 size_t s = sizeof(Factory);
1062 //==========================================================================
1063 //==========================================================================
1064 size_t Factory::GetObjectRecursiveSize() const
1066 size_t s = Superclass::GetObjectRecursiveSize();
1067 s += Factory::GetObjectInternalSize();
1069 PackageMapType::const_iterator i;
1070 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
1072 s += i->second->GetObjectRecursiveSize();
1076 //==========================================================================