IF(BUILD_BBTK_PACKAGE_${BBTK_PACKAGE_NAME})
#---------------------------------------------------------------------------
+
+ #----------------------------------------------------------------------------
+ # VARS CONFIGURED IN bbPackage.h AND IN doc/bbdoc/header.html.in
+ SET(BBTK_PACKAGE_AUTHOR "${${BBTK_PACKAGE_NAME}_AUTHOR}")
+ SET(BBTK_PACKAGE_DESCRIPTION "${${BBTK_PACKAGE_NAME}_DESCRIPTION}")
+ SET(BBTK_PACKAGE_MAJOR_VERSION ${${BBTK_PACKAGE_NAME}_MAJOR_VERSION})
+ SET(BBTK_PACKAGE_MINOR_VERSION ${${BBTK_PACKAGE_NAME}_MINOR_VERSION})
+ SET(BBTK_PACKAGE_BUILD_VERSION ${${BBTK_PACKAGE_NAME}_BUILD_VERSION})
+ SET(BBTK_PACKAGE_VERSION
+ "\"${${BBTK_PACKAGE_NAME}_MAJOR_VERSION}.${${BBTK_PACKAGE_NAME}_MINOR_VERSION}.${${BBTK_PACKAGE_NAME}_BUILD_VERSION}\"")
+ #----------------------------------------------------------------------------
+
+
#---------------------------------------------------------------------------
# If package deps not in global deps : add them
IF(NOT ${BBTK_PACKAGE_NAME}_IN_DEPS)
INCLUDE_DIRECTORIES(../${${BBTK_PACKAGE_NAME}_INCLUDE_DIRS})
#----------------------------------------------------------------------------
-#----------------------------------------------------------------------------
-# VARS CONFIGURED IN bbPackage.h
-SET(BBTK_PACKAGE_AUTHOR "\"${${BBTK_PACKAGE_NAME}_AUTHOR}\"")
-SET(BBTK_PACKAGE_DESCRIPTION "\"${${BBTK_PACKAGE_NAME}_DESCRIPTION}\"")
-SET(BBTK_PACKAGE_MAJOR_VERSION ${${BBTK_PACKAGE_NAME}_MAJOR_VERSION})
-SET(BBTK_PACKAGE_MINOR_VERSION ${${BBTK_PACKAGE_NAME}_MINOR_VERSION})
-SET(BBTK_PACKAGE_BUILD_VERSION ${${BBTK_PACKAGE_NAME}_BUILD_VERSION})
-SET(BBTK_PACKAGE_VERSION
- "\"${${BBTK_PACKAGE_NAME}_MAJOR_VERSION}.${${BBTK_PACKAGE_NAME}_MINOR_VERSION}.${${BBTK_PACKAGE_NAME}_BUILD_VERSION}\"")
-#----------------------------------------------------------------------------
#----------------------------------------------------------------------------
#include "bb@BBTK_PACKAGE_NAME@Package.h"
BBTK_IMPLEMENT_PACKAGE(@BBTK_PACKAGE_NAME@,
- @BBTK_PACKAGE_AUTHOR@,
- @BBTK_PACKAGE_DESCRIPTION@,
+ "@BBTK_PACKAGE_AUTHOR@",
+ "@BBTK_PACKAGE_DESCRIPTION@",
@BBTK_PACKAGE_VERSION@)
\emph{``any component in a system in which only the input and output
characteristics are of interest, without regard to its internal mechanism
or structure''}.
+I would add something very important to this definition :
+not only the inputs and outputs are of interest but also
+\emph{what the box does} !
+Hence, I would say that a black box is any \emph{\bf documented}
+component of a system, letting know the user
+\emph{\bf what} the box is supposed to do and
+\emph{\bf how to use it}
+but not \emph{\bf how it does it}.
\BBTK provides a systematic framework
to encapsulate (or ``wrap'') any
method allows, say, to set a particular input or
get a particular output of the box.
One can use a black box in a purely abstract way.
-\item{\bf symbolic} means a particular
+\item{\bf symbolic} means that a particular
input or output is referenced by a 'name', that is by a symbol
which identifies the input or output.
It also means that symbolic information (text!) is
\BBTK provides one: \bbi (the Black Box Interpreter).
\item {\bf Automatic documentation} of existing packages.
\texttt{html} documentation of packages is proposed by
-the \bbdoc application.
+\bbi.
\end{itemize}
Finally, these different components allow {\bf efficient}:
\begin{itemize}
-\item {\bf capitalization and reuse} of existing processings,
+\item {\bf capitalization and reuse} of existing processing units,
including {\bf documentation}
\item {\bf testing, prototyping} in a very simple script language
\item {\bf inter-operability} between atomic processings which
\begin{itemize}
\item \bbfy generates the \CPP code of a black box from a
description file written in \texttt{xml}.
-\item \bbdoc generates the html documentation of a black box package
-(author, description, description of its black boxes:
-author, description, inputs, outputs, and so on).
-\item \bbCreatePackage creates a directory on disk which contains the basic files to start the development of a new black box package.
+%\item \bbdoc generates the html documentation of a black box package
+%(author, description, description of its black boxes:
+%author, description, inputs, outputs, and so on).
+\item \bbCreatePackage allows to create the basic file architecture
+to start the development of a new black box package.
\end{itemize}
\end{itemize}
To run the black box interpreter,
open a console and type \texttt{bbi}
or double click on the application icon.
-You get a message and a prompt:
-\begin{verbatim}
-$$ bbi
-BBI (Black Box Interpreter) - bbtk "1.0.0" - (c) Creatis 2007
->
-\end{verbatim}
+You get a window which looks like the one in figure
+\ref{bbi-fig-bbi-gui}
+(the exact appearance of \bbi is system and \bbtk version dependent)
+\footnote{If you compiled \bbtk without \wx then \bbi does not have a
+graphical interface but a simple prompt).
+
+\begin{figure}[!ht]
+\caption{\label{bbi-fig-bbi-gui}The black box interpreter interface}
+\begin{center}
+\includegraphics[width=0.7\textwidth]{bbi-gui.png}
+\end{center}
+\end{figure}
+
+The 'Command' tab is subdivided into two parts :
+one single line zone at the bottom in which you can enter your commands and
+one multiple line zone in which \bbi prints out the result of your commands.
-If you type:
+
+Try typing in the input zone (in this manual,
+the commands entered by the user will be preceded by a prompt '>') :
\begin{verbatim}
> help
\end{verbatim}
\begin{verbatim}
Available commands:
author
+ category
config
connect
define
delete
description
endefine
+ endpackage
exec
graph
help
include
+ index
input
load
message
new
output
+ package
print
quit
reset
Complex Black Box <user::workspace>
User's workspace
By: bbi (internal)
+ Category(s) : complex box;
* No inputs
* No outputs
* No boxes
To load it, type:
\begin{verbatim}
-> load std
+> include std
\end{verbatim}
Then if you type:
\begin{verbatim}
Black Box <std::Add>
Adds its inputs
- By: laurent.guigues@creatis.insa-lyon.fr
+ By: laurent.guigues at creatis.insa-lyon.fr
+ Categories : atomic box;math;
* Inputs:
- 'In1' <double>: First number to add
- 'In2' <double>: Second number to add
- 'ProcessMode' <int> : Set the process mode of the box (0=Pipeline | 1=Always | 2=Reactive)
- * Outputs:
- 'Out' <double>: Result
+ 'BoxExecute' <bbtk::Void> : Any signal received by this input executes the box
+ 'BoxProcessMode' <String> : Sets the processing mode of the box (Pipeline | Always | Reactive)
+ 'In1' <Double> : First number to add
+ 'In2' <Double> : Second number to add
+ * Outputs :
+ 'BoxChange' <bbtk::Void> : Signal modifications of the box
+ 'Out' <Double> : Result'In1' <double>: First number to add
\end{verbatim}
Like previously,
belongs to the \texttt{std} package.
Then comes a description
(the one which was provided by the author of the box),
-the author(s) of the box (usually e-mail adress(es)).
+the author(s) of the box (usually e-mail adress(es)) and
+the categories to which the box belong.
Finally comes the lists of inputs and outputs of the box.
For each input or output, \bbi provides
its \emph{name} (between quotes, e.g. \texttt{'ProcessMode'}),
-its \emph{type} (between \texttt{<>}, e.g. \texttt{<int>})
+its \emph{type} (between \texttt{<>}, e.g. \texttt{<Int>})
and a description.
Remark that the box \texttt{Add} is not a 'complex' black box
but an 'atomic' box, hence its help does not
Complex Black Box <user::workspace>
User's workspace
By: bbi (internal)
+ Category(s) : complex box;
* No inputs
* No outputs
* Boxes:
Box processing is needed if:
\begin{itemize}
\item at least input has changed since last processing or
-\item the input \texttt{'ProcessMode'} of the box is set to
-\texttt{1}, which forces box reprocessing.
+\item the input \texttt{'BoxProcessMode'} of the box is set to
+\texttt{'Always'}, which forces box reprocessing.
\end{itemize}
-Note that all boxes have the input \texttt{'ProcessMode'}.
+Note that all boxes have the input \texttt{'BoxProcessMode'}.
Another way to process the box \texttt{a} is to issue the command:
\begin{verbatim}
\paragraph{Summary}
%\hrule
\begin{itemize}
-\item The \texttt{load} command allows to load a package.
+\item The \texttt{include} command allows to load a package.
\item \texttt{help} gives help on:
\begin{itemize}
\item Available commands if you just type \texttt{help}.
\label{bbi-connecting-black-boxes}
% ==========================================
+LG : THE GUIDE IS UP TO DATE UNTIL HERE
+
\BBTK allows to create
and execute processing chains,
also called \emph{pipelines},
First start \bbi and load the package \texttt{std}:
\begin{verbatim}
-$$ bbi
-BBI (Black Box Interpreter) - bbtk "1.0.0" - (c) Creatis 2007
-> load std
+> include std
\end{verbatim}
Assume you want to compute $1+2+3$. You can do it by
--- /dev/null
+[Desktop Entry]
+Version=1.0
+Encoding=UTF-8
+Name=bbi
+MimeType=text/bbs;
+Exec=BBI -c %f
+Type=Application
+Terminal=false
+NoDisplay=false
+GenericName[en_US]="The Black Box Interpreter (bbi)"
+Icon=HOME/.local/share/applications/bbi-icon.png
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
+
+<mime-type type="text/bbs">
+ <sub-class-of type="text/plain"/>
+ <comment>Black Box Script</comment>
+ <comment xml:lang="en_US">Black Box Script</comment>
+ <glob pattern="*.bbs"/>
+ </mime-type>
+
+</mime-info>
+
--- /dev/null
+#!/bin/bash
+echo "***** Installing bbi on gnome desktop *****"
+
+BBI=$(which bbi)
+echo "* bbi path = ${BBI}"
+
+# The desktop launcher & its icon
+echo "* Creating bbi launcher on desktop (${HOME}/Desktop/bbi.desktop)"
+sed s,HOME,${HOME},g bbi.desktop.in > bbi.desktop.tmp
+sed s,BBI,${BBI},g bbi.desktop.tmp > bbi.desktop.tmp2
+cp bbi.desktop.tmp2 ${HOME}/Desktop
+
+echo "* Copying 'bbi-icon.png' in ${HOME}/.local/share/applications/"
+cp bbi-icon.png ${HOME}/.local/share/applications/
+
+# add the type 'text/bbs' to mime database
+echo "* Adding mime-type 'test/bbs' to mime database (${HOME}/.local/share/mime/packages/bbs.xml)"
+if [ ! -d ${HOME}/.local/share/mime ]
+ then
+ mkdir ${HOME}/.local/share/mime
+ if [ ! -d ${HOME}/.local/share/mime/packages ]
+ then
+ mkdir ${HOME}/.local/share/mime/packages
+ fi
+fi
+cp bbs.xml ${HOME}/.local/share/mime/packages/
+update-mime-database ${HOME}/.local/share/mime
+nautilus --quit
+nautilus &
+
+# associate 'text/bbs' to the desktop launcher
+# add the line 'text/bbs=bbi.desktop'
+# in file ${HOME}/.local/share/applications/defaults.list
+line="text/bbs=bbi.desktop"
+file="${HOME}/.local/share/applications/defaults.list"
+if grep -q ${line} ${file}
+then
+ echo "* Mime-type 'text/bbs' already present in '${file}' : nothing to do"
+else
+ echo "* Associating mime-type 'text/bbs' to 'bbi.desktop' (${file})"
+ echo ${line} | cat >> ${file}
+fi
Module: $RCSfile: bbtkFactory.cxx,v $
Language: C++
-Date: $Date: 2008/02/08 07:39:49 $
-Version: $Revision: 1.17 $
+Date: $Date: 2008/02/12 12:55:16 $
+Version: $Revision: 1.18 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
//===================================================================
//===================================================================
- /// Prints help on the black box of type <name>
- void Factory::HelpBlackBox(const std::string& name, bool full) const
+ /// Prints help on the black box of type <name>
+ /// Returns the package to which it belongs
+ void Factory::HelpBlackBox(const std::string& name,
+ std::string& package,
+ bool full) const
{
bbtkDebugMessageInc("Kernel",9,"Factory::HelpBlackBox(\""<<name<<"\")"
<<std::endl);
if (i->second.mPackage->ContainsBlackBox(name))
{
i->second.mPackage->HelpBlackBox(name,full);
+ package = i->second.mPackage->GetName();
found = true;
}
}
Program: bbtk
Module: $RCSfile: bbtkFactory.h,v $
Language: C++
- Date: $Date: 2008/02/05 11:39:32 $
- Version: $Revision: 1.4 $
+ Date: $Date: 2008/02/12 12:55:16 $
+ Version: $Revision: 1.5 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See doc/license.txt or
void UnLoadPackage( const std::string& name );
void PrintPackages(bool details = true, bool adaptors = false) const;
void HelpPackage(const std::string& name, bool adaptors = false) const;
- void HelpBlackBox(const std::string& name, bool full=true) const;
+ void HelpBlackBox(const std::string& name, std::string& package,
+ bool full=true ) const;
void ShowGraphTypes(const std::string& name) const;
void InsertPackage( Package* );
void RemovePackage( Package* );
inline void HelpBlackBox(const std::string& name, bool full=true)
{
- GetGlobalFactory()->HelpBlackBox(name,full);
+ std::string package;
+ GetGlobalFactory()->HelpBlackBox(name, package, full);
+ }
+
+ inline void HelpBlackBox(const std::string& name, std::string& package,
+ bool full=true
+ )
+ {
+ GetGlobalFactory()->HelpBlackBox(name, package, full);
}
Program: bbtk
Module: $RCSfile: bbtkInterpreter.cxx,v $ $
Language: C++
- Date: $Date: 2008/02/06 10:53:02 $
- Version: $Revision: 1.28 $
+ Date: $Date: 2008/02/12 12:55:16 $
+ Version: $Revision: 1.29 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
try
{
HelpPackage(words[1]);
+#ifdef _USE_WXWIDGETS_
+ if ( WxConsole::GetInstance() != 0 )
+ {
+ std::string url = ConfigurationFile::GetInstance().Get_url();
+ url += "/bbdoc/" + words[1] + "/index.html";
+ if (Utilities::FileExists(url))
+ {
+ WxConsole::GetInstance()->ShowHtmlPage(url);
+ }
+ }
+#endif
}
catch (bbtk::Exception f)
{
try
{
- HelpBlackBox(words[1]);
- }
- catch (bbtk::Exception g)
- {
- try
- {
- this->mExecuter->ShowRelations(words[1],"0","9999");
- }
- catch (bbtk::Exception h){
- bbtkError("\""<<words[1].c_str()
- <<"\" is not a known command, package, black box type or black box name");
- }
- }
+ std::string package;
+ HelpBlackBox(words[1],package);
+#ifdef _USE_WXWIDGETS_
+ if ( WxConsole::GetInstance() != 0 )
+ {
+ std::string url = ConfigurationFile::GetInstance().Get_url();
+ url += "/bbdoc/" + package + "/index.html";
+ if (Utilities::FileExists(url))
+ {
+ url += "#" + words[1];
+ WxConsole::GetInstance()->ShowHtmlPage(url);
+ }
+ }
+#endif
+ }
+ catch (bbtk::Exception g)
+ {
+ try
+ {
+ this->mExecuter->ShowRelations(words[1],"0","9999");
+ }
+ catch (bbtk::Exception h){
+ bbtkError("\""<<words[1].c_str()
+ <<"\" is not a known command, package, black box type or black box name");
+ }
+ }
}
- }
+ }
}
else if (nbarg==2)
{
Program: bbtk
Module: $RCSfile: bbtkInterpreter.h,v $ $
Language: C++
- Date: $Date: 2008/02/06 09:27:52 $
- Version: $Revision: 1.10 $
+ Date: $Date: 2008/02/12 12:55:16 $
+ Version: $Revision: 1.11 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
namespace bbtk
{
+
+
class BBTK_EXPORT Interpreter
{
/// Sets the bool that indicates wether we are in command line context
void SetCommandLine(bool v = true) { mCommandLine = v; }
+
private:
/// Opens the file fullPathScriptName
Program: bbtk
Module: $RCSfile: bbtkPackage.cxx,v $
Language: C++
- Date: $Date: 2008/02/08 07:39:49 $
- Version: $Revision: 1.7 $
+ Date: $Date: 2008/02/12 12:55:16 $
+ Version: $Revision: 1.8 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See doc/license.txt or
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";
#include "bbtkWxBlackBox.h"
#include "bbtkConfigurationFile.h"
+#include "bbtkUtilities.h"
namespace bbtk
{
{
std::string url = ConfigurationFile::GetInstance().Get_url();
url += "/bbtkWebSite/menu.html";
- GoTo(url);
+ if (Utilities::FileExists(url))
+ {
+ GoTo(url);
+ }
+ else
+ {
+ // what ?
+ }
}
//========================================================================
Program: bbtk
Module: $RCSfile: bbtkWxConsole.cxx,v $
Language: C++
- Date: $Date: 2008/02/08 10:05:38 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2008/02/12 12:55:16 $
+ 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
// Command page
mwxTextHistory =
- new wxTextCtrl(mwxPageCommand,0,_T(""),wxDefaultPosition,
+ new wxTextCtrl(mwxPageCommand,
+ ID_Text_History,
+ _T(""),wxDefaultPosition,
wxDefaultSize, //HistorySize,
wxTE_READONLY |
wxTE_MULTILINE );
mwxTextHistoryAttr = new wxTextAttr;
mwxTextHistoryAttr->SetFont(*FixedFont);
mwxTextCommand =
- new wxTextCtrl(mwxPageCommand,0,_T(""),wxDefaultPosition,
- wxDefaultSize,//CommandSize,
-
+ new wxTextCtrl(mwxPageCommand,
+ ID_Text_Command,
+ _T(""),wxDefaultPosition,
+ wxDefaultSize,
wxTE_PROCESS_ENTER
- |
- wxTE_PROCESS_TAB | wxWANTS_CHARS
-// | wxTAB_TRAVERSAL
+ | wxTE_PROCESS_TAB
+ | wxWANTS_CHARS
+ //| wxTAB_TRAVERSAL
);
// Events connection
// COMMAND
// ENTER
+ /*
Connect( mwxTextCommand->GetId(),
wxEVT_COMMAND_TEXT_ENTER,
(wxObjectEventFunction)& WxConsole::OnCommandEnter );
wxEVT_CHAR,
//wxEVT_COMMAND_TEXT_UPDATED,
(wxObjectEventFunction)& WxConsole::OnCommandChar );
+ */
// MENU
// Connect (
void WxConsole::ShowHtmlPage(std::string& page)
{
// std::cout << "WxConsole::ShowHtmlPage('"<<page<<"')"<<std::endl;
- if (!mwxHtmlWindow->GoTo(page))
+ if (mwxHtmlWindow->GoTo(page))
+ {
+ mwxNotebook->ChangeSelection(1);
+ }
+ else
{
// std::cout << "ERROR html"<<std::endl;
}
BEGIN_EVENT_TABLE(WxConsole, wxFrame)
EVT_MENU(WxConsole::ID_Menu_Quit, WxConsole::OnMenuQuit)
EVT_MENU(WxConsole::ID_Menu_About, WxConsole::OnMenuAbout)
+ EVT_TEXT_ENTER(WxConsole::ID_Text_Command, WxConsole::OnCommandEnter)
+ // EVT_CHAR(WxConsole::ID_Text_Command, WxConsole::OnCommandChar)
END_EVENT_TABLE()
//================================================================
Program: bbtk
Module: $RCSfile: bbtkWxConsole.h,v $
Language: C++
- Date: $Date: 2008/02/05 08:25:23 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2008/02/12 12:55:16 $
+ 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
{
ID_Menu_Quit = 1,
ID_Menu_About,
+ ID_Text_Command,
+ ID_Text_History,
+
};
DECLARE_EVENT_TABLE()