1 /*=========================================================================
4 Module: $RCSfile: bbtkFactory.cxx,v $
7 Date: $Date: 2008/07/01 07:58:28 $
8 Version: $Revision: 1.37 $
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
44 //===================================================================
46 Factory::Pointer Factory::New()
48 bbtkDebugMessage("Kernel",9,"Factory::New()"<<std::endl);
49 return MakePointer(new Factory());
51 //===================================================================
53 //===================================================================
58 bbtkDebugMessage("Kernel",7,"Factory::Factory()"<<std::endl);
60 //===================================================================
62 //===================================================================
66 bbtkDebugMessageInc("Kernel",7,"Factory::~Factory()"<<std::endl);
68 bbtkDebugDecTab("Kernel",7);
70 //===================================================================
74 //===================================================================
77 bbtkDebugMessageInc("Kernel",7,"Factory::Reset()"<<std::endl);
79 bbtkDebugDecTab("Kernel",7);
81 //===================================================================
84 // ===================================================================
85 bool Factory::DoLoadPackage(std::string libname,
90 Package::Pointer p = Package::CreateFromDynamicLibrary(libname,
95 //===================================================================
96 bbtkMessage("Output",2,p->GetName()<<" "
99 <<p->GetAuthor() << " Category(s) :"
102 bbtkMessage("Output",2,p->GetDescription()<<std::endl);
103 //===================================================================
104 p->AddFactory(GetThisPointer<Factory>());
105 mPackageMap[pkgname] = p;
112 //===================================================================
113 /// \brief Loads a package.
115 /// The name is the system-independant name of the package (the name of the instance of bbtk::Package).
116 /// Tries to open the dynamic library :
117 /// - "libbb<name>.so" for linux systems,
118 /// - "bb<name>.dll" for windows systems.
119 /// If it succeeds, then tries to load the symbols "<name>GetPackage" and "<name>DeletePackage".
120 /// "<name>GetPackage" is called to get the pointer on the bbtk::Package of the library
121 /// ("<name>DeletePackage" is not used, its presence is just checked before loading the package).
123 /// now, filename is only the last name (no longer the full name!)
124 /// it will be searched within *all* the paths given in bbtk_config.xml
128 void Factory::LoadPackage( const std::string& name )
130 // Note : in the following :
131 // name : the user supplied name
132 // - abreviated name e.g. pkg pkg.so libbpkg libbbpkg.so
133 // - relative full name e.g. ./libbbpkg.so ../../libbbpkg.so
134 // - absolute full name e.g. /home/usrname/proj/lib/libbbpkg.so
135 // same for Windows, with c:, d: ...
137 // lastname : string before the last / (if any), or user supplied name
139 bbtkDebugMessageInc("Kernel",7,"Factory::LoadPackage(\""<<name<<"\")"<<std::endl);
140 bbtkMessage("debug",1,"Factory::LoadPackage(\""<<name<<"\")"<<std::endl);
142 std::vector<std::string> package_paths;
143 std::string libname; // full path library name
144 std::string pkgname; // e.g. libbb<pkgname>.so
147 pkgname = Utilities::ExtractPackageName(name,upath);
149 bbtkMessage("debug",1,"Package name ["<<pkgname<<"]"<<std::endl);
150 bbtkMessage("debug",1,"Package path ["<<upath<<"]"<<std::endl);
152 // no loading package if already loaded
153 PackageMapType::iterator iUnload;
154 iUnload = mPackageMap.find(pkgname);
155 if (iUnload != mPackageMap.end())
157 bbtkMessage("Output",2,"["<< pkgname <<"] already loaded" << std::endl);
161 // =================================================
162 // The following structure was checked to work
163 // with any type of relative/absolute path.
164 // Please don't modify it without checking
165 // *all* the cases. JP
166 //==================================================
168 //std::cout << "upath [" << upath << "]" << std::endl;
171 bool foundFile = false;
173 // If path provided by user will be the first scanned :
174 // push it into vector of paths
175 if (upath.length()>0) // ------------------------------------- check user supplied location
177 if (name[0] != '.' && name[0] != '/' && name[1]!= ':')
179 bbtkError("Use absolute or relative path name! ["<<name<<"] is an illegal name");
183 // std::string path = Utilities::ExpandLibName(upath, false);
184 std::string path = Utilities::ExpandLibName(name,false); // keep last item, here.
189 Utilities::ExtractPackageName(path,p2);
190 //libname = Utilities::MakeLibnameFromPath(path, pkgname);
191 libname = Utilities::MakeLibnameFromPath(p2, pkgname); // remove last item
192 // Check if library exists
193 if ( !Utilities::FileExists(libname) )
195 // The following is *NOT* a debug time message :
196 // It's a user intended message.
197 // Please don't remove it.
198 bbtkMessage("Output",3," [" <<libname
199 <<"] : doesn't exist" <<std::endl);
203 ok = DoLoadPackage( libname, pkgname, path);
208 bbtkError("Path ["<<upath<<"] doesn't exist");
212 else // ----------------------------------------------------- iterate on the paths
216 package_paths = ConfigurationFile::GetInstance().Get_package_paths();
217 std::vector<std::string>::iterator i;
218 for (i=package_paths.begin();i!=package_paths.end();++i)
223 // we *really* want '.' to be the current working directory
226 char buf[2048]; // for getcwd
227 char * currentDir = getcwd(buf, 2048);
228 std::string cwd(currentDir);
232 libname = Utilities::MakeLibnameFromPath(path, pkgname);
234 bbtkMessage("debug",2,"-> Trying to load [" << libname << "]" <<std::endl);
236 // Check if library exists
237 if ( !Utilities::FileExists(libname) )
239 // The following is *NOT* a debug time message :
240 // It's a user intended message.
241 // Please don't remove it.
242 bbtkMessage("Output",3,
243 " [" <<libname <<"] : doesn't exist" <<std::endl);
244 continue; // try next path
248 // Try to Load the library
250 ok = DoLoadPackage( libname, pkgname, path);
253 bbtkMessage("debug",2," OK"<<std::endl);
254 break; // a package was found; we stop iterating
256 } //------------------ // end for ( package_paths.begin();i!=package_paths.end() )
260 if( !ok ) // nothing was loaded
264 bbtkError("Could not find package ["<<pkgname<< "]");
268 #if defined(__GNUC__)
269 bbtkError("Could not load package ["<< pkgname
270 <<"] :" << std::endl << " " << dlerror());
271 #elif defined(_WIN32)
272 bbtkError("Could not load package ["<<pkgname
273 <<"] : " << std::endl << " " <<libname<<" not found");
275 // look how to get the error message on win
277 // it is the bordel !! (the bloody fucking bordel, you mean?)
278 // look : http://msdn2.microsoft.com/en-us/library/ms680582.aspx
282 bbtkMessage("Output",2,"[" << libname << "] loaded" << std::endl);
286 //===================================================================
287 /// \brief UnLoads a package.
289 /// The package must have been previously loaded by LoadPackage.
290 /// If the entry is found in the map, calls ClosePackage
291 void Factory::UnLoadPackage( const std::string& name )
293 bbtkDebugMessageInc("Kernel",7,"Factory::UnLoadPackage(\""
294 <<name<<"\")"<<std::endl);
296 PackageMapType::iterator i;
297 i = mPackageMap.find(name);
298 if (i == mPackageMap.end())
300 bbtkError("cannot unload package \""<<name
301 <<"\" : package not loaded !");
304 bbtkDebugDecTab("Kernel",7);
306 //===================================================================
309 //===================================================================
310 void Factory::CloseAllPackages()
312 bbtkDebugMessageInc("Kernel",7,"Factory::CloseAllPackages()"<<std::endl);
313 while (mPackageMap.begin() != mPackageMap.end())
315 PackageMapType::iterator i = mPackageMap.begin();
318 bbtkDebugDecTab("Kernel",7);
320 //===================================================================
322 //===================================================================
323 /// \brief Close the package referenced by the iterator
325 /// First removes the factory from the set of factories which use the package
326 /// If the set is empty then :
327 /// If it is a dynamically loaded package :
328 /// - Loads and calls the function "<name>DeletePackage" of the dynamic library (responsible for package desallocation)
329 /// - Closes the dynamic library
331 /// - deletes the package normally
333 /// Finally erases the package entry in the packages map
334 void Factory::ClosePackage(PackageMapType::iterator& i)
336 bbtkDebugMessageInc("Kernel",7,"Factory::ClosePackage(\""
337 <<i->second->GetName()
341 // Removes this from the set of factories which use the package
342 i->second->RemoveFactory(GetThisPointer<Factory>());
343 Package::WeakPointer p = i->second;
344 // remove the entry in the map
345 mPackageMap.erase(i);
346 // Release the package if not already destroyed
347 if (p.lock()) Package::Release(p);
350 bbtkDebugDecTab("Kernel",7);
352 //===================================================================
356 //===================================================================
357 /// Displays the list of packages loaded
358 void Factory::PrintPackages(bool details, bool adaptors) const
360 bbtkDebugMessageInc("Kernel",9,"Factory::PrintPackages"<<std::endl);
362 PackageMapType::const_iterator i;
363 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
365 bbtkMessage("Help",1, i->first << std::endl);
367 i->second->PrintBlackBoxes(false,adaptors);
371 bbtkDebugDecTab("Kernel",9);
373 //===================================================================
375 //===================================================================
376 /// Displays help on a package
377 void Factory::HelpPackage(const std::string& name, bool adaptors) const
379 bbtkDebugMessageInc("Kernel",9,"Factory::HelpPackage(\""<<name<<"\")"
382 PackageMapType::const_iterator i = mPackageMap.find(name);
383 if ( i != mPackageMap.end() )
385 bbtkMessage("Help",1, "Package "<<i->first<<" ");
387 if (i->second->GetVersion().length()>0)
388 bbtkMessageCont("Help",1,"v" <<i->second->GetVersion());
390 if (i->second->GetAuthor().length()>0)
391 bbtkMessageCont("Help",1,"- "<<i->second->GetAuthor());
393 if (i->second->GetCategory().length()>0)
394 bbtkMessageCont("Help",1,"- "<<i->second->GetCategory());
396 bbtkMessageCont("Help",1,std::endl);
397 bbtkIncTab("Help",1);
398 bbtkMessage("Help",1,i->second->GetDescription()<<std::endl);
399 if (i->second->GetNumberOfBlackBoxes()>0)
401 bbtkMessage("Help",1, "Black boxes : "<<std::endl);
402 i->second->PrintBlackBoxes(true,adaptors);
406 bbtkMessage("Help",1, "No black boxes"<<std::endl);
408 bbtkDecTab("Help",1);
412 bbtkDebugDecTab("Kernel",9);
413 bbtkError("package \""<<name<<"\" unknown");
416 bbtkDebugDecTab("Kernel",9);
418 //===================================================================
420 //===================================================================
421 /// Prints help on the black box of type <name>
422 /// Returns the package to which it belongs
423 void Factory::HelpBlackBox(const std::string& name,
424 std::string& package,
427 bbtkDebugMessageInc("Kernel",9,"Factory::HelpBlackBox(\""<<name<<"\")"
431 PackageMapType::const_iterator i;
432 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
434 if (i->second->ContainsBlackBox(name))
436 i->second->HelpBlackBox(name,full);
437 package = i->second->GetName();
442 bbtkDebugDecTab("Kernel",9);
445 bbtkError("No package of the factory contains any black box <"
449 //===================================================================
452 //===================================================================
453 /// Inserts a package in the factory
454 void Factory::InsertPackage( Package::Pointer p )
456 bbtkDebugMessageInc("Kernel",9,"Factory::InsertPackage(\""<<
457 p->GetName()<<"\")"<<std::endl);
459 p->AddFactory(GetThisPointer<Factory>());
460 mPackageMap[p->GetName()] = p;
462 bbtkDebugDecTab("Kernel",9);
464 //===================================================================
466 //===================================================================
467 /// Removes a package from the factory (and deletes it)
468 void Factory::RemovePackage( Package::Pointer p )
470 bbtkDebugMessageInc("Kernel",9,"Factory::RemovePackage(\""<<
471 p->GetName()<<"\")"<<std::endl);
473 PackageMapType::iterator i;
474 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
476 if (i->second == p) break;
479 if (i!=mPackageMap.end())
485 bbtkError("Factory::RemovePackage(\""<<
486 p->GetName()<<"\") : package absent from factory");
489 bbtkDebugDecTab("Kernel",9);
491 //===================================================================
494 //===================================================================
495 /// Creates an instance of a black box of type <type> with name <name>
496 BlackBox::Pointer Factory::NewBlackBox(const std::string& type,
497 const std::string& name) const
499 bbtkDebugMessageInc("Kernel",7,"Factory::NewBlackBox(\""
500 <<type<<"\",\""<<name<<"\")"<<std::endl);
503 PackageMapType::const_iterator i;
504 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
506 b = i->second->NewBlackBox(type,name);
511 bbtkError("black box type \""<<type<<"\" unknown");
514 bbtkDebugDecTab("Kernel",7);
517 //===================================================================
519 //===================================================================
520 /// Creates an instance of a black box of type <type> with name <name>
521 BlackBox::Pointer Factory::NewAdaptor(const DataInfo& typein,
522 const DataInfo& typeout,
523 const std::string& name) const
525 bbtkDebugMessageInc("Kernel",8,"Factory::NewAdaptor("
528 <<name<<"\")"<<bbtkendl);
532 PackageMapType::const_iterator i;
533 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
535 b = i->second->NewAdaptor(typein,typeout,name);
540 bbtkError("no "<<typein<<" to "<<typeout
541 <<" adaptor available");
544 bbtkDebugDecTab("Kernel",7);
547 //===================================================================
550 //===================================================================
551 /// Creates an instance of a black box of type <type> with name <name>
552 BlackBox::Pointer Factory::NewWidgetAdaptor(const DataInfo& typein,
553 const DataInfo& typeout,
554 const std::string& name) const
556 bbtkDebugMessageInc("Kernel",8,"Factory::NewWidgetAdaptor(<"
559 <<name<<"\")"<<bbtkendl);
563 PackageMapType::const_iterator i;
564 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
566 b = i->second->NewWidgetAdaptor(typein,
573 bbtkError("no "<<typein<<" to "<<typeout
574 <<"> widget adaptor available");
577 bbtkDebugDecTab("Kernel",7);
580 //===================================================================
582 //===================================================================
583 /// Creates an instance of a black box of type <type> with name <name>
584 bool Factory::FindAdaptor(const DataInfo& typein,
585 const DataInfo& typeout,
586 std::string& adaptor) const
588 bbtkDebugMessageInc("Kernel",8,"Factory::FindAdaptor(<"
590 <<typeout<<">)"<<bbtkendl);
593 PackageMapType::const_iterator i;
594 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
596 b = i->second->FindAdaptor(typein,
604 bbtkError("no "<<typein<<" to "<<typeout
605 <<"> widget adaptor available");
609 bbtkDebugDecTab("Kernel",7);
612 //===================================================================
614 //===================================================================
615 /// Creates an instance of a black box of type <type> with name <name>
616 bool Factory::FindWidgetAdaptor(const DataInfo& typein,
617 const DataInfo& typeout,
618 std::string& adaptor) const
620 bbtkDebugMessageInc("Kernel",8,"Factory::FindWidgetAdaptor(<"
622 <<typeout<<">)"<<bbtkendl);
625 PackageMapType::const_iterator i;
626 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
628 b = i->second->FindWidgetAdaptor(typein,
633 bbtkDebugDecTab("Kernel",7);
636 //===================================================================
638 //===================================================================
639 /// Creates an instance of a black box of type <type> with name <name>
640 bool Factory::FindWidgetAdaptor2(const DataInfo& typein,
641 const DataInfo& typeout,
643 std::string& adaptor) const
645 bbtkDebugMessageInc("Kernel",8,"Factory::FindWidgetAdaptor(<"
647 <<typeout<<">)"<<bbtkendl);
650 adaptor = widget = "";
651 PackageMapType::const_iterator i;
652 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
654 b = i->second->FindWidgetAdaptor(typein,
661 // Look for a widget adaptor with good nature out
662 bbtkMessage("Kernel",5,
663 "*** Looking for a two pieces widget adaptor for : "
664 << typein << "->"<<typeout<<std::endl);
665 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
667 Package::AdaptorMapType::const_iterator j;
668 for (j=i->second->GetAdaptorMap().begin();
669 j!=i->second->GetAdaptorMap().end();
672 if ( ( j->first.mKind ==
673 BlackBoxDescriptor::DEFAULT_GUI) &&
674 //(j->first.mTypeIn == typein) &&
675 (j->first.mTypeOut.GetNature() == typeout.GetNature() )
678 widget = j->second.lock()->GetTypeName();
679 bbtkMessage("Kernel",5,
680 "===> Found first part : "<<widget
681 << " "<<j->first.mTypeIn<<"->"
682 <<j->first.mTypeOut<<std::endl);
683 DataInfo ti( j->first.mTypeOut.GetType(), "");
684 DataInfo to( typeout.GetType(), "");
685 b = FindAdaptor( ti, to, adaptor );
688 bbtkMessage("Kernel",5,
689 "===> Found second part : "<<adaptor
695 bbtkMessage("Kernel",5,
696 "===> No second part found"<<std::endl);
703 bbtkDebugDecTab("Kernel",7);
706 //===================================================================
708 //===================================================================
709 /// Creates an instance of a connection
710 Connection::Pointer Factory::NewConnection(BlackBox::Pointer from,
711 const std::string& output,
712 BlackBox::Pointer to,
713 const std::string& input) const
715 bbtkDebugMessage("Kernel",7,"Factory::NewConnection(\""
716 <<from->bbGetName()<<"\",\""<<output<<"\",\""
717 <<to->bbGetName()<<"\",\""<<input
720 return Connection::New(from,output,to,input,
721 GetThisPointer<Factory>());
723 //===================================================================
727 //===================================================================
728 Package::Pointer Factory::GetPackage(const std::string& name) const
730 bbtkDebugMessageInc("Kernel",9,"Factory::GetPackage(\""<<name<<"\")"
733 PackageMapType::const_iterator i = mPackageMap.find(name);
734 if ( i != mPackageMap.end() )
736 bbtkDebugDecTab("Kernel",9);
741 bbtkDebugDecTab("Kernel",9);
742 bbtkError("package \""<<name<<"\" unknown");
745 bbtkDebugDecTab("Kernel",9);
747 //===================================================================
750 //===================================================================
751 void Factory::CheckPackages() const
753 bbtkMessage("debug",1,"****** Checking Factory "<<(void*)this
755 PackageMapType::const_iterator i;
756 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
758 i->second->CheckBoxes();
760 bbtkMessage("debug",1,"****** Checking Factory "<<(void*)this
761 <<" ... OK"<<std::endl);
763 //===================================================================
765 //===================================================================
766 void Factory::WriteDotFilePackagesList(FILE *ff)
769 bbtkDebugMessageInc("Kernel",9,"Factory::WriteDotFilePackagesList()"
773 fprintf( ff , "subgraph cluster_FACTORY {\n");
774 fprintf( ff , " label = \"PACKAGES\"%s\n", ";");
775 fprintf( ff , " style=filled%s\n",";");
776 fprintf( ff , " color=lightgrey%s\n",";");
777 fprintf( ff , " rankdir=TB%s\n",";");
780 PackageMapType::const_iterator i;
781 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
783 url=GetPackage(i->first)->GetDocURL();
784 fprintf(ff," %s [shape=ellipse, URL=\"%s\"]%s\n",i->first.c_str(),url.c_str(),";" );
786 fprintf( ff , "}\n\n");
787 bbtkDebugDecTab("Kernel",9);
789 //===================================================================
792 void Factory::ShowGraphTypes(const std::string& name) const
796 PackageMapType::const_iterator i;
797 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
799 if (i->second->ContainsBlackBox(name))
801 std::string separator = ConfigurationFile::GetInstance().Get_file_separator ();
803 // Don't pollute the file store with "temp_dir" directories ...
804 std::string default_doc_dir = ConfigurationFile::GetInstance().Get_default_temp_dir();
805 std::string directory = "\"" + default_doc_dir + separator + "temp_dir" +separator + "\"";
806 std::string filename2 = default_doc_dir + separator + "temp_dir" + separator + "tmp.html";
809 std::string command("start \"Titre\" /D ");
811 std::string command("gnome-open ");
813 command=command + directory +" tmp.html";
815 ff=fopen(filename2.c_str(),"w");
817 fprintf(ff,"<html><head><title>TMP</title> <script type=\"text/javascript\"> <!--\n");
818 fprintf(ff," window.location=\"%s#%s\";\n" , i->second->GetDocURL().c_str(),name.c_str() );
819 fprintf(ff,"//--></script></head><body></body></html>\n");
822 //fprintf(ff, "<a href=\"%s#%s\">Link</a>\n", i->second->GetDocURL().c_str(),name.c_str() );
824 system( command.c_str() );
829 bbtkDebugDecTab("Kernel",9);
832 bbtkError("No package of the factory contains any black box <"
840 void Factory::CreateHtmlIndex(IndexEntryType type,
841 const std::string& filename)
843 bbtkDebugMessageInc("Kernel",9,"Factory::CreateHtmlIndex(\""
844 <<filename<<"\")"<<bbtkendl);
848 typedef std::map<std::string,
849 std::vector<BlackBoxDescriptor::Pointer> > IndexType;
851 // Builds the index map
852 PackageMapType::const_iterator i;
853 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
855 Package::Pointer pack = i->second;
856 if (pack->GetName()=="user") continue;
857 Package::BlackBoxMapType::const_iterator j;
858 for (j = pack->GetBlackBoxMap().begin();
859 j!= pack->GetBlackBoxMap().end();
864 if ( type==Adaptors )
866 if (j->second->GetKind() == BlackBoxDescriptor::STANDARD )
870 if (j->second->GetKind() != BlackBoxDescriptor::STANDARD )
873 std::vector<std::string> keys;
877 k += pack->GetName();
879 title = "Boxes by package";
881 else if ((type==Initials) || (type==Adaptors))
883 std::string init(" ");
884 init[0] = std::toupper(j->second->GetTypeName()[0]);
885 keys.push_back(init);
886 title = "Alphabetical list";
888 else if (type==Categories)
890 // Split the category string
891 std::string delimiters = ";,";
892 Utilities::SplitString(j->second->GetCategory(),
895 keys.push_back(" NONE");
896 title = "Boxes by category";
900 std::vector<std::string>::const_iterator k;
901 for (k=keys.begin(); k!=keys.end(); ++k )
903 IndexType::iterator p;
905 if (p != index.end())
907 p->second.push_back(j->second);
911 std::vector<BlackBoxDescriptor::Pointer> v;
912 v.push_back(j->second);
920 //---------------------
923 s.open(filename.c_str());
926 bbtkError("Factory::CreateHtmlIndex : could not open file '"
930 //----------------------
932 s << "<html lang=\"en\">\n";
934 s << "<title>"<<title<<"</title>\n";
935 s << "<meta http-equiv=\"Content-Type\" content=\"text/html\">\n";
936 s << "<meta name=\"description\" content=\""<<title<<"\">\n";
937 s << "<meta name=\"generator\" content=\"\">\n";
938 s << "<link title=\"Top\" rel=\"top\" href=\"#Top\">\n";
939 //<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
940 s << "<meta http-equiv=\"Content-Style-Type\" content=\"text/css\"><style type=\"text/css\"><!--\n";
941 s << "pre.display { font-family:inherit }\n";
942 s << "pre.format { font-family:inherit }\n";
943 s << "pre.smalldisplay { font-family:inherit; font-size:smaller }\n";
944 s << "pre.smallformat { font-family:inherit; font-size:smaller }\n";
945 s << "pre.smallexample { font-size:smaller }\n";
946 s << "pre.smalllisp { font-size:smaller }\n";
947 s << "span.sc { font-variant:small-caps }\n";
948 s << "span.roman { font-family:serif; font-weight:normal; } \n";
949 s << "span.sansserif { font-family:sans-serif; font-weight:normal; }\n";
950 s << "--></style>\n";
952 //----------------------
954 //----------------------
957 s << "<a name=\"Top\"></a>\n";
958 s << "<h1 class=\"settitle\">"<<title<<"</h1>\n";
960 IndexType::iterator ii;
961 for (ii=index.begin();ii!=index.end();++ii)
963 s << "<a href=\"#"<<ii->first<<"\">"<<ii->first<<"</a> ";
966 for (ii=index.begin();ii!=index.end();++ii)
969 s << "<p><a href=\"#Top\">Top</a>";
972 s << "<a name=\""<<ii->first<<"\"></a>\n";
973 s << "<p><a href=\""<<ii->first<<"/index.html\">"
974 << ii->first<<"</a>\n";
976 s << " - \n";
978 s << "<a name=\"doxygen\"></a>\n";
979 s << "<a href=..\\doxygen\\" << ii->first << "/main.html>(Doxygen documentation of the source)</a>\n";
983 s << "<a name=\""<<ii->first<<"\"></a>\n";
984 s << "<p><b>"<<ii->first<<"</b>\n";
988 s << "<p><TABLE cellspacing=0 cellpadding=3>\n";
990 std::vector<BlackBoxDescriptor::Pointer>::iterator di;
991 for (di=ii->second.begin();di!=ii->second.end();++di)
993 std::string pack = (*di)->GetPackage()->GetName();
994 std::string name = (*di)->GetTypeName();
995 Utilities::html_format(name);
996 std::string descr = (*di)->GetDescription();
997 Utilities::html_format(descr);
999 s << "<TD style='vertical-align: top;'>";
1000 s << " <a href=\""<<pack
1001 <<"/index.html#"<<name<<"\">"
1002 <<pack<<"::"<<name<<"</a>";
1004 s << " <TD style='vertical-align: top;'>" << descr << " </TD>";
1011 //----------------------
1016 ptm = gmtime ( &rawtime );
1019 s << "Automatically generated by <b>bbtk</b> on "
1020 << ptm->tm_mday << "/" << ptm->tm_mon << "/" << ptm->tm_year+1900
1021 << " - " << ptm->tm_hour << ":" << ptm->tm_min << " GMT\n";
1022 s << "</body></html>\n";
1024 //----------------------
1027 bbtkDebugDecTab("Kernel",9);
1030 //==========================================================================
1031 std::string Factory::GetObjectName() const
1033 return std::string("Factory");
1035 //==========================================================================
1037 //==========================================================================
1038 std::string Factory::GetObjectInfo() const
1040 std::stringstream i;
1043 //==========================================================================
1045 //==========================================================================
1046 size_t Factory::GetObjectSize() const
1048 size_t s = Superclass::GetObjectSize();
1049 s += Factory::GetObjectInternalSize();
1052 //==========================================================================
1053 //==========================================================================
1054 size_t Factory::GetObjectInternalSize() const
1056 size_t s = sizeof(Factory);
1059 //==========================================================================
1060 //==========================================================================
1061 size_t Factory::GetObjectRecursiveSize() const
1063 size_t s = Superclass::GetObjectRecursiveSize();
1064 s += Factory::GetObjectInternalSize();
1066 PackageMapType::const_iterator i;
1067 for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
1069 s += i->second->GetObjectRecursiveSize();
1073 //==========================================================================