X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkFactory.cxx;h=627bc80881b1e99ac4b112dbf8244d543c8a9718;hb=63d56e2f28b834d9e13f3757aaa23ab63b2b3dd6;hp=bd057e349e8aeaa24c19f58d148fe078074bd8b7;hpb=c333db268f8b73bcf7fe7ff9eeed8394252f1c94;p=bbtk.git diff --git a/kernel/src/bbtkFactory.cxx b/kernel/src/bbtkFactory.cxx index bd057e3..627bc80 100644 --- a/kernel/src/bbtkFactory.cxx +++ b/kernel/src/bbtkFactory.cxx @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbtkFactory.cxx,v $ Language: C++ - Date: $Date: 2009/05/28 14:22:10 $ - Version: $Revision: 1.44 $ + Date: $Date: 2009/10/05 22:44:48 $ + Version: $Revision: 1.46 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -148,153 +148,158 @@ namespace bbtk // same for Windows, with c:, d: ... // // lastname : string before the last / (if any), or user supplied name + + if(name != ""){ + bbtkDebugMessageInc("kernel",7,"Factory::LoadPackage(\""< package_paths; + std::string libname; // full path library name + std::string pkgname; // e.g. libbb.so + + std::string upath; + pkgname = Utilities::ExtractPackageName(name,upath); + bbtkMessage("debug",1,"Package name ["<0) // ------------------------------------- check user supplied location + { + if (name[0] != '.' && name[0] != '/' && name[1]!= ':') + { + bbtkError("Use absolute or relative path name! ["<::iterator i; + for (i=package_paths.begin();i!=package_paths.end();++i) + { + foundFile = false; + path = *i; +//std::cout<<"JCP bbtkFactory.cxx void Factory::LoadPackage = path "< Trying to load [" << libname << "]" < package_paths; - std::string libname; // full path library name - std::string pkgname; // e.g. libbb.so - - std::string upath; - pkgname = Utilities::ExtractPackageName(name,upath); - - bbtkMessage("debug",1,"Package name ["<0) // ------------------------------------- check user supplied location - { - if (name[0] != '.' && name[0] != '/' && name[1]!= ':') - { - bbtkError("Use absolute or relative path name! ["<::iterator i; - for (i=package_paths.begin();i!=package_paths.end();++i) - { - foundFile = false; - path = *i; - - // we *really* want '.' to be the current working directory - if (path == ".") - { - char buf[2048]; // for getcwd - char * currentDir = getcwd(buf, 2048); - std::string cwd(currentDir); - path = currentDir; - } - - libname = Utilities::MakeLibnameFromPath(path, pkgname); - - bbtkMessage("debug",2,"-> Trying to load [" << libname << "]" <first << std::endl); if (details) { - i->second->PrintBlackBoxes(false,adaptors); + i->second->PrintHelpListDescriptors(false,adaptors); } } @@ -410,9 +414,10 @@ namespace bbtk //=================================================================== /// Displays help on a package - void Factory::HelpPackage(const std::string& name, bool adaptors) const + void Factory::PrintHelpPackage(const std::string& name, bool adaptors) const { - bbtkDebugMessageInc("kernel",9,"Factory::HelpPackage(\""<second->GetDescription()<second->GetNumberOfBlackBoxes()>0) + if (i->second->GetNumberOfDescriptors()>0) { bbtkMessage("help",1, "Black boxes : "<second->PrintBlackBoxes(true,adaptors); + i->second->PrintHelpListDescriptors(true,adaptors); } else { @@ -456,20 +461,21 @@ namespace bbtk //=================================================================== /// Prints help on the black box of type /// Returns the package to which it belongs - void Factory::HelpBlackBox(const std::string& name, + void Factory::PrintHelpDescriptor(const std::string& name, std::string& package, bool full) const { - bbtkDebugMessageInc("kernel",9,"Factory::HelpBlackBox(\""<second->ContainsBlackBox(name)) + if (i->second->ContainsDescriptor(name)) { - i->second->HelpBlackBox(name,full); + i->second->PrintHelpDescriptor(name,full); package = i->second->GetName(); found = true; } @@ -784,14 +790,14 @@ namespace bbtk //=================================================================== - void Factory::CheckPackages() const + void Factory::Check() const { bbtkMessage("debug",1,"****** Checking Factory "<<(void*)this <second->CheckBoxes(); + i->second->Check(); } bbtkMessage("debug",1,"****** Checking Factory "<<(void*)this <<" ... OK"<second->ContainsBlackBox(name)) - { + if (i->second->ContainsDescriptor(name)) + { std::string separator = ConfigurationFile::GetInstance().Get_file_separator (); - - // Don't pollute the file store with "temp_dir" directories ... + + // Don't pollute the file store with "temp_dir" directories ... std::string default_doc_dir = ConfigurationFile::GetInstance().Get_default_temp_dir(); std::string directory = "\"" + default_doc_dir + separator + "temp_dir" +separator + "\""; std::string filename2 = default_doc_dir + separator + "temp_dir" + separator + "tmp.html"; - + #if defined(_WIN32) - std::string command("start \"Titre\" /D "); + std::string command("start \"Titre\" /D "); #else - std::string command("gnome-open "); + std::string command("gnome-open "); #endif - command=command + directory +" tmp.html"; - FILE *ff; - ff=fopen(filename2.c_str(),"w"); - - fprintf(ff,"TMP \n"); - - - //fprintf(ff, "Link\n", i->second->GetDocURL().c_str(),name.c_str() ); - fclose(ff); - system( command.c_str() ); - found = true; - } + command=command + directory +" tmp.html"; + FILE *ff; + ff=fopen(filename2.c_str(),"w"); + + fprintf(ff,"TMP \n"); + + + //fprintf(ff, "Link\n", i->second->GetDocURL().c_str(),name.c_str() ); + fclose(ff); + system( command.c_str() ); + found = true; + } } - + bbtkDebugDecTab("kernel",9); if (!found) { - bbtkError("No package of the factory contains any black box <" - <"); + bbtkError("No package of the factory contains any black box <" + <"); } } @@ -890,9 +896,9 @@ namespace bbtk { Package::Pointer pack = i->second; if (pack->GetName()=="user") continue; - Package::BlackBoxMapType::const_iterator j; - for (j = pack->GetBlackBoxMap().begin(); - j!= pack->GetBlackBoxMap().end(); + Package::DescriptorMapType::const_iterator j; + for (j = pack->GetDescriptorMap().begin(); + j!= pack->GetDescriptorMap().end(); ++j) {