X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkPackage.cxx;h=5fd8cce424c9b726b72dd34bac9c7ae90cab2e10;hb=6ad84645e7e5971e3a7b166bd3099c06c343010f;hp=4acb0f16192f8351b1219b8f73e0e2abfba64834;hpb=a26195c366a89795288009cf7e20f11afa494970;p=bbtk.git diff --git a/kernel/src/bbtkPackage.cxx b/kernel/src/bbtkPackage.cxx index 4acb0f1..5fd8cce 100644 --- a/kernel/src/bbtkPackage.cxx +++ b/kernel/src/bbtkPackage.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkPackage.cxx,v $ Language: C++ - Date: $Date: 2008/01/22 15:02:00 $ - Version: $Revision: 1.1 $ + Date: $Date: 2008/02/08 07:39:49 $ + Version: $Revision: 1.7 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See doc/license.txt or @@ -41,11 +41,11 @@ namespace bbtk mVersion(version), mBBTKVersion(BBTKVersion) { - std::string default_doc_dir = ConfigurationFile::GetInstance().Get_default_doc_tmp(); + std::string default_doc_dir = ConfigurationFile::GetInstance().Get_default_temp_dir(); char c = default_doc_dir.c_str()[strlen(default_doc_dir.c_str())-1]; std::string url = default_doc_dir; if (c != '/' && c !='\\') url = url + "/"; - url = url + "doc_tmp/" + name + "/index.html"; + url = url + "temp_dir/" + name + "/index.html"; SetDocURL(url); SetDocRelativeURL("Relative url not set"); @@ -61,7 +61,7 @@ namespace bbtk // std::cout << " url=["<second; - } + i!=mBlackBoxMap.end(); + ++i) + { + delete i->second; + } // Adaptors are also stored in the black box map : hence already deleted /* AdaptorMapType::const_iterator j; for (j=mAdaptorMap.begin(); - j!=mAdaptorMap.end(); - ++j) + j!=mAdaptorMap.end(); + ++j) { - delete j->second; - } + delete j->second; + } */ - bbtkDebugDecTab("Core",7); + bbtkDebugDecTab("Kernel",7); } //========================================================================== @@ -100,16 +100,16 @@ namespace bbtk BlackBox* Package::NewBlackBox(const std::string& type, const std::string& name) const { - bbtkDebugMessageInc("Core",8,"Package<"<::NewBlackBox(\""<::NewBlackBox(\""<second->CreateInstance(name); - bbtkDebugDecTab("Core",8); + bbtkDebugDecTab("Kernel",8); return bb; } @@ -124,7 +124,7 @@ namespace bbtk TypeInfo typeout, const std::string& name) const { - bbtkDebugMessageInc("Core",8,"Package<"<::NewAdaptor(<" <,<" <,\"" @@ -134,11 +134,11 @@ namespace bbtk AdaptorMapType::const_iterator i = mAdaptorMap.find(key); if (i == mAdaptorMap.end()) { - bbtkDebugDecTab("Core",8); + bbtkDebugDecTab("Kernel",8); return 0; } BlackBox* bb =i->second->CreateInstance(name); - bbtkDebugDecTab("Core",8); + bbtkDebugDecTab("Kernel",8); return bb; } @@ -151,13 +151,13 @@ namespace bbtk /// Registers a black box descriptor in the package bool Package::RegisterBlackBox(BlackBoxDescriptor* d) { - bbtkDebugMessageInc("Core",8,"Package<"<::RegisterBlackBox(\""<GetTypeName()<<"\")"<::RegisterBlackBox(\""<GetTypeName()<<"\")"<GetTypeName()] = d; d->SetPackage(this); // If it is a default adaptor, also register it in the adaptors map - if ( d->GetCategory() == BlackBoxDescriptor::DEFAULT_ADAPTOR) + if ( d->GetKind() == BlackBoxDescriptor::DEFAULT_ADAPTOR) { TypeInfo typein = d->GetInputDescriptor("In")->GetTypeInfo(); TypeInfo typeout = d->GetOutputDescriptor("Out")->GetTypeInfo(); @@ -165,7 +165,7 @@ namespace bbtk AdaptorMapType::const_iterator i = mAdaptorMap.find(key); if (i == mAdaptorMap.end()) { - bbtkDebugMessage("Core",8,"The box is an adaptor, inserting it in adaptors map ..."< as default adaptor but there is already a default adaptor registered (<" <second->GetTypeName()<<">)"); } - - } - bbtkDebugDecTab("Core",8); + bbtkDebugDecTab("Kernel",8); return true; } @@ -192,24 +190,24 @@ namespace bbtk /// UnRegisters a black box descriptor from the package void Package::UnRegisterBlackBox(const std::string& name) { - bbtkDebugMessageInc("Core",8,"Package<"<::UnRegisterBlackBox(\""<::UnRegisterBlackBox(\""< does not contains the black box <"<"); - } + { + bbtkDebugDecTab("Kernel",8); + bbtkError("UnRegister : The package <"< does not contains the black box <"<"); + } mBlackBoxMap.erase(i); // Is it also in the adaptors map ? /* AdaptorMapType::iterator j = mAdaptorMap.find(name); if (j != mAdaptorMap.end()) { - mAdaptorMap.erase(j); + mAdaptorMap.erase(j); } */ - bbtkDebugDecTab("Core",8); + bbtkDebugDecTab("Kernel",8); } //========================================================================== @@ -217,20 +215,20 @@ namespace bbtk /// Changes the name of a black box type void Package::ChangeBlackBoxName( const std::string& oldname, const std::string& newname ) { - bbtkDebugMessageInc("Core",8,"Package<"<::ChangeBlackBoxName(\""<::ChangeBlackBoxName(\""< does not contains the black box <"<"); + bbtkDebugDecTab("Kernel",8); + bbtkError("ChangeBlackBoxName : The package <"< does not contains the black box <"<"); } i->second->SetTypeName(newname); mBlackBoxMap[newname] = i->second; mBlackBoxMap.erase(i); - bbtkDebugDecTab("Core",8); + bbtkDebugDecTab("Kernel",8); } //========================================================================== @@ -240,7 +238,7 @@ namespace bbtk /// Registers an adaptor descriptor in the package bool Package::RegisterAdaptor(BlackBoxDescriptor* d) { - bbtkDebugMessage("Core",8,"Package<"<::RegisterAdaptor(\""<GetTypeName()<<"\")"<::RegisterAdaptor(\""<GetTypeName()<<"\")"<GetInputDescriptor("In")->GetTypeInfo(); TypeInfo typeout = d->GetOutputDescriptor("Out")->GetTypeInfo(); @@ -259,7 +257,7 @@ namespace bbtk { unsigned int lmax = 0; std::vector names; - std::vector categs; + std::vector kinds; std::vector descrs; BlackBoxMapType::const_iterator i; @@ -268,25 +266,25 @@ namespace bbtk ++i) { if ( adaptors || - ( i->second->GetCategory() == BlackBoxDescriptor::STANDARD) ) + ( i->second->GetKind() == BlackBoxDescriptor::STANDARD) ) { std::string name(" "); name += i->second->GetTypeName(); names.push_back(name); - std::string categ; - if ( i->second->GetCategory() == BlackBoxDescriptor::ADAPTOR ) + std::string kind; + if ( i->second->GetKind() == BlackBoxDescriptor::ADAPTOR ) { - categ = std::string("[A]"); + kind = std::string("[A]"); } - else if ( i->second->GetCategory() == + else if ( i->second->GetKind() == BlackBoxDescriptor::DEFAULT_ADAPTOR ) { - categ = std::string("[DA]"); + kind = std::string("[DA]"); } - categs.push_back(categ); + kinds.push_back(kind); - unsigned int l = name.size()+categ.size(); + unsigned int l = name.size()+kind.size(); if (l>lmax) lmax = l; std::string descr; @@ -303,7 +301,7 @@ namespace bbtk std::string offs; offs.append(lmax+3,' '); std::vector::iterator ni,ci,di; - for (ni = names.begin(), ci = categs.begin(), di = descrs.begin(); + for (ni = names.begin(), ci = kinds.begin(), di = descrs.begin(); ni != names.end(); ++ni, ++ci, ++di) { std::string space; @@ -318,7 +316,7 @@ namespace bbtk else bbtkMessage("Help",1,d << std::endl); // d = d.substr(dmax,d.size()); - // } + // } } } @@ -333,11 +331,11 @@ namespace bbtk i!=mBlackBoxMap.end(); ++i) { - if ( i->second->GetCategory() != BlackBoxDescriptor::STANDARD ) + if ( i->second->GetKind() != BlackBoxDescriptor::STANDARD ) { bbtkMessage("Help",1, " "<second->GetTypeName()); - if ( i->second->GetCategory() == + if ( i->second->GetKind() == BlackBoxDescriptor::DEFAULT_ADAPTOR ) { bbtkMessage("Help",1, @@ -347,7 +345,7 @@ namespace bbtk { bbtkMessage("Help",1, " : "<second->GetDescription()); - + } bbtkMessage("Help",1,std::endl); } @@ -364,7 +362,7 @@ namespace bbtk { bbtkMessage("Help",1, " : "<second->GetDescription()); - + } bbtkMessage("Help",1,std::endl); } @@ -376,18 +374,18 @@ namespace bbtk /// Prints help on a black box void Package::HelpBlackBox(const std::string& name, bool full) const { - bbtkDebugMessageInc("Core",8,"Package<"<::HelpBlackBox(\"" + bbtkDebugMessageInc("Kernel",8,"Package<"<::HelpBlackBox(\"" < does not contains the black box <"<"); } // bbtkMessage("Help",1,"["<second->GetHelp(full); - bbtkDebugDecTab("Core",8); + bbtkDebugDecTab("Kernel",8); } //========================================================================== @@ -397,16 +395,16 @@ namespace bbtk /// Returns true iff the package contains the box of name boxname bool Package::ContainsBlackBox(const std::string& name) const { - bbtkDebugMessageInc("Core",8,"Package<"<::HelpBlackBox(\"" + bbtkDebugMessageInc("Kernel",8,"Package<"<::HelpBlackBox(\"" <::CreateHtmlPage(\"" + bbtkDebugMessageInc("Kernel",9,"Package<"<::CreateHtmlPage(\"" <\n"; s << " Author(s) : " << GetAuthor() << "\n"; - s << " Version : " + s << " Author(s) : " + << GetCategory() << "\n"; + s << " Version : " << GetVersion() << "\n"; s << " bbtk Version : " << GetBBTKVersion() << "\n"; @@ -527,16 +527,17 @@ namespace bbtk BlackBoxMapType::const_iterator i; for (i=mBlackBoxMap.begin(); i!=mBlackBoxMap.end(); ++i) { - if ( i->second->GetCategory() != BlackBoxDescriptor::STANDARD) + if ( i->second->GetKind() != BlackBoxDescriptor::STANDARD) continue; std::string name = i->second->GetTypeName(); Utilities::html_format(name); std::string descr = i->second->GetDescription(); - + Utilities::html_format(descr); + s << ""; s << ""; - s << "
  • " <"; s << " "; @@ -546,7 +547,7 @@ namespace bbtk s << "\n"; - s << "
  • \n"; + s << "\n"; s << "\n"; //------------------- @@ -556,21 +557,21 @@ namespace bbtk // s << "
    \n"; s << "

    Adaptors : \n"; s << "

      \n"; - + // BlackBoxMapType::const_iterator i; s << "

      \n"; for (i=mBlackBoxMap.begin(); i!=mBlackBoxMap.end();++i) { - if ( i->second->GetCategory() == BlackBoxDescriptor::STANDARD) + if ( i->second->GetKind() == BlackBoxDescriptor::STANDARD) continue; - + std::string name = i->second->GetTypeName(); Utilities::html_format(name); std::string descr = i->second->GetDescription(); - + s << ""; s << " "; @@ -578,8 +579,8 @@ namespace bbtk s << "\n"; } s << "
      "; - s << "
    • " <"; s << "
    • \n"; - - s << "

    \n"; + + s << "\n"; s << "
    \n"; } @@ -605,7 +606,7 @@ namespace bbtk filename.find_last_of(ConfigurationFile::GetInstance().Get_file_separator ()); if (slash_position != std::string::npos) { if (slash_position == 0) - slash_position = 1; + slash_position = 1; dir = filename.substr(0,slash_position); } @@ -633,7 +634,7 @@ namespace bbtk //---------------------- // End - bbtkDebugDecTab("Core",9); + bbtkDebugDecTab("Kernel",9); } //========================================================================== }