2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
10 # This software is governed by the CeCILL-B license under French law and
11 # abiding by the rules of distribution of free software. You can use,
12 # modify and/ or redistribute the software under the terms of the CeCILL-B
13 # license as circulated by CEA, CNRS and INRIA at the following URL
14 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 # or in the file LICENSE.txt.
17 # As a counterpart to the access to the source code and rights to copy,
18 # modify and redistribute granted by the license, users are provided only
19 # with a limited warranty and the software's author, the holder of the
20 # economic rights, and the successive licensors have only limited
23 # The fact that you are presently reading this means that you have had
24 # knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------ */
28 /*=========================================================================
30 Module: $RCSfile: bbtkTranscriptor.h,v $
32 Date: $Date: 2012/11/16 08:49:01 $
33 Version: $Revision: 1.16 $
34 =========================================================================*/
40 * \brief class Transcriptor: level 0 of script C++ translation (header)
43 * \class bbtk::Transcriptor
44 * \brief class Transcriptor: level 0 of script C++ translation
47 #ifndef __bbtkTranscriptor_h__
48 #define __bbtkTranscriptor_h__
50 #include "bbtkVirtualExec.h"
52 #include "bbtkSystem.h"
58 class /*BBTK_EXPORT*/ Transcriptor : public VirtualExec
60 BBTK_OBJECT_INTERFACE(Transcriptor);
61 typedef VirtualExec Superclass;
63 static Pointer New(const std::string& filename);
66 /// Sets the inputs of the workspace :
67 void SetInputs(const std::map<std::string,std::string>& m) { mInputs = m; }
69 /// Puts the executer in "no exec" mode,
70 /// which creates but does not execute pipelines
72 //void SetNoExecMode(bool b) { mNoExecMode = b; }
73 void SetNoExecMode(bool b)
76 m_Fp << " e->SetNoExecMode(true);" << std::endl;
78 m_Fp << " e->SetNoExecMode(false);" << std::endl;
81 void SetNoErrorMode(bool b)
84 m_Fp << " e->SetNoErrorMode(true);" << std::endl;
86 m_Fp << " e->SetNoErrorMode(false);" << std::endl;
89 bool GetNoExecMode() const { return false; }
90 bool GetNoErrorMode() const { return false; }
92 /// Sets the mode of dialog of the executer for Root inputs
93 void SetDialogMode(DialogModeType t) { mDialogMode = t; }
96 void LoadPackage(const std::string &name );
99 void UnLoadPackage(const std::string &name );
101 /// Starts a package block
102 void BeginPackage (const std::string &name );
104 /// Ends a package block
107 /// Starts the definition of a new ComplexBlackBox in package pack
108 /// scriptfilename is the file from which the def is read
109 void Define (const std::string &name,
110 const std::string& pack,
111 const std::string &scriptfilename);
113 /// Sets the file name to use for the current definition
114 /// (Used to set it after the Define command)
115 void SetCurrentFileName (const std::string &name );
117 void SetTypeOfScript_Application();
119 /// End the definition of a ComplexBlackBox
122 /// Sets the kind of the currently defined ComplexBlackBox
123 void Kind(const std::string& kind);
125 /// Creates a new black box in current complex box
126 void Create ( const std::string& boxType, const std::string& boxName);
128 /// Destroys a black box
129 void Destroy (const std::string &boxName);
131 /// Clears the currently defined ComplexBlackBox
134 /// Connects the output boxOutput to the input boxInput
135 void Connect (const std::string &boxfrom,
136 const std::string &output,
137 const std::string &boxto,
138 const std::string &input);
141 void Execute(const std::string &box);
143 /// Defines an input of the current complex box
144 void DefineInput (const std::string &name,
145 const std::string &box,
146 const std::string &input,
147 const std::string &help);
149 /// Defines an output of the current complex box
150 void DefineOutput (const std::string &name,
151 const std::string &box,
152 const std::string &output,
153 const std::string &help);
155 /// sets the input of the box with the value
156 void Set (const std::string &box,
157 const std::string &input,
158 const std::string &value);
160 /// gets the output of the box
161 std::string Get (const std::string &box,
162 const std::string &output);
164 /// changes the workspace name
165 void SetWorkspaceName( const std::string& n );
167 ///Adds the authorName to the Box author list
168 void Author(const std::string &authorName);
170 ///Adds the Categories to the Box category list
171 void Category(const std::string &category);
173 /// The description string which explains what does the ComplexBox
174 void Description(const std::string & d);
176 /// prints the list off the boxes of the current box
177 void PrintHelpListBoxes();
179 /// Generate a HTML with a gif file with the actual pipeline (Graphviz-dot needed). Returns the file path
180 std::string ShowGraph(const std::string &nameblackbox,
181 const std::string &detailStr,
182 const std::string &levelStr,
183 const std::string &output_file,
184 const std::string &custom_header,
185 const std::string &custom_title,
186 bool system_display = true);
188 /// Generate a HTML with a gif file with the actual pipeline (Graphviz-dot needed). Returns the file path
189 std::string ShowGraphInstances(const std::string &nameblackbox, int detail, int level, bool system_display=true);
191 /// Prints help on a black box
192 void PrintHelpBlackBox(const std::string &nameblackbox, const std::string &detailStr, const std::string &levelStr);
196 /// Sets the level of message for kind
197 void SetMessageLevel(const std::string &kind,
200 /// Prints help on the messages
203 /// Prints the string ... MORE : TO EXPLAIN
204 void Print(const std::string & message);
206 // static const std::string& GetObjectDescription()
207 // { static std::string s("Executer"); return s; }
213 Transcriptor(const std::string& filename);
215 /// The input values of the Root ComplexBlackBox
216 std::map<std::string,std::string> mInputs;
219 DialogModeType mDialogMode;
221 /// File Pointer, to hold generated C++ code.
222 // std::ofstream *m_Fp;