Program: bbtk
Module: $RCSfile: bbtkPackage.cxx,v $
Language: C++
- Date: $Date: 2008/02/05 12:16:55 $
- Version: $Revision: 1.4 $
+ Date: $Date: 2008/02/18 10:41:02 $
+ Version: $Revision: 1.9 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See doc/license.txt or
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");
// std::cout << " url=["<<url<<"]"<<std::endl;
// std::cout << "relurl=["<<relurl<<"]"<<std::endl;
- bbtkDebugMessage("Core",7,"Package::Package(\""<<name<<"\")"<<bbtkendl);
+ bbtkDebugMessage("Kernel",7,"Package::Package(\""<<name<<"\")"<<bbtkendl);
}
//==========================================================================
/// Dtor
Package::~Package()
{
- bbtkDebugMessageInc("Core",7,"Package::~Package(\""<<mName<<"\")"<<bbtkendl);
+ bbtkDebugMessageInc("Kernel",7,"Package::~Package(\""<<mName<<"\")"<<bbtkendl);
BlackBoxMapType::const_iterator i;
for (i=mBlackBoxMap.begin();
i!=mBlackBoxMap.end();
delete j->second;
}
*/
- bbtkDebugDecTab("Core",7);
+ bbtkDebugDecTab("Kernel",7);
}
//==========================================================================
BlackBox* Package::NewBlackBox(const std::string& type,
const std::string& name) const
{
- bbtkDebugMessageInc("Core",8,"Package<"<<GetName()<<">::NewBlackBox(\""<<type<<"\",\""<<name<<"\")"<<bbtkendl);
+ bbtkDebugMessageInc("Kernel",8,"Package<"<<GetName()<<">::NewBlackBox(\""<<type<<"\",\""<<name<<"\")"<<bbtkendl);
BlackBoxMapType::const_iterator i = mBlackBoxMap.find(type);
if (i == mBlackBoxMap.end())
{
- bbtkDebugDecTab("Core",8);
+ bbtkDebugDecTab("Kernel",8);
return 0;
}
BlackBox* bb =i->second->CreateInstance(name);
- bbtkDebugDecTab("Core",8);
+ bbtkDebugDecTab("Kernel",8);
return bb;
}
TypeInfo typeout,
const std::string& name) const
{
- bbtkDebugMessageInc("Core",8,"Package<"<<GetName()<<
+ bbtkDebugMessageInc("Kernel",8,"Package<"<<GetName()<<
">::NewAdaptor(<"
<<TypeName(typein)<<">,<"
<<TypeName(typeout)<<">,\""
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;
}
/// Registers a black box descriptor in the package
bool Package::RegisterBlackBox(BlackBoxDescriptor* d)
{
- bbtkDebugMessageInc("Core",8,"Package<"<<GetName()<<">::RegisterBlackBox(\""<<d->GetTypeName()<<"\")"<<std::endl);
+ bbtkDebugMessageInc("Kernel",8,"Package<"<<GetName()<<">::RegisterBlackBox(\""<<d->GetTypeName()<<"\")"<<std::endl);
mBlackBoxMap[d->GetTypeName()] = d;
d->SetPackage(this);
AdaptorMapType::const_iterator i = mAdaptorMap.find(key);
if (i == mAdaptorMap.end())
{
- bbtkDebugMessage("Core",8,"The box is an adaptor, inserting it in adaptors map ..."<<std::endl);
+ bbtkDebugMessage("Kernel",8,"The box is an adaptor, inserting it in adaptors map ..."<<std::endl);
mAdaptorMap[key] = d;
}
// If already an adaptor registered : error
}
}
- bbtkDebugDecTab("Core",8);
+ bbtkDebugDecTab("Kernel",8);
return true;
}
/// UnRegisters a black box descriptor from the package
void Package::UnRegisterBlackBox(const std::string& name)
{
- bbtkDebugMessageInc("Core",8,"Package<"<<GetName()<<">::UnRegisterBlackBox(\""<<name<<"\")"<<std::endl);
+ bbtkDebugMessageInc("Kernel",8,"Package<"<<GetName()<<">::UnRegisterBlackBox(\""<<name<<"\")"<<std::endl);
// Looking into the bb map
BlackBoxMapType::iterator i = mBlackBoxMap.find(name);
if (i == mBlackBoxMap.end())
{
- bbtkDebugDecTab("Core",8);
+ bbtkDebugDecTab("Kernel",8);
bbtkError("UnRegister : The package <"<<GetName()<<"> does not contains the black box <"<<name<<">");
}
mBlackBoxMap.erase(i);
mAdaptorMap.erase(j);
}
*/
- bbtkDebugDecTab("Core",8);
+ bbtkDebugDecTab("Kernel",8);
}
//==========================================================================
/// Changes the name of a black box type
void Package::ChangeBlackBoxName( const std::string& oldname, const std::string& newname )
{
- bbtkDebugMessageInc("Core",8,"Package<"<<GetName()<<">::ChangeBlackBoxName(\""<<oldname<<"\",\""<<newname<<"\")"<<std::endl);
+ bbtkDebugMessageInc("Kernel",8,"Package<"<<GetName()<<">::ChangeBlackBoxName(\""<<oldname<<"\",\""<<newname<<"\")"<<std::endl);
// Looking into the bb map
BlackBoxMapType::iterator i = mBlackBoxMap.find(oldname);
if (i == mBlackBoxMap.end())
{
- bbtkDebugDecTab("Core",8);
+ bbtkDebugDecTab("Kernel",8);
bbtkError("ChangeBlackBoxName : The package <"<<GetName()<<"> does not contains the black box <"<<oldname<<">");
}
mBlackBoxMap[newname] = i->second;
mBlackBoxMap.erase(i);
- bbtkDebugDecTab("Core",8);
+ bbtkDebugDecTab("Kernel",8);
}
//==========================================================================
/// Registers an adaptor descriptor in the package
bool Package::RegisterAdaptor(BlackBoxDescriptor* d)
{
- bbtkDebugMessage("Core",8,"Package<"<<GetName()<<">::RegisterAdaptor(\""<<d->GetTypeName()<<"\")"<<std::endl);
+ bbtkDebugMessage("Kernel",8,"Package<"<<GetName()<<">::RegisterAdaptor(\""<<d->GetTypeName()<<"\")"<<std::endl);
TypeInfo typein = d->GetInputDescriptor("In")->GetTypeInfo();
TypeInfo typeout = d->GetOutputDescriptor("Out")->GetTypeInfo();
/// Prints help on a black box
void Package::HelpBlackBox(const std::string& name, bool full) const
{
- bbtkDebugMessageInc("Core",8,"Package<"<<GetName()<<">::HelpBlackBox(\""
+ bbtkDebugMessageInc("Kernel",8,"Package<"<<GetName()<<">::HelpBlackBox(\""
<<name<<"\")"<<bbtkendl);
BlackBoxMapType::const_iterator i = mBlackBoxMap.find(name);
if (i == mBlackBoxMap.end())
{
- bbtkDebugDecTab("Core",8);
+ bbtkDebugDecTab("Kernel",8);
bbtkError("The package <"<<GetName()<<"> does not contains the black box <"<<name<<">");
}
// bbtkMessage("Help",1,"["<<GetName()<<"] ");
i->second->GetHelp(full);
- bbtkDebugDecTab("Core",8);
+ bbtkDebugDecTab("Kernel",8);
}
//==========================================================================
/// Returns true iff the package contains the box of name boxname
bool Package::ContainsBlackBox(const std::string& name) const
{
- bbtkDebugMessageInc("Core",8,"Package<"<<GetName()<<">::HelpBlackBox(\""
+ bbtkDebugMessageInc("Kernel",8,"Package<"<<GetName()<<">::HelpBlackBox(\""
<<name<<"\")"<<bbtkendl);
BlackBoxMapType::const_iterator i = mBlackBoxMap.find(name);
if (i == mBlackBoxMap.end())
{
- bbtkDebugDecTab("Core",8);
+ bbtkDebugDecTab("Kernel",8);
return false;
}
- bbtkDebugDecTab("Core",8);
+ bbtkDebugDecTab("Kernel",8);
return true;
}
//==========================================================================
int level,
bool relative_link ) const
{
- bbtkDebugMessageInc("Core",9,"Package<"<<GetName()<<">::CreateHtmlPage(\""
+ bbtkDebugMessageInc("Kernel",9,"Package<"<<GetName()<<">::CreateHtmlPage(\""
<<filename<<"\")"<<bbtkendl);
//---------------------
std::string name = i->second->GetTypeName();
Utilities::html_format(name);
std::string descr = i->second->GetDescription();
+ Utilities::html_format(descr);
s << "<TR>";
s << "<TD style='vertical-align: top;'>";
- s << "<li><a name=\"toc_"<<name
+ s << " <a name=\"toc_"<<name
<<"\" href=\"#"<<name<<"\">"
<<name<<"</a>";
s << "</TD> ";
s << "</TABLE>\n";
- s << "</li></ul>\n";
+ s << "</ul>\n";
s << "</div>\n";
//-------------------
s << "<TR>";
s << "<TD style='vertical-align: top;'>";
- s << "<li><a name=\"toc_"<<name
+ s << " <a name=\"toc_"<<name
<<"\" href=\"#"<<name<<"\">"
<<name<<"</a>";
s << "</TD> ";
}
s << "</TABLE>\n";
- s << "</li></ul>\n";
+ s << "</ul>\n";
s << "</div>\n";
}
// Computes output directory from filename to pass it to
// BlackBoxDescriptor::InsertHtmlHelp
std::string dir;
- std::string::size_type slash_position =
- filename.find_last_of(ConfigurationFile::GetInstance().Get_file_separator ());
- if (slash_position != std::string::npos) {
+
+ std::string::size_type slash_position = filename.find_last_of("/\\");
+
+
+ if (slash_position != std::string::npos) {
if (slash_position == 0)
slash_position = 1;
dir = filename.substr(0,slash_position);
ptm = gmtime ( &rawtime );
s << "<p><hr>\n";
- s << "Automatically generated by <b>"<<caller<<"</b> from <b>"
- <<source<<"</b> on "
+ s << "Automatically generated by <b>"<<caller<<"</b> "//from <b>"
+ // <<source<<"</b>
+ <<"on "
<< ptm->tm_mday << "/" << ptm->tm_mon << "/" << ptm->tm_year+1900
<< " - " << ptm->tm_hour << ":" << ptm->tm_min << " GMT\n";
s << "</body></html>\n";
//----------------------
// End
- bbtkDebugDecTab("Core",9);
+ bbtkDebugDecTab("Kernel",9);
}
//==========================================================================
}