1 /*=========================================================================
3 Module: $RCSfile: bbtkTranscriptor.h,v $
5 Date: $Date: 2009/06/08 14:50:04 $
6 Version: $Revision: 1.14 $
7 =========================================================================*/
9 /* ---------------------------------------------------------------------
11 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
12 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
14 * This software is governed by the CeCILL-B license under French law and
15 * abiding by the rules of distribution of free software. You can use,
16 * modify and/ or redistribute the software under the terms of the CeCILL-B
17 * license as circulated by CEA, CNRS and INRIA at the following URL
18 * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
19 * or in the file LICENSE.txt.
21 * As a counterpart to the access to the source code and rights to copy,
22 * modify and redistribute granted by the license, users are provided only
23 * with a limited warranty and the software's author, the holder of the
24 * economic rights, and the successive licensors have only limited
27 * The fact that you are presently reading this means that you have had
28 * knowledge of the CeCILL-B license and that you accept its terms.
29 * ------------------------------------------------------------------------ */
33 * \brief class Transcriptor: level 0 of script C++ translation (header)
36 * \class bbtk::Transcriptor
37 * \brief class Transcriptor: level 0 of script C++ translation
40 #ifndef __bbtkTranscriptor_h__
41 #define __bbtkTranscriptor_h__
43 #include "bbtkVirtualExec.h"
45 #include "bbtkSystem.h"
51 class /*BBTK_EXPORT*/ Transcriptor : public VirtualExec
53 BBTK_OBJECT_INTERFACE(Transcriptor);
54 typedef VirtualExec Superclass;
56 static Pointer New(const std::string& filename);
59 /// Sets the inputs of the workspace :
60 void SetInputs(const std::map<std::string,std::string>& m) { mInputs = m; }
62 /// Puts the executer in "no exec" mode,
63 /// which creates but does not execute pipelines
65 //void SetNoExecMode(bool b) { mNoExecMode = b; }
66 void SetNoExecMode(bool b)
69 m_Fp << " e->SetNoExecMode(true);" << std::endl;
71 m_Fp << " e->SetNoExecMode(false);" << std::endl;
74 void SetNoErrorMode(bool b)
77 m_Fp << " e->SetNoErrorMode(true);" << std::endl;
79 m_Fp << " e->SetNoErrorMode(false);" << std::endl;
82 bool GetNoExecMode() const { return false; }
83 bool GetNoErrorMode() const { return false; }
85 /// Sets the mode of dialog of the executer for Root inputs
86 void SetDialogMode(DialogModeType t) { mDialogMode = t; }
89 void LoadPackage(const std::string &name );
92 void UnLoadPackage(const std::string &name );
94 /// Starts a package block
95 void BeginPackage (const std::string &name );
97 /// Ends a package block
100 /// Starts the definition of a new ComplexBlackBox in package pack
101 /// scriptfilename is the file from which the def is read
102 void Define (const std::string &name,
103 const std::string& pack,
104 const std::string &scriptfilename);
106 /// Sets the file name to use for the current definition
107 /// (Used to set it after the Define command)
108 void SetCurrentFileName (const std::string &name );
110 /// End the definition of a ComplexBlackBox
113 /// Sets the kind of the currently defined ComplexBlackBox
114 void Kind(const std::string& kind);
116 /// Creates a new black box in current complex box
117 void Create ( const std::string& boxType, const std::string& boxName);
119 /// Destroys a black box
120 void Destroy (const std::string &boxName);
122 /// Clears the currently defined ComplexBlackBox
125 /// Connects the output boxOutput to the input boxInput
126 void Connect (const std::string &boxfrom,
127 const std::string &output,
128 const std::string &boxto,
129 const std::string &input);
132 void Execute(const std::string &box);
134 /// Defines an input of the current complex box
135 void DefineInput (const std::string &name,
136 const std::string &box,
137 const std::string &input,
138 const std::string &help);
140 /// Defines an output of the current complex box
141 void DefineOutput (const std::string &name,
142 const std::string &box,
143 const std::string &output,
144 const std::string &help);
146 /// sets the input of the box with the value
147 void Set (const std::string &box,
148 const std::string &input,
149 const std::string &value);
151 /// gets the output of the box
152 std::string Get (const std::string &box,
153 const std::string &output);
155 /// changes the workspace name
156 void SetWorkspaceName( const std::string& n );
158 ///Adds the authorName to the Box author list
159 void Author(const std::string &authorName);
161 ///Adds the Categories to the Box category list
162 void Category(const std::string &category);
164 /// The description string which explains what does the ComplexBox
165 void Description(const std::string & d);
167 /// prints the list off the boxes of the current box
168 void PrintHelpListBoxes();
170 /// Generate a HTML with a gif file with the actual pipeline (Graphviz-dot needed). Returns the file path
171 std::string ShowGraph(const std::string &nameblackbox,
172 const std::string &detailStr,
173 const std::string &levelStr,
174 const std::string &output_file,
175 const std::string &custom_header,
176 const std::string &custom_title,
177 bool system_display = true);
179 /// Generate a HTML with a gif file with the actual pipeline (Graphviz-dot needed). Returns the file path
180 std::string ShowGraphInstances(const std::string &nameblackbox, int detail, int level, bool system_display=true);
182 /// Prints help on a black box
183 void PrintHelpBlackBox(const std::string &nameblackbox, const std::string &detailStr, const std::string &levelStr);
187 /// Sets the level of message for kind
188 void SetMessageLevel(const std::string &kind,
191 /// Prints help on the messages
194 /// Prints the string ... MORE : TO EXPLAIN
195 void Print(const std::string & message);
197 // static const std::string& GetObjectDescription()
198 // { static std::string s("Executer"); return s; }
204 Transcriptor(const std::string& filename);
206 /// The input values of the Root ComplexBlackBox
207 std::map<std::string,std::string> mInputs;
210 DialogModeType mDialogMode;
212 /// File Pointer, to hold generated C++ code.
213 // std::ofstream *m_Fp;