Program: bbtk
Module: $RCSfile: bbtkBlackBoxDescriptor.cxx,v $
Language: C++
- Date: $Date: 2008/01/30 12:14:42 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2008/02/04 13:02:57 $
+ Version: $Revision: 1.4 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
<<GetTypeName()<<"]"<<std::endl);
if (clear) mKeyword = s;
else mKeyword += s;
- std::cout<<"keyword [" << mKeyword << "]" << std::endl;
+ mKeyword += ";";
}
//=========================================================================
-
+
//=========================================================================
const BlackBoxDescriptor::InputDescriptor*
BlackBoxDescriptor::GetInputDescriptor(const std::string & name) const
Module: $RCSfile: bbtkFactory.cxx,v $
Language: C++
-Date: $Date: 2008/01/30 12:14:43 $
-Version: $Revision: 1.8 $
+Date: $Date: 2008/02/04 13:02:58 $
+Version: $Revision: 1.9 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
#include <direct.h> // for getcwd
#endif
+#include <cctype> // std::toupper
// was in gdcm ...
/*
<<name<<">");
}
}
+
+
+
+
+ void Factory::CreateHtmlIndex(IndexEntryType type,
+ const std::string& filename)
+ {
+ bbtkDebugMessageInc("Core",9,"Factory::CreateHtmlIndex(\""
+ <<filename<<"\")"<<bbtkendl);
+
+ std::string title;
+
+ typedef std::map<std::string, std::vector<BlackBoxDescriptor*> > IndexType;
+ IndexType index;
+ // Builds the index map
+ PackageMapType::const_iterator i;
+ for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i )
+ {
+ Package* pack = i->second.mPackage;
+ Package::BlackBoxMapType::const_iterator j;
+ for (j = pack->GetBlackBoxMap().begin();
+ j!= pack->GetBlackBoxMap().end();
+ ++j)
+ {
+
+ std::vector<std::string> keys;
+ if (type==Packages)
+ {
+ keys.push_back(pack->GetName());
+ title = "Index by packages";
+ }
+ else if (type==Initials)
+ {
+ std::string init(" ");
+ init[0] = std::toupper(j->second->GetTypeName()[0]);
+ keys.push_back(init);
+ title = "Alphabetical index";
+ }
+ else if (type==Keywords)
+ {
+ // Split the keyword string
+ //std::vector<std::string> keywords;
+ std::string delimiters = ";,";
+ Utilities::SplitString(j->second->GetKeyword(),
+ delimiters,keys);
+ //std::vector<std::string>::iterator si;
+ //for (si=keywords.begin();si!=keywords.end;++si)
+ // {
+ // keys.push_back(*si);
+ // }
+ title = "Index by keywords";
+ }
+
+ std::vector<std::string>::const_iterator k;
+ for (k=keys.begin(); k!=keys.end(); ++k )
+ {
+ IndexType::iterator p;
+ p = index.find(*k);
+ if (p != index.end())
+ {
+ p->second.push_back(j->second);
+ }
+ else
+ {
+ std::vector<BlackBoxDescriptor*> v;
+ v.push_back(j->second);
+ index[*k] = v;
+ }
+ }
+
+ }
+ }
+ // Creates the file
+ //---------------------
+ // Open output file
+ std::ofstream s;
+ s.open(filename.c_str());
+ if (!s.good())
+ {
+ bbtkError("Factory::CreateHtmlIndex : could not open file '"
+ <<filename<<"'");
+ }
+
+ //----------------------
+ // Html head
+ s << "<html lang=\"en\">\n";
+ s << "<head>\n";
+ s << "<title>"<<title<<"</title>\n";
+ s << "<meta http-equiv=\"Content-Type\" content=\"text/html\">\n";
+ s << "<meta name=\"description\" content=\""<<title<<"\">\n";
+ s << "<meta name=\"generator\" content=\"\">\n";
+ s << "<link title=\"Top\" rel=\"top\" href=\"#Top\">\n";
+ //<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
+ s << "<meta http-equiv=\"Content-Style-Type\" content=\"text/css\"><style type=\"text/css\"><!--\n";
+ s << "pre.display { font-family:inherit }\n";
+ s << "pre.format { font-family:inherit }\n";
+ s << "pre.smalldisplay { font-family:inherit; font-size:smaller }\n";
+ s << "pre.smallformat { font-family:inherit; font-size:smaller }\n";
+ s << "pre.smallexample { font-size:smaller }\n";
+ s << "pre.smalllisp { font-size:smaller }\n";
+ s << "span.sc { font-variant:small-caps }\n";
+ s << "span.roman { font-family:serif; font-weight:normal; } \n";
+ s << "span.sansserif { font-family:sans-serif; font-weight:normal; }\n";
+ s << "--></style>\n";
+ s << "</head>\n";
+ //----------------------
+
+ //----------------------
+ // Html body
+ s << "<body>\n";
+ s << "<h1 class=\"settitle\">"<<title<<"</h1>\n";
+
+ IndexType::iterator ii;
+ for (ii=index.begin();ii!=index.end();++ii)
+ {
+ s << "<p><b>"<<ii->first<<"</b>\n";
+ s << "<ul>\n";
+
+ s << "<p><TABLE cellspacing=0 cellpadding=3>\n";
+
+ std::vector<BlackBoxDescriptor*>::iterator di;
+ for (di=ii->second.begin();di!=ii->second.end();++di)
+ {
+ std::string pack = (*di)->GetPackage()->GetName();
+ std::string name = (*di)->GetTypeName();
+ std::string descr = (*di)->GetDescription();
+ s << "<TR>";
+ s << "<TD style='vertical-align: top;'>";
+ s << "<li><a href=\""<<pack
+ <<"/index.html#"<<name<<"\">"
+ <<pack<<"::"<<name<<"</a>";
+ s << "</TD> ";
+ s << " <TD style='vertical-align: top;'>" << descr << " </TD>";
+ s << "</TR>\n";
+ }
+ s << "</TABLE>\n";
+ s << "</li></ul>\n";
+ s << "</div>\n";
+ }
+ //----------------------
+ // Footer
+ time_t rawtime;
+ tm * ptm;
+ time ( &rawtime );
+ ptm = gmtime ( &rawtime );
+
+ s << "<p><hr>\n";
+ s << "Automatically generated by <b>bbi</b> on "
+ << ptm->tm_mday << "/" << ptm->tm_mon << "/" << ptm->tm_year+1900
+ << " - " << ptm->tm_hour << ":" << ptm->tm_min << " GMT\n";
+ s << "</body></html>\n";
+ s.close();
+ //----------------------
+
+ // End
+ bbtkDebugDecTab("Core",9);
+ }
+
}
Program: bbtk
Module: $RCSfile: bbtkFactory.h,v $
Language: C++
- Date: $Date: 2008/01/22 16:55:04 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2008/02/04 13:02:58 $
+ Version: $Revision: 1.3 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See doc/license.txt or
void WriteDotFilePackagesList(FILE *ff);
void Reset();
+
+ typedef enum
+ {
+ Packages,
+ Keywords,
+ Initials
+ }
+ IndexEntryType;
+ void CreateHtmlIndex(IndexEntryType type, const std::string& filename);
private:
Program: bbtk
Module: $RCSfile: bbtkInterpreter.cxx,v $ $
Language: C++
- Date: $Date: 2008/02/01 13:06:29 $
- Version: $Revision: 1.17 $
+ Date: $Date: 2008/02/04 13:02:58 $
+ Version: $Revision: 1.18 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
info.help = "Prints the value of all configuration parameters";
mCommandDict[info.keyword] = info;
+ info.keyword = "index"; // LG
+ info.argmin = 0;
+ info.argmax = 2;
+ info.code = cIndex;
+ info.syntax = "index [<filename> ['Initials'(default)|'Packages'|'Keywords']]";
+ info.help = "Creates an html index of known boxes. If filename is provided then save it to the file 'filename'. The default index entries are the initial letters of the names of the boxes. If 'Packages' or 'Keywords' is provided then the entries are either the package names or the keywords";
+ mCommandDict[info.keyword] = info;
+
info.keyword = "reset"; //EED
info.argmin = 0;
info.argmax = 0;
mExecuter->Author(words[1]);
break;
- case cKeyword :
- mExecuter->Keyword(words[1]);
- break;
-
- case cDescription :
- mExecuter->Description(words[1]);
+ case cKeyword :
+ mExecuter->Keyword(words[1]);
+ break;
+
+ case cIndex :
+ if (words.size()==1)
+ Index("tmp_index.html");
+ else if (words.size()==2)
+ Index(words[1]);
+ else if (words.size()==3)
+ Index(words[1],words[2]);
+ break;
+ case cDescription :
+ mExecuter->Description(words[1]);
break;
case cHelp :
- //=======================================================================
- void SplitString ( const std::string& str, const std::string& delimiters,
- std::vector<std::string>& tokens)
- {
- // Skip delimiters at beginning.
- std::string::size_type lastPos = str.find_first_not_of(delimiters, 0);
- // Find first delimiter.
- std::string::size_type pos = str.find_first_of(delimiters, lastPos);
-
- while (std::string::npos != pos || std::string::npos != lastPos)
- {
- // Found a token, add it to the vector.
- tokens.push_back(str.substr(lastPos, pos - lastPos));
- // Skip delimiters. Note the "not_of"
- lastPos = str.find_first_not_of(delimiters, pos);
- // Find next delimiter
- pos = str.find_first_of(delimiters, lastPos);
- }
-
- }
- //=======================================================================
-
//=======================================================================
std::string delimiters = "\"";
std::vector<std::string> quote;
- SplitString(str,delimiters,quote);
+ Utilities::SplitString(str,delimiters,quote);
delimiters = " \t";
std::vector<std::string>::iterator i;
for (i=quote.begin(); i!=quote.end(); )
{
- SplitString(*i,delimiters,tokens);
+ Utilities::SplitString(*i,delimiters,tokens);
++i;
if (i!=quote.end())
{
bbtkDebugDecTab("Interpreter",9);
}
- //=======================================================================
- void Interpreter::Graph(const std::vector<std::string>& words)
- {
- std::string page;
+//=======================================================================
+void Interpreter::Graph(const std::vector<std::string>& words)
+{
+ std::string page;
bool system_display = true;
#ifdef _USE_WXWIDGETS_
page = mExecuter->ShowGraph(words[1],words[2],words[3],words[4],words[5],"",system_display);
}
else if (words.size()==7)
- {
- page = mExecuter->ShowGraph(words[1],words[2],words[3],words[4],words[5],words[6],system_display);
- }
-
+ {
+ page = mExecuter->ShowGraph(words[1],words[2],words[3],words[4],words[5],words[6],system_display);
+ }
+
#ifdef _USE_WXWIDGETS_
if ( WxConsole::GetInstance() != 0 )
WxConsole::GetInstance()->ShowHtmlPage(page);
#endif
}
- //=======================================================================
+//=======================================================================
+//=======================================================================
+void Interpreter::Index(const std::string& filename,
+ const std::string& type)
+{
+ Factory::IndexEntryType t;
+ if (type=="Initials") t = Factory::Initials;
+ else if (type=="Keywords") t = Factory::Keywords;
+ else if (type=="Packages") t = Factory::Packages;
+
+ GetGlobalFactory()->CreateHtmlIndex(t,filename);
+}
+//=======================================================================
+
}//namespace
Program: bbtk
Module: $RCSfile: bbtkInterpreter.h,v $ $
Language: C++
- Date: $Date: 2008/01/30 09:28:15 $
- Version: $Revision: 1.6 $
+ Date: $Date: 2008/02/04 13:02:58 $
+ 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
cUnload,
cGraph,
cPrint,
+ cIndex,
cWorkspace // LG
} CommandCodeType;
///
void Print(const std::string&);
+ void Index(const std::string& filename,
+ const std::string& type = "Initials");
///
void FindCommandsWithPrefix( char* buf,
int n,
Program: bbtk
Module: $RCSfile: bbtkPackage.h,v $
Language: C++
- Date: $Date: 2008/01/30 09:28:15 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2008/02/04 13:02:58 $
+ Version: $Revision: 1.3 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See doc/license.txt or
/// Changes the name of a black box type
void ChangeBlackBoxName( const std::string& oldname,
const std::string& newname );
+ /// The type of map of descriptors
+ typedef std::map< std::string, BlackBoxDescriptor*> BlackBoxMapType;
+ const BlackBoxMapType& GetBlackBoxMap() const { return mBlackBoxMap; }
+ BlackBoxMapType& GetBlackBoxMap() { return mBlackBoxMap; }
private:
/// The name of the package
std::string mDocRelativeURL;
- /// The type of map of descriptors
- typedef std::map< std::string, BlackBoxDescriptor*> BlackBoxMapType;
/// The map of black boxes descriptors
BlackBoxMapType mBlackBoxMap;
Program: bbtk
Module: $RCSfile: bbtkUtilities.h,v $
Language: C++
- Date: $Date: 2008/01/30 15:29:07 $
- Version: $Revision: 1.9 $
+ Date: $Date: 2008/02/04 13:02:58 $
+ Version: $Revision: 1.10 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See doc/license.txt or
right = "";
}
}
+ //=======================================================================
+ static inline void SplitString ( const std::string& str,
+ const std::string& delimiters,
+ std::vector<std::string>& tokens)
+ {
+ // Skip delimiters at beginning.
+ std::string::size_type lastPos = str.find_first_not_of(delimiters, 0);
+ // Find first delimiter.
+ std::string::size_type pos = str.find_first_of(delimiters, lastPos);
+
+ while (std::string::npos != pos || std::string::npos != lastPos)
+ {
+ // Found a token, add it to the vector.
+ tokens.push_back(str.substr(lastPos, pos - lastPos));
+ // Skip delimiters. Note the "not_of"
+ lastPos = str.find_first_not_of(delimiters, pos);
+ // Find next delimiter
+ pos = str.find_first_of(delimiters, lastPos);
+ }
+
+ }
+ //=======================================================================
+
// ===================================================================================
description "Simple test of wx::Slider widget"
author "laurent.guigues@creatis.insa-lyon.fr"
-#category "test"
+keyword "test;wx"
load wx
new Slider slider
description "Simple test of wx::Split widget"
author "laurent.guigues@creatis.insa-lyon.fr"
+keyword "test;wx"
load wx
Program: bbtk
Module: $RCSfile: bbwxSlider.h,v $
Language: C++
- Date: $Date: 2008/01/28 08:56:02 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2008/02/04 13:02:58 $
+ Version: $Revision: 1.4 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
BBTK_BEGIN_DESCRIBE_BLACK_BOX(Slider,bbtk::WxBlackBox);
BBTK_NAME("Slider");
BBTK_AUTHOR("eduardo.davila@creatis.insa-lyon.fr");
+ BBTK_KEYWORD("wx;widget");
BBTK_DESCRIPTION("Slider widget (wxSlider)");
BBTK_INPUT(Slider,In,"Initial position of the slider (default 0)",int);
BBTK_INPUT(Slider,Min,"Minimum value of the slider (default 0)",int);
Program: bbtk
Module: $RCSfile: bbwxSplit.h,v $
Language: C++
- Date: $Date: 2008/01/28 08:56:02 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2008/02/04 13:02:58 $
+ Version: $Revision: 1.4 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
BBTK_NAME("Split");
BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr");
BBTK_DESCRIPTION("Widget which splits a window in two fixed size parts (wxSplitterWindow)");
+ BBTK_KEYWORD("wx;widget");
BBTK_INPUT(Split,Widget1,"Upper or left widget",wxWindow*);
BBTK_INPUT(Split,Widget2,"Lower or right widget",wxWindow*);
BBTK_INPUT(Split,Orientation,"Orientation (default 0), 0=Horizontal , 1=Vertical",int);