]> Creatis software - bbtk.git/blob - kernel/doc/bbtkUsersGuide/bbtkUsersGuide.tex
4d86c3f9353fac37b734b1079b969ef210690132
[bbtk.git] / kernel / doc / bbtkUsersGuide / bbtkUsersGuide.tex
1 % ==========================================
2 \documentclass[11pt,final,a4paper]{article}
3 \input{config.tex}
4 \begin{document}
5 \title{The Black Box Toolkit\\User's Guide}
6 \date{\today}
7 \author{Laurent Guigues}
8 \maketitle
9 % ==========================================
10 \tableofcontents
11 % ==========================================
12
13
14 % ==========================================
15 %\section*{Abstract}
16 % ==========================================
17 \newpage
18 % ==========================================
19 \hrule
20 \section{What is {\bf bbtk} ?}
21 % ==========================================
22 \BBTK(\bbtkns) is a set of tools 
23 (\CPP libraries and executables) 
24 providing a \CPP framework for the definition 
25 of elementary processing \emph{units}, called {\bf black boxes}, 
26 and the definition and execution of processing \emph{chains} 
27 made up of these black boxes. 
28
29 % ==========================================
30 \subsection{The black box philosophy}
31 % ==========================================
32 \href{http://en.wikipedia.org/wiki/Black_box_\%28disambiguation\%29}{Wikipedia}
33 defines a {\bf black box} as 
34 \emph{``any component in a system in which only the input and output 
35 characteristics are of interest, without regard to its internal mechanism 
36 or structure''}. 
37 I would add something very important to this definition : 
38 not only the inputs and outputs are of interest but also 
39 \emph{what the box does} !
40 Hence, I would say that a black box is any \emph{\bf documented} 
41 component of a system, letting know the user 
42 \emph{\bf what} the box is supposed to do and 
43 \emph{\bf how to use it}
44 but not \emph{\bf how it does it}.
45
46 \BBTK provides a systematic framework 
47 to encapsulate (or ``wrap'') any 
48 existing \texttt{C} or \CPP processing code into an object 
49 (a black box) having a {\bf generic symbolic interface}, where 
50
51 \begin{itemize}
52 \item{\bf generic} means that the interface is \emph{the same} 
53 for all boxes. Hence one does not need to know which particular 
54 method allows, say, to set a particular input or 
55 get a particular output of the box. 
56 One can use a black box in a purely abstract way. 
57 \item{\bf symbolic} means that a particular 
58 input or output is referenced by a 'name', that is by a symbol 
59 which identifies the input or output. 
60 It also means that symbolic information (text!) is 
61 attached to a box: description of the box, author, 
62 description of its inputs and outputs, etc.
63 \end{itemize}
64
65 (in fact, genericity is achieved because the interface is symbolic. 
66 I let you think about this\dots)
67
68 Of course, symbolic data attached to box can be 
69 {\bf queried}: what are the inputs/outputs of the box ? 
70 what are their type ? description ? etc.
71 This allows {\bf automatic documentation} of boxes. 
72
73 The abstract definition of black boxes is the most basic 
74 aspect of \BBTK architecture. 
75 Another key aspect is the groupement of black boxes into 
76 so called {\bf packages}, 
77 which are \emph{dynamic libraries} which can also 
78 be queried, in particular about the boxes they provide. 
79 The package structure then offers a mechanism which 
80 is like a \emph{'plug-in'} mechanism.
81 \BBTK provides the methods to load a package at run-time, 
82 and create instances of the boxes it contains. 
83
84 These two mechanisms (black boxes and packages) 
85 then gives the way to:
86
87 \begin{itemize}
88 \item The definition of an {\bf interpreted language}, 
89 which allows to manipulate packages and boxes very easily in symbolic way. 
90 \BBTK provides one: \bbi (the Black Box Interpreter). 
91 \item {\bf Automatic documentation} of existing packages. 
92 \texttt{html} documentation of packages is proposed by 
93 \bbi.
94 \end{itemize}
95
96 Finally, these different components allow {\bf efficient}:
97
98 \begin{itemize}
99 \item {\bf capitalization and reuse} of existing processing units, 
100 including {\bf documentation} 
101 \item {\bf testing, prototyping} in a very simple script language
102 \item {\bf inter-operability} between atomic processings which 
103 have been written by different persons, using different libraries, etc. 
104 \end{itemize}
105
106 % ==========================================
107 \subsection{\bbtk components}
108 % ==========================================
109 \BBTK includes:
110 \begin{itemize}
111 \item A \CPP {\bf\emph{library}} - called \bbtk - which defines a framework 
112 (abstract classes) to develop black boxes and to store them into 
113 dynamic libraries, called black box \emph{packages}.
114 \item Different {\bf\emph{black box packages}}:
115 \begin{itemize}
116 \item {\bf\emph{std}}: the 'standard' package including basic useful boxes.
117 \item {\bf\emph{wx}}: basic graphical interface elements (widgets: sliders, buttons, etc. based on the \texttt{wxWidgets} library).  
118 \item {\bf\emph{itk}}: the basic image processing package, based on the \texttt{itk} library.
119 \item {\bf\emph{vtk}}: the basic image and surfaces processing package, based on the \texttt{vtk} library.
120 \item {\bf\emph{wxvtk}}: widget boxes based on the \texttt{vtk} library.
121 \item {\bf\emph{itkvtk}}: boxes to convert \texttt{itk} structures into \texttt{vtk} structures and conversally. 
122 \end{itemize}
123 \item An {\bf\emph{interpreter}}, called \bbi, which allows to 
124 load black box packages and to define and execute 
125 processing chains by connecting various black boxes of the already loaded packages.
126 \item {\bf\emph{Utilities}}:
127 \begin{itemize}
128 \item \bbfy generates the \CPP code of a black box from a 
129 description file written in \texttt{xml}.
130 %\item \bbdoc generates the html documentation of a black box package 
131 %(author, description, description of its black boxes: 
132 %author, description, inputs, outputs, and so on).
133 \item \bbCreatePackage allows to create the basic file architecture 
134 to start the development of a new black box package.
135 \end{itemize} 
136 \end{itemize}
137
138 The general architecture of \BBTK 
139 is shown in figure \ref{bb-architecture}.
140
141 \begin{figure}[!ht]
142 \caption{\label{bb-architecture}\BBTK architecture}
143 \begin{center}
144 \includegraphics[width=0.6\textwidth]{bb-architecture.png}
145 \end{center}
146 \end{figure}
147
148 % ==========================================
149 \subsection{Structure of this guide}
150 % ==========================================
151
152 This guide is divided into two parts. 
153
154 The first part (\ref{bbi}) 
155 is devoted to the use of the \emph{black box interpreter} \bbi. 
156 This is the highest level of use of the toolkit, which 
157 allows to create and execute processing chains by connecting 
158 black boxes of existing packages. 
159
160 The second part (\ref{cpp}) explains how to 
161 use the black box toolkit framework in \CPP code, 
162 typically to develop large applications which 
163 involve complex graphical interfaces.
164  
165
166 % ==========================================
167 % ==========================================
168 % ==========================================
169 % ==========================================
170 % ==========================================
171 % ==========================================
172 \vspace{0.5cm}\hrule
173 \section{The black box interpreter (bbi)}
174 \label{bbi}
175 % ==========================================
176
177 % ==========================================
178 %\subsection{Structure of this part}
179 % ==========================================
180
181 Using the black box interpreter is very simple. 
182 Everything is done with only a few commands.
183 The philosophy of this part is also very simple: 
184 it introduces the \bbi commands using examples, 
185 starting with the most simple commands.  
186 The first section of this part 
187 (\ref{bbi-getting-started})
188 is designed like a tutorial, 
189 which progressively introduces all the concepts of \bbi. 
190 We suggest you run \bbi and follow the examples, 
191 to see how it works in practice. 
192 At the end of this section, 
193 you will be able to use \bbi and write 
194 own black box processing scripts. 
195
196 After this tutorial, 
197 the section \ref{bbi-more-on} 
198 (called \emph{more on...}) 
199 goes deeper into various issues of \bbi. 
200 Read it at your convenience, 
201 either linearly to learn more about \bbi, 
202 or in random order to get an answer 
203 to a particular question. 
204
205 Finally, the section \ref{bbi-reference}
206 summarizes all the commands of \bbi, 
207 their parameters and effect. 
208 Use it as a reference.
209
210 % ==========================================
211 \subsection{Getting started}
212 \label{bbi-getting-started}
213 % ==========================================
214 \subsubsection{Creating and executing black boxes}
215 % ==========================================
216
217 To run the black box interpreter, 
218 open a console and type \texttt{bbi} 
219 or double click on the application icon.
220 You get a window which looks like the one in figure 
221 \ref{bbi-fig-bbi-gui} 
222 (the exact appearance of \bbi is system and \bbtk version dependent)
223 \footnote{If you compiled \bbtk without \wx then \bbi does not have a 
224 graphical interface but a simple prompt}.
225
226 \begin{figure}[!ht]
227 \caption{\label{bbi-fig-bbi-gui}The black box interpreter interface}
228 \begin{center}
229 \includegraphics[width=0.7\textwidth]{bbi-gui.png}
230 \end{center}
231 \end{figure}
232
233 The 'Command' tab is subdivided into two parts : 
234 one single line zone at the bottom in which you can enter your commands and 
235 one multiple line zone in which \bbi prints out the result of your commands.
236
237
238 Try typing in the input zone (in this manual, 
239 the commands entered by the user will be preceded by a prompt '>') :
240 \begin{verbatim}
241 > help 
242 \end{verbatim}
243
244 you get the list of the commands of the interpreter:
245 \begin{verbatim}
246 Available commands:
247  author
248  category
249  config
250  connect
251  define
252  delete
253  description
254  endefine
255  endpackage
256  exec
257  graph
258  help
259  include
260  index
261  input
262  load
263  message
264  new
265  output
266  package
267  print
268  quit
269  reset
270  set
271  unload
272 \end{verbatim}
273
274 To get help on a particular command type \texttt{help <command-name>},
275 for example:
276 \begin{verbatim}
277 > help quit
278 \end{verbatim}
279
280 gives:
281 \begin{verbatim}
282  quit: 
283    usage: quit
284     Quits the program (during script execution it stops the complete execution)
285 \end{verbatim}
286
287 The \texttt{help} command has multiple usages. 
288 It is used to get help on almost anything in \bbi !
289 Type \texttt{'help help'} to get help on the \texttt{help} command itself:
290 \begin{verbatim}
291 > help help
292  usage: 
293          (1) help 
294          (2) help <command name> 
295          (3) help packages [all]
296          (4) help <package name> [all]
297          (5) help <black box type> 
298          (6) help <black box name>
299   Effect:
300          (1) Lists all available commands;
301          (2) Prints help on a particular command; 
302          (3) Lists the packages loaded and their black boxes.
303              Add 'all' to list adaptors; 
304          (4) Prints short help on the black boxes of a package.
305              Add 'all' to include adaptors; 
306          (5) Prints full help on a black box type; 
307          (6) Prints information on the inputs, outputs and connections of a black box instance.
308 \end{verbatim}
309
310 At start \bbi does not know any black box. 
311 If you type \texttt{'help packages'}, which is 
312 the third form of the \texttt{help} command, you get:
313 \begin{verbatim}
314 > help packages
315 user
316   workspace
317 \end{verbatim}
318
319 which means that \bbi only knows one package 
320 (library of black boxes) called \texttt{user}
321 and which contains a black box called \texttt{workspace}.
322 The \texttt{user} package is an internal package to \bbi, 
323 which stores user-defined black box types. 
324 At start, it already contains 
325 one box, called \texttt{workspace}.
326 \texttt{workspace} is a special type of black box, 
327 called complex black box, whose purpose is 
328 to store other black boxes. 
329 Any black box you create in \bbi is stored 
330 in \texttt{workspace}  
331 (this will be explained in details in sections 
332 \ref{bbi-writing-scripts} and 
333 \ref{bbi-more-on-complex-black-boxes}). 
334
335 If you type \texttt{'help workspace'}, you get:
336 \begin{verbatim}
337 > help workspace
338 Complex Black Box <user::workspace>
339  User's workspace
340  By: bbi (internal)
341  Category(s) : complex box;
342  * No inputs
343  * No outputs
344  * No boxes
345 \end{verbatim}
346
347 In the text displayed, 
348 the \texttt{user::} prepended to the name \texttt{workspace} 
349 means that the box \texttt{workspace} 
350 belongs to the \texttt{user} package. 
351 Then comes a description and three lines which 
352 tell that \texttt{workspace} does not have any input 
353 nor output nor boxes yet.
354
355 In order to let \bbi know of some black boxes, 
356 you must load another package. 
357 The \texttt{std} package is the ``standard'' package, 
358 which contains basic useful black boxes. 
359
360 To load it, type:
361 \begin{verbatim}
362 > include std
363 \end{verbatim}
364
365 Then if you type:
366 \begin{verbatim}
367 > help packages
368 \end{verbatim}
369
370 you get something like:
371 \begin{verbatim}
372 std
373   Add 
374   ... 
375 user
376   workspace
377
378 \end{verbatim}
379
380 Now \bbi knows the package \texttt{std} and the black boxes it provides,
381 such as the \texttt{'Add'} box. Remark that the 
382 content of \texttt{std} may vary from one version to another 
383 as new black boxes might be added to it. 
384 If you type:  
385 \begin{verbatim}
386 > help Add
387 \end{verbatim}
388
389 You get:
390 \begin{verbatim}
391 Black Box <std::Add>
392  Adds its inputs
393  By: laurent.guigues at creatis.insa-lyon.fr
394  Categories : atomic box;math;
395  * Inputs: 
396     'BoxExecute'     <bbtk::Void> : Any signal received by this input executes the box
397     'BoxProcessMode' <String>     : Sets the processing mode of the box (Pipeline | Always | Reactive)
398     'In1'            <Double>     : First number to add
399     'In2'            <Double>     : Second number to add
400   * Outputs : 
401     'BoxChange'      <bbtk::Void> : Signal modifications of the box
402     'Out'            <Double>     : Result'In1'         <double>: First number to add
403 \end{verbatim}
404
405 Like previously, 
406 the \texttt{std::} prepended to the name \texttt{Add} 
407 means that the box \texttt{Add} 
408 belongs to the \texttt{std} package. 
409 Then comes a description 
410 (the one which was provided by the author of the box), 
411 the author(s) of the box (usually e-mail adress(es)) and 
412 the categories to which the box belong. 
413 Finally comes the lists of inputs and outputs of the box.
414 For each input or output, \bbi provides 
415 its \emph{name} (between quotes, e.g. \texttt{'ProcessMode'}), 
416 its \emph{type} (between \texttt{<>}, e.g. \texttt{<Int>})
417 and a description.    
418 Remark that the box \texttt{Add} is not a 'complex' black box 
419 but an 'atomic' box, hence its help does not 
420 mention any information concerning possible internal boxes.
421
422 You can create an \emph{instance} of an \texttt{Add} box by 
423 the command \texttt{new}:
424 \begin{verbatim}
425 > new Add a
426 \end{verbatim}
427
428 The \texttt{'a'} at the end is the \emph{name} of the instance, 
429 which will be used to reference it later. 
430 It is important to make the difference between box \emph{types} 
431 and \emph{instances} of box types. 
432 The \texttt{Add} box of the package \texttt{std} is in fact 
433 a \emph{type} of box, like \texttt{int} is a type of data 
434 in \texttt{C} langage. The \texttt{new} command allows to create 
435 an instance of a box type, exactly like \texttt{int i;} in 
436 a \texttt{C} code declares a variable of type \texttt{int} whose 
437 name is \texttt{i}. 
438 Of course, like in \texttt{C} Language, you can declare multiple boxes of the 
439 same type in \bbi. 
440
441 After the creation of the box \texttt{a}, type:
442 \begin{verbatim}
443 > help workspace
444 \end{verbatim}
445
446 you get:
447 \begin{verbatim}
448 Complex Black Box <user::workspace>
449  User's workspace
450  By: bbi (internal)
451  Category(s) : complex box;
452  * No inputs
453  * No outputs
454  * Boxes: 
455     'a' <std::Add>
456 \end{verbatim}
457
458 which means that \bbi's workspace now contains a black box 
459 of type \texttt{std::Add} and name \texttt{a}.
460
461 Now look back at the help on \texttt{Add} boxes: 
462 you can see that this type of box has two inputs, 
463 with name \texttt{In1} and \texttt{In2},
464 and an output, with name \texttt{Out}.
465
466 You can set the input \texttt{In1} 
467 of the \texttt{Add} box \texttt{a} to the value $1$ 
468 by the command:
469 \begin{verbatim}
470 > set a.In1 1 
471 \end{verbatim}
472
473 Similarly, setting the input \texttt{In2} of \texttt{a} to the value $2$
474 is done with:
475 \begin{verbatim}
476 > set a.In2 2
477 \end{verbatim}
478  
479 And you print the output \texttt{Out} of the box \texttt{a} with:
480 \begin{verbatim}
481 > print "result=$a.Out$"
482 result=3
483 \end{verbatim}
484
485 In the string passed to the \texttt{print} command, 
486 each substring enclosed between a couple of \$ is considered 
487 as the name of an output of a box. 
488 To process this special substrings, \bbi does:
489 \begin{enumerate}
490 \item Processes the box if needed (see below)
491 \item Converts the output of the box to a string if possible 
492 (see below)
493 \item Substitutes the result in the string to print
494 \end{enumerate}
495
496 Box processing is needed if:
497 \begin{itemize}
498 \item at least input has changed since last processing or
499 \item the input \texttt{'BoxProcessMode'} of the box is set to 
500 \texttt{'Always'}, which forces box reprocessing. 
501 \end{itemize}
502
503 Note that all boxes have the input \texttt{'BoxProcessMode'}. 
504
505 Another way to process the box \texttt{a} is to issue the command:
506 \begin{verbatim}
507 > exec a
508 \end{verbatim}
509
510 however this command does not display anything (except if the 
511 box itself displays something in its processing).
512 It just processes the box if needed. 
513 This command is used to execute boxes that do not have any output,  
514 such as boxes that write something to a file or, display a 
515 graphical interface, and so on. 
516
517 To exit \bbi, type:
518 \begin{verbatim}
519 > quit
520 Good bye !
521 \end{verbatim}
522
523 % ==========================================
524 \hrule
525 \paragraph{Summary}
526 %\hrule
527 \begin{itemize}
528 \item The \texttt{include} command allows to load a package.
529 \item \texttt{help} gives help on:
530 \begin{itemize} 
531 \item Available commands if you just type \texttt{help}.
532 \item A particular command if you type \texttt{help <command-name>}.
533 \item All available packages and their boxes (without description) if you type \texttt{help packages}.
534 \item A particular package and its boxes (with brief description) if you type \texttt{help <package-name>}.
535 \item A particular black box type (with full description) if you type \texttt{help <box-type-name>}. In particular, \texttt{help workspace} displays information on the content of the \texttt{'workspace'} black box, which stores the boxes created by the user (by \texttt{new}).
536 \end{itemize}
537 %\item \texttt{list} displays the list of black box instances created so far (by \texttt{new}).
538 \item \texttt{new} creates an instance of a black box. 
539 \item \texttt{set} sets the value of an input of a black box. 
540 \item In all \bbi, to reference the input called \texttt{i} 
541 of a black box called \texttt{b} you must type \texttt{'b.i'}. 
542 The same syntax holds for outputs.
543 \item \texttt{print} prints a string, substituting each substring of the form \$b.o\$ by the value of the output \texttt{o} of the black box \texttt{b}. 
544 \item \texttt{exec} runs the process of a box if needed. 
545 \item \texttt{quit} quits \bbi.
546 \end{itemize}
547 \hrule
548 % ==========================================
549
550 % ==========================================
551 \subsubsection{Connecting black boxes}
552 \label{bbi-connecting-black-boxes}
553 % ==========================================
554
555 LG : THE GUIDE IS UP TO DATE UNTIL HERE
556
557 \BBTK allows to create 
558 and execute processing chains, 
559 also called \emph{pipelines}, 
560 by connecting black boxes.
561 This section explains how to do it with examples. 
562 Read section \ref{bbi-more-on-pipeline-processing} to get 
563 more information on pipeline processing.
564
565 First start \bbi and load the package \texttt{std}:
566 \begin{verbatim}
567 > include std
568 \end{verbatim}
569
570 Assume you want to compute $1+2+3$. You can do it by 
571 chaining two \texttt{Add} boxes, as shown in figure 
572 \ref{bbi-fig-connecting-black-boxes-1}. 
573
574 \begin{figure}[!ht]
575 \caption{\label{bbi-fig-connecting-black-boxes-1}
576 A simple pipeline which adds 3 numbers}
577 \begin{center}
578 \includegraphics[width=0.5\textwidth]{1plus2plus3.png}
579 \end{center}
580 \end{figure}
581
582 The \bbi instructions to create and execute this pipeline are:
583 \begin{verbatim}
584 > new Add a
585 > new Add b
586 > connect a.Out b.In1
587 > set a.In1 1
588 > set a.In2 2
589 > set b.In2 3
590 > print $b.Out$
591 6
592 \end{verbatim}
593
594 The first three commands build the pipeline, 
595 the next three set its inputs and the last one 
596 executes it and prints its output.
597  
598 The command \texttt{'connect a.Out b.In1'} ``plugs'' the output 
599 \texttt{Out} of the box \texttt{a} into the input \texttt{In1} of the 
600 box \texttt{b}. 
601 Once the boxes connected, the processing of the two boxes are chained:
602 getting the output of \texttt{b} requires getting its inputs, 
603 hence getting the output of \texttt{a} which is connected to it. 
604 This pipeline mechanism can recurse into arbitrary long 
605 chains of boxes (see \ref{bbi-more-on-pipeline-processing} 
606 for details).
607
608 Of course, to be able to connect two boxes, 
609 the output and the input must be compatibles. 
610 You can always connect an output to an input of the \emph{same} type, 
611 but you can do more, thanks to particular black boxes called {\bf adaptors}.
612
613 An adaptor is a black box which has at least one input, called \texttt{In}, 
614 and at least one ouput called \texttt{Out} and whose role is to convert 
615 a data of the type of \texttt{In} 
616 into a data of the type of \texttt{Out} (other inputs or outputs may serve 
617 to parameter the adaptor or retreive other usefull information).
618
619 In \bbi, if you type:
620 \begin{verbatim}
621 > load std
622 > help std all
623 \end{verbatim}
624 you get:
625 \begin{verbatim}
626  Package std v1.0.0 - laurent.guigues@creatis.insa-lyon.fr
627  Basic useful black boxes
628  Black boxes: 
629    Add                                    : Adds its inputs
630    Cast<double,float>                [DA] : Casts a double into a float
631    Cast<double,int>                  [DA] : Casts a double into a int
632     ... 
633    Convert<unsigned int,string>      [DA] : Converts a unsigned int into a s...
634    Convert<unsigned short,string>    [DA] : Converts a unsigned short into a...
635    Print                                  : Prints its input to standard out...
636 >
637 \end{verbatim}
638
639 The \texttt{Cast<?,?>} and \texttt{Convert<?,?>} boxes are \emph{default adaptors}, which is signaled by the tag \texttt{[DA]} before their descriptions.
640
641 Once you have loaded the package \texttt{std}, you can 
642 plug an output of type \texttt{char} into an input of type \texttt{double}. 
643 When \bbi encounters the \texttt{connect} command, 
644 it looks for an adequate \emph{adaptor} in the  loaded packages. 
645 In our case, as the package \texttt{std} provides the 
646 \texttt{Cast<char,double>} adaptor, \bbi automatically creates an 
647 instance of this adaptor and place it \emph{between} 
648 the output and the input you want to connect 
649 (however this adaptor is hidden to you, 
650 it is embedded into the created connection and does not appear 
651 as an existing black box). 
652 When the pipeline is processed the 
653 adaptor converts the output data into the required input type, 
654 in a totally transparent way.
655 In our example, the \texttt{Cast<char,double>} adaptor 
656 would simply cast the value of the \texttt{char} into a \texttt{double}, 
657 however arbitrarily complex type conversion can be done.
658
659 Question: 
660 if two adaptors with the same input and output types exist 
661 in the packages loaded, 
662 which one is chosen by \bbi at connection ? 
663 -> Role of default adaptors
664
665 Note that the \texttt{set} and \texttt{print} commands of \bbi 
666 work with adaptors from \texttt{string} to the type of the input to set 
667 or from the type of the output to print to \texttt{string}. 
668 Hence in order to \texttt{set} or \texttt{print} values the adequate 
669 adaptors must be available in the packages currently loaded.
670  
671 % ==========================================
672 \hrule
673 \paragraph{Summary}
674 %\hrule
675 \begin{itemize}
676 \item The \texttt{connect} command allows to connect two black boxes
677 \item You can connect two black boxes if (and only if): 
678 \begin{itemize}
679 \item The output and the input are of the same type, or
680 \item There is an adaptor black box in the packages loaded which 
681 converts data of the output type into data of the input type
682 \end{itemize}
683 \item \texttt{help <package name>} does not display the adaptors of the package. To see them use: \texttt{help <package name> all}.
684 including adaptors
685 \end{itemize}
686 \hrule
687 % ==========================================
688
689 % ==========================================
690 \subsubsection{Creating complex black boxes}
691 \label{bbi-complex-black-boxes}
692 % ==========================================
693
694 Remember the pipeline of figure 
695 \ref{bbi-fig-connecting-black-boxes-1}, which 
696 computed the sum of three doubles ?
697 You can view it as a whole and define 
698 a new black box type, which will be a \emph{complex black box}, 
699 having three inputs and one output, 
700 as shown in figure \ref{bbi-fig-complex-black-box-1}.
701
702 \begin{figure}[!ht]
703 \caption{\label{bbi-fig-complex-black-box-1}
704 Creating the complex black box \texttt{Add3}}
705 \begin{center}
706 \includegraphics[width=0.5\textwidth]{Add3.png}
707 \end{center}
708 \end{figure}
709
710 The \bbi commands to define this complex black box are 
711 the following:
712
713 \begin{verbatim}
714 > load std
715 >
716 > define Add3
717 >
718 > new Add a
719 > new Add b
720 > connect a.Out b.In1
721 >
722 > author "myself"
723 > description "adds 3 doubles"
724 > input x a.In1 "first double to add"
725 > input y a.In2 "second double to add"
726 > input z b.In2 "third double to add"
727 > output result b.Out "output"
728 >
729 > endefine
730 \end{verbatim}
731
732 Explainations:
733
734 As we will use \texttt{Add} boxes, we need to load the package \texttt{std}, which is done in first line.
735
736 The command \texttt{define} then starts the definition 
737 of the complex box type, which will be called \texttt{Add3}. 
738
739 The next three lines define the pipeline, 
740 exactly in the same way than outside a complex box definition. 
741
742 The commands \texttt{author}, \texttt{description}, \texttt{input} 
743 and \texttt{output} are commands specific to complex boxes definition:
744
745 \texttt{author} and \texttt{description} are used for the documentation 
746 of the new box. You can provide multiple \texttt{author} or 
747 \texttt{description} commands, the arguments of the commands will 
748 be concatenated to produce the final author and description strings.
749
750 \texttt{input} and \texttt{output} are used to define the inputs and outputs 
751 of the new complex box. 
752 Their syntax is the same: for each new input/output you need to say 
753 to which internal input/output it corresponds and to provide 
754 a help string documenting the input/output.
755 In our example, we define that the box \texttt{Add3} has 
756 three inputs: \texttt{x}, \texttt{y} and \texttt{z}. 
757 The input \texttt{x} corresponds to the input \texttt{In1} of the 
758 internal box \texttt{a}. 
759 In the same way, the external input \texttt{y} 
760 corresponds to the internal input \texttt{a.In2}, and 
761 the external input \texttt{In3} to \texttt{b.In2}. 
762 The only output of the new box is called \texttt{result}
763 and corresponds to \texttt{b.Out}. 
764 The figure \ref{bbi-fig-complex-black-box-1} 
765 illustrates the external to internal 
766 input/output correspondence.
767
768 Finally, the \texttt{endefine} command ends the definition of the 
769 new box type.
770
771 After this definition, if you ask for help 
772 on packages, you get:
773 \begin{verbatim}
774 > help packages
775 std
776   Add
777   ...
778 user
779   Add3
780   workspace
781 \end{verbatim}
782
783 The \texttt{user} package now contains a new black box type, called 
784 \texttt{Add3}. If you ask for help on this type of box, you get:
785 \begin{verbatim}
786 > help Add3
787 Complex Black Box <user::Add3>
788  adds 3 doubles
789  By: myself
790  * Inputs: 
791     'x'      <double>: first double to add
792     'y'      <double>: second double to add
793     'z'      <double>: third double to add
794  * Outputs: 
795     'result' <double>: output
796  * Boxes: 
797     'a' <std::Add>
798     'b' <std::Add>
799 \end{verbatim}
800
801 and you can use it like any other box, for example type:
802
803 \begin{verbatim}
804 > new Add3 a
805 > set a.x 1
806 > set a.y 2
807 > set a.z 3
808 > print $a.result$
809 6
810 \end{verbatim}
811
812
813 % ==========================================
814 \hrule
815 \paragraph{Summary}
816 %\hrule
817 \begin{itemize}
818 \item The \texttt{define/endefine} commands allows to define complex black box types, i.e. types of black boxes made up of other black boxes. 
819 Inside a \texttt{define/endefine} block:
820 \begin{itemize}
821 \item The \texttt{author} and \texttt{description} commands allow to document the new type of box
822 \item The \texttt{input} and \texttt{output} commands allow to define the inputs and outputs of the new type of box, that is to which inputs and outputs 
823 of internal boxes they correspond.  
824 \end{itemize}
825 \end{itemize}
826 \hrule
827 % ==========================================
828
829 % ==========================================
830 \subsubsection{Writing scripts}
831 \label{bbi-writing-scripts}
832 % ==========================================
833
834 Once you have defined a new type of complex box, you 
835 may like to reuse it. To do this, you can simply 
836 write the \bbi commands defining the new box 
837 into a text file and afterwards include that file in \bbi. 
838 Doing this, you start writing \bbi scripts.
839 The conventionnal extension for such scripts is \texttt{bbs} 
840 (black box script).
841
842 For example, the \texttt{Add3} complex box we previously worked on 
843 can be defined in the \texttt{Add3.bbs} file:
844
845 \begin{file}{Add3.bbs}
846 \begin{verbatim}
847 # Defines the Add3 black box which adds 3 doubles 
848 load std
849
850 define Add3
851   # I am the author 
852   author "myself"
853   description "adds 3 doubles"
854   # Pipeline creation
855   new Add a
856   new Add b
857   connect a.Out b.In1
858   # Inputs definition
859   input x a.In1 "first double to add
860   input y a.In2 "second double to add
861   input z b.In2 "third double to add"
862   # Output definition
863   output result b.Out "output"
864 endefine
865 \end{verbatim}
866 \end{file}
867
868 Lines starting with a \texttt{\#} character are ignored, they 
869 are considered as comments by \bbi.
870 To use this file in \bbi, use the \texttt{include} command:
871
872 \begin{verbatim}
873 > include Add3.bbs
874 > help Add3
875 Complex Black Box <user::Add3>
876  adds 3 doubles
877  By: myself
878  * Inputs: 
879     'x'      <double>: first double to add
880     'y'      <double>: second double to add
881     'z'      <double>: third double to add
882  * Outputs: 
883     'result' <double>: output
884  * Boxes: 
885     'a' <std::Add>
886     'b' <std::Add>
887 >
888 and so on ...
889 \end{verbatim}
890
891 If the file has the \texttt{bbs} extension, you can ommit it and just type:
892 \begin{verbatim}
893 > include Add3
894 \end{verbatim}
895
896 Of course, you can include script files in other script files, 
897 like in the following example:
898
899 \begin{file}{Add4.bbs}
900 \begin{verbatim}
901 # Defines the Add4 black box which adds 4 doubles 
902 include Add3
903
904 define Add4
905   author "myself"
906   description "adds 4 doubles"
907   new Add3 a
908   new Add b
909   connect a.Out b.In1
910   input In1 a.In1 "first double to add
911   input In2 a.In2 "second double to add
912   input In3 a.In3 "third double to add"
913   input In4 b.In2 "fourth double to add"
914   output Out b.Out "output"
915 endefine
916 \end{verbatim}
917 \end{file}
918
919 TO DO: 
920
921 - naming conventions:  one cbb per file with the same name
922 - search paths 
923
924 % ==========================================
925 \hrule
926 \paragraph{Summary}
927 %\hrule
928 \begin{itemize}
929 \item The \texttt{include} command allows to include a script file in \bbi.
930 \item Lines starting with a \texttt{\#} are treated as comments in \bbi scripts.
931 \end{itemize}
932 \hrule
933 % ==========================================
934
935 % ==========================================
936 \subsubsection{Creating command line applications}
937 \label{bbi-command-line-app}
938 % ==========================================
939
940 Now that you now how to create complex black boxes 
941 (with \texttt{define/endefine}), think 
942 back to the \texttt{workspace} object. 
943 Remember that it is also 
944 a \texttt{complex black box}. 
945 In fact what you are doing when you type \bbi commands 
946 outside a \texttt{define/endefine} block 
947 is to progressively define the \texttt{workspace} 
948 complex black box.
949 You can think of it like if at start 
950 \bbi was issuing a command \texttt{'define workspace'} 
951 and then letting you define the interior of the box 
952 \texttt{workspace}.
953
954 Remember that the command \texttt{inputs} 
955 allows to define an input of a complex box. 
956 Now, if you use the command \texttt{input} 
957 outside a \texttt{define/endefine} block then 
958 it defines an input of the \texttt{workspace} box, 
959 that is an input of the \emph{main program}. 
960 This input will then be connected to the 
961 parameters that the user passes to the command line.
962
963 For example, consider the script: 
964
965 \begin{file}{add.bbs}
966 \begin{verbatim}
967 load std
968 new Add a
969 input x a.In1 "first number to add"
970 input y a.In2 "second number to add"
971 print "x+y=$a.Out$"
972 \end{verbatim}
973 \end{file}
974
975 The third and fourth lines define two inputs \texttt{x} 
976 and \texttt{y}. When you execute this script, 
977 you can pass these two arguments on the command line, 
978 like this:
979
980 \begin{verbatim}
981 > bbi add x=1 y=1
982 x+y=2
983 \end{verbatim}
984
985 You can also invoke \bbi the option \texttt{-h}, 
986 which gives help on the \texttt{workspace} box:
987
988 \begin{verbatim}
989 > bbi add -h
990  User's workspace
991  By: bbi (internal)
992  * Inputs: 
993     'x' <double>: first number to add
994     'y' <double>: second number to add
995 \end{verbatim}
996
997 To get a better help, use the \texttt{description} 
998 and \texttt{author} commands:
999
1000 \begin{file}{add.bbs}
1001 \begin{verbatim}
1002 description "Adds two numbers"
1003 author "foo@bar.com"
1004 load std
1005 new Add a
1006 input x a.In1 "first number to add"
1007 input y a.In2 "second number to add"
1008 print "x+y=$a.Out$"
1009 \end{verbatim}
1010 \end{file}
1011
1012 Now if you ask for help on the \texttt{add} script, you get:
1013
1014 \begin{verbatim}
1015 > bbi add -h
1016  Adds two numbers
1017  By: foo@bar.com
1018  * Inputs: 
1019     'x' <double>: first number to add
1020     'y' <double>: second number to add
1021 \end{verbatim}
1022
1023 Rather than getting the inputs of a script 
1024 from the command line, you can ask \bbi to 
1025 prompt the user for the values, using the \texttt{-t}
1026 commutator:
1027
1028 \begin{verbatim}
1029 > bbi add -t
1030 x=[the program waits for user answer]2
1031 y=[the program waits for user answer]5
1032 x+y=7
1033 \end{verbatim}
1034
1035 If \bbi is compiled in graphical mode (with \wx), 
1036 you can also use the \texttt{-g} commutator. 
1037 \bbi then prompts the user in graphical mode, 
1038 displaying a dialog box for each input,
1039 like in fig. \ref{bb-input-dialog-box}.
1040
1041 \begin{figure}[!ht]
1042 \caption{\label{bb-input-dialog-box}Input dialog box}
1043 \begin{center}
1044 \includegraphics[width=0.6\textwidth]{enter-the-value-of-x.png}
1045 \end{center}
1046 \end{figure}
1047
1048 % ==========================================
1049 \hrule
1050 \paragraph{Summary}
1051 %\hrule
1052 \begin{itemize}
1053 \item The \texttt{input}, \texttt{description} and \texttt{author} commands,
1054 when they are used outside a \texttt{define/endefine} block allow 
1055 to define the inputs, description and author of the main program.
1056 \item Inputs of the main program can be passed on the command line 
1057 using the syntax \texttt{<input-name>=<value>}. 
1058 No white space is allowed, if the value or the input name 
1059 contains white spaces, enclose them 
1060 between double quotes, e.g. \texttt{"parameter with white spaces = gnu's not unix"}.
1061 \item The \texttt{-h} option of \bbi prints help on the main program.
1062 \item The \texttt{-t} option of \bbi orders the program to prompt for its inputs in text mode.
1063 \item The \texttt{-g} option of \bbi orders the program to prompt for its inputs in graphical mode.
1064 \end{itemize}
1065 \hrule
1066 % ==========================================
1067
1068 % ==========================================
1069 \subsubsection{Using graphical interface boxes (widget boxes)}
1070 \label{bbi-widget}
1071 % ==========================================
1072
1073 If \bbi is compiled in graphical mode 
1074 (option \texttt{BUILD\_bbi\_GRAPHICAL} of \cmake, requires \wx),
1075 then you can use special black boxes which are 
1076 graphical interface components (widgets). 
1077 Basic components are provided in the package \texttt{wx}, 
1078 such as buttons, sliders, file open/save dialogs, etc.
1079
1080 As first example, type the following commands in \bbi:
1081 \begin{verbatim}
1082 > load wx 
1083 > new TextCtrl t
1084 > print $t.Out$\n
1085 \end{verbatim}
1086
1087 When you type \texttt{enter} after the last line, 
1088 a window pops up in which you can entrer a text.
1089 When you close the window, the text you entered is printed by 
1090 the \texttt{print} command.
1091
1092 Type \texttt{help wx}, you get something like:
1093 \begin{verbatim}
1094 Package wx v1.0.0- info-dev@creatis.insa-lyon.fr
1095  Basic graphical interface elements (slider, button ...) based on wxWidgets
1096  Black boxes: 
1097    Button               : Button that gives a string
1098    ColourSelectorButton : 
1099    ColourSelector       : Colour Selector widget (wxColourDialog)
1100    CommandButton        :
1101    DirectorySelector    :
1102    FileSelector         : FileDialog widget (wxFileDialog)
1103    InputText            : TextCtrl widget (wxTextCtrl)
1104    LayoutLine           : Sizer widget (wxSizer)
1105    LayoutSplit          : Split widget (wxSplitterWindow)
1106    NoteBook             :
1107    OutputText           : wxWidget Static text
1108    RadioButton          : RadioButton group widget (wxRadioButton) 0-9 entries
1109    Slider               : Slider widget (wxSlider)
1110
1111 \end{verbatim}
1112
1113 You can reproduce the same experiment as above using a 
1114 \texttt{Slider} or a \texttt{FileDialog} rather than a \texttt{TextCtrl}.
1115 See the files \texttt{test*.bbs} in the \texttt{scripts/test} directory.
1116
1117 There are two kind of widgets: ``terminal'' widgets and ``container'' widgets.
1118 The \texttt{TextCtrl}, \texttt{FileDialog} or \texttt{Slider} widgets 
1119 are ``terminal'' widgets. 
1120 ``container'' widgets are of another kind: they are made to 
1121 contain other widgets in order to build larger dialog boxes. 
1122 For example, the \texttt{Split} widget is a container which 
1123 ``splits'' horizontally a window into two parts, 
1124 each part including another widget. 
1125 The size of the two parts can be adjusted by the user thanks 
1126 to a ``handle''.
1127
1128 The script \texttt{scripts/test/testSplit.bbs} demonstrate its use. 
1129 Run it: it displays a window with two sliders. 
1130 Move the sliders and close the window. 
1131 The final positions of the sliders are printed out. 
1132 Now edit the file to see how this is done:
1133
1134 \begin{file}{scripts/test/testSplit.bbs}
1135 \begin{verbatim}
1136 load std
1137 load wx
1138
1139 new Slider s1
1140 new Slider s2
1141
1142 new Split s
1143 connect s.Child s1.Parent
1144 connect s.Child s2.Parent
1145
1146 print s1=$s1.Out$\\n
1147 print s2=$s2.Out$\\n
1148 \end{verbatim}
1149 \end{file}
1150
1151 First, the two sliders \texttt{s1} and \texttt{s2} are created.
1152 A \texttt{Split} box \texttt{s} is also created. 
1153 The \texttt{connect} commands then ``includes'' the sliders in the 
1154 split ``container''. 
1155 The input \texttt{Parent} is common to all widget boxes: 
1156 every widget can be inserted into another widget. 
1157 The output \texttt{Child} is specific of \emph{container} 
1158 widgets 
1159 (in \bbi type \texttt{help Slider}: 
1160 you will see the input \texttt{Parent}; 
1161 type \texttt{help Split}: 
1162 you will see the input \texttt{Parent} 
1163 and the output \texttt{Child}). 
1164 When you connect the \texttt{Child} output of a container 
1165 to the \texttt{Parent} input of a widget, 
1166 you order to include the widget in the container.
1167 Of course, the order of connection is important. 
1168 In our case, the slider \texttt{s1} is included first, 
1169 then the slider \texttt{s2}: \texttt{s1} will be placed 
1170 on top of \texttt{s2} (the \texttt{Split} box is 
1171 implemented that way, but this is arbitrary choice).
1172
1173 For the moment, there are only \emph{two} container widgets in the \texttt{wx} package: 
1174 the \texttt{Split} widget we just described and the \texttt{Sizer} 
1175 widget, which can have multiple children and 
1176 divides its window into as much parts as children, 
1177 each part of equal size. 
1178 The orientation of the sizer can be changed by the input \texttt{Orientation}.
1179 See the example \texttt{test/testSizer.bbs}.
1180 With only those two containers you can already create 
1181 complex dialog boxes (of course containers can be nested, which 
1182 leads to tree-like structures of widgets). 
1183 See the script \texttt{test/testSizerSplit.bbs} for an example.
1184
1185 One word about a special widget in the package \texttt{wx}: 
1186 the \texttt{Button}... to be continued.
1187
1188
1189 TO DO: 
1190 \begin{enumerate}
1191 \item Make a tour of ``complex'' widgets of wxvtk 
1192 \item Explain the role of ProcessMode to update widgets
1193 \item Explain the creation of complex widgets (containers, contained...)
1194 \item Explain the ``control'' mechanism in bbi (switch exec commands, e.g. Button)
1195 \end{enumerate}
1196
1197
1198 % ==========================================
1199 \subsection{More on ...}
1200 \label{bbi-more-on}
1201 % ==========================================
1202
1203 % ==========================================
1204 \subsubsection{Black box packages}
1205 \label{bbi-more-on-packages}
1206 % ==========================================
1207
1208 % ==========================================
1209 \subsubsection{Pipeline processing}
1210 \label{bbi-more-on-pipeline-processing}
1211 % ==========================================
1212
1213 % ==========================================
1214 \subsubsection{Complex black boxes}
1215 \label{bbi-more-on-complex-black-boxes}
1216
1217 %\subsubsection{Advanced issues}
1218 %\paragraph{Reducing the number of inputs of a box}
1219
1220 % ==========================================
1221 \subsubsection{Errors}
1222 \label{bbi-more-on-errors}
1223
1224 % ==========================================
1225 \subsubsection{\bbtk configuration file and search pathes}
1226 \label{bbi-more-on-configuration}
1227
1228 At start, \bbi tries to open an \texttt{xml} 
1229 configuration file named \texttt{bbtk\_config.xml}. 
1230 The search order is 
1231 \begin{enumerate}
1232 \item The current directory
1233 \item The subdir \texttt{.bbtk} of the user's home directory. 
1234 \begin{itemize} 
1235 \item On \texttt{Unix}, the home directory is the
1236 one stored by the environnement variable \texttt{HOME}, 
1237 typically \texttt{/home/username}.
1238 \item On \texttt{Windows}, the home directory is 
1239 the user's profile directory stored by the environnement 
1240 variable \texttt{USERPROFILE}, 
1241 typically \texttt{C:\\...}.
1242 \end{itemize}
1243 \item If none of these two pathes contains the file then it creates 
1244 a new one in the \texttt{.bbtk} directory. 
1245 \end{enumerate}
1246
1247 Once created, you can edit the \texttt{bbtk\_config.xml} file located 
1248 in your \texttt{.bbtk} directory. It contains:
1249
1250 \begin{file}{bbtk\_config.xml}
1251 \begin{verbatim}
1252 <?xml version="1.0" encoding="iso-8859-1"?>
1253 <config>
1254   <bbtk_url> http://www.creatis.insa-lyon.fr/software/bbtk </bbtk_url>
1255   <bbs_path> </bbs_path>     
1256   <package_path> </package_path> 
1257   <data_path> </data_path>
1258 </config>
1259 \end{verbatim}
1260 \end{file}
1261
1262 You can add pathes to 
1263 \begin{itemize}
1264 \item A custom folder in which to search for \texttt{.bbs} scripts (\texttt{include} command of \bbi) by adding an \texttt{xml} tag: 
1265 \texttt{<bbs\_path>complete\_path\_to\_folder<\/bbs\_path>}.
1266 \item A custom folder in which to search for packages (\texttt{load} command of \bbi) by adding an \texttt{xml} tag: 
1267 \texttt{<package\_path>complete\_path\_to\_folder<\/package\_path>}.
1268 \end{itemize}
1269
1270 % ==========================================
1271 \subsection{Language reference}
1272 \label{bbi-reference}
1273 % ==========================================
1274
1275
1276
1277
1278
1279 % ==========================================
1280 \begin{table}[!ht]
1281 \caption{\label{bbi-reference-box}
1282 \bbi pipeline creation and execution related commands.}
1283 \small
1284 \begin{tabular}{|lcm{6cm}|}
1285 \hline
1286 Command & Parameters & Effect \\ \hline
1287
1288 \texttt{new} & \texttt{<boxtype>} \texttt{<box-name>}& 
1289 Creates a box of type \texttt{boxtype} and name  
1290 \texttt{box-name}.
1291 \\ \hline
1292
1293 \texttt{delete} & \texttt{<box-name>} & 
1294 Destroys the box named \texttt{box-name}.
1295 \\ \hline 
1296
1297 \texttt{connect} & \texttt{<box1.output>} \texttt{<box2.input>} & 
1298 Connects the output 
1299 \texttt{output} of the box named \texttt{box1} 
1300 to the input \texttt{input} of the box named \texttt{box2} \\ \hline 
1301
1302 \texttt{set} & \texttt{<box.input>} \texttt{<value>} &
1303 Sets the input \texttt{input} of 
1304 the box named \texttt{box} to the value \texttt{value}.
1305 There must exist an \texttt{adaptor} 
1306 in the packages loaded which converts a \texttt{std::string} 
1307 to the type of the input \texttt{input}.
1308  \\ \hline 
1309
1310 \texttt{print} & \texttt{<string>} & 
1311 Prints the string after substituting each token of the form \texttt{\$box.output\$} by the adaptation to string of the value of the 
1312 output \texttt{output} of the box named \texttt{box}. 
1313 There must exist an \texttt{adaptor} 
1314 in the packages loaded which converts 
1315 the type of the output \texttt{output}
1316 to a \texttt{std::string}.
1317 \\ \hline 
1318
1319 \texttt{exec} & \texttt{<box-name>} & 
1320 Executes the box named \texttt{box-name}.
1321 If needed the boxes 
1322 connected to its inputs 
1323 are also processed recursively (pipeline processing).\\ \hline 
1324 \end{tabular}
1325 \end{table}
1326 % ==========================================
1327
1328
1329
1330 % ==========================================
1331 \begin{table}[!ht]
1332 \caption{\label{bbi-reference-interpreter}\bbi intepreter related commands.}
1333 \small
1334 \begin{tabular}{|lcm{6cm}|}
1335 \hline
1336 Command & Parameters & Effect \\ \hline
1337
1338
1339 \texttt{help} & - & 
1340 Prints help on available commands \\ \hline 
1341
1342 & \texttt{<command-name>} & 
1343 Prints help on the command \texttt{command-name} \\ \hline 
1344
1345 & \texttt{packages} & 
1346 Prints help on available packages and their box types 
1347 (without description)\\ \hline 
1348
1349 & \texttt{<package-name>} & 
1350 Prints help on the package \texttt{package-name} and its boxes 
1351 (with brief description). 
1352 The package must have been previously loaded
1353 \\ \hline 
1354
1355 & \texttt{<box-type>} & 
1356 Prints help (with full description) on the type of box 
1357 \texttt{box-type}. 
1358 The box type must belong to a package which has been previously loaded
1359 \\ \hline 
1360
1361 \texttt{include} & \texttt{<file-name>} & 
1362 Includes and executes the content of the file named \texttt{file-name} 
1363 exactly like if you were typing its content at the place were the 
1364 \texttt{include} command is.
1365 \\ \hline 
1366
1367 \texttt{load} & \texttt{<package-name>} & 
1368 Loads the package \texttt{package-name}\\ \hline 
1369
1370 \texttt{unload} & \texttt{<package-name>}& 
1371 Unloads the package \texttt{package-name}. 
1372 The package must have been previously loaded. 
1373 No box of a type defined in this package must still exist.
1374 \\ \hline 
1375
1376 \texttt{message} & \texttt{<category>} \texttt{<level>} & 
1377 Sets the level of verbosity of \bbi for the category of messages 
1378 \texttt{category} to \texttt{level}.
1379 %See \ref{verbosity}.
1380 \\ \hline 
1381
1382 \texttt{config} & - & Displays the Configuration parameters\\ \hline 
1383
1384 \texttt{reset} & - & Deletes all boxes and unloads all packages so 
1385 that \bbi gets back to its initial state \\ \hline 
1386
1387 \texttt{quit} & - & Exits the interpreter\\ \hline 
1388
1389 \end{tabular}
1390 \end{table}
1391 % ==========================================
1392
1393
1394
1395
1396
1397 % ==========================================
1398 \begin{table}[!ht]
1399 \caption{\label{bbi-reference-complex-box}
1400 \bbi complex black box definition related commands.}
1401 \small
1402 \begin{tabular}{|lcm{6cm}|}
1403 \hline
1404 Command & Parameters & Effect \\ \hline
1405
1406
1407 \texttt{define} & \texttt{<box-type>} & 
1408 Starts the definition of a complex black box of type  
1409 \texttt{box-type}\\ \hline 
1410
1411 \texttt{endefine} & - & 
1412 Ends the definition of a complex black box type\\ \hline 
1413
1414
1415 \texttt{author} & \texttt{<string>} & 
1416 Sets the author(s) of the complex black box currently being defined \\ \hline 
1417
1418 \texttt{description} & \texttt{<string>} & 
1419 Sets the description of the complex black box currently being defined 
1420 \\ \hline 
1421
1422
1423 \texttt{input} & \texttt{<name>} \texttt{<box.input>} \texttt{<help>} & 
1424 Defines a new input for the current complex black box, 
1425 named \texttt{name}. 
1426 It is defined as corresponding to 
1427 the input \texttt{input} of the box \texttt{box}. 
1428 \texttt{<help>} is the help string for the new input.
1429 The box \texttt{box} must already have been created in the complex box 
1430 and of course have an input named \texttt{input}.
1431 \\ \hline 
1432
1433
1434 \texttt{output} & \texttt{<name>} \texttt{<box.output>} \texttt{<help>} & 
1435 Defines a new output for the current complex black box, 
1436 named \texttt{name}. 
1437 It is defined as corresponding to 
1438 the output \texttt{output} of the box \texttt{box}. 
1439 \texttt{<help>} is the help string for the new output.
1440 The box \texttt{box} must already have been created in the complex box and of course have an output named \texttt{output}. 
1441 \\ \hline 
1442
1443
1444 \end{tabular}
1445 \end{table}
1446 % ==========================================
1447
1448
1449
1450
1451 % ==========================================
1452 \vspace{0.5cm}\hrule
1453 \section{Using black boxes in \CPP programs}
1454 \label{cpp}
1455 % ==========================================
1456
1457
1458
1459
1460 %\bibliography{all}
1461
1462
1463
1464 %\section{Conclusion}
1465 \end{document}
1466