1 /*=========================================================================
4 Module: $RCSfile: bbtkTranscriptor.h,v $ $
6 Date: $Date: 2008/10/02 07:43:21 $
7 Version: $Revision: 1.11 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
20 * \brief class Transcriptor: level 0 of script C++ translation (header)
23 * \class bbtk::Transcriptor
24 * \brief class Transcriptor: level 0 of script C++ translation
27 #ifndef __bbtkTranscriptor_h__
28 #define __bbtkTranscriptor_h__
30 #include "bbtkVirtualExec.h"
32 #include "bbtkSystem.h"
38 class /*BBTK_EXPORT*/ Transcriptor : public VirtualExec
40 BBTK_OBJECT_INTERFACE(Transcriptor);
41 typedef VirtualExec Superclass;
43 static Pointer New(const std::string& filename);
46 /// Sets the inputs of the workspace :
47 void SetInputs(const std::map<std::string,std::string>& m) { mInputs = m; }
49 /// Puts the executer in "no exec" mode,
50 /// which creates but does not execute pipelines
52 //void SetNoExecMode(bool b) { mNoExecMode = b; }
53 void SetNoExecMode(bool b)
56 m_Fp << " e->SetNoExecMode(true);" << std::endl;
58 m_Fp << " e->SetNoExecMode(false);" << std::endl;
61 void SetNoErrorMode(bool b)
64 m_Fp << " e->SetNoErrorMode(true);" << std::endl;
66 m_Fp << " e->SetNoErrorMode(false);" << std::endl;
69 bool GetNoExecMode() const { return false; }
70 bool GetNoErrorMode() const { return false; }
72 /// Sets the mode of dialog of the executer for Root inputs
73 void SetDialogMode(DialogModeType t) { mDialogMode = t; }
76 void LoadPackage(const std::string &name );
79 void UnLoadPackage(const std::string &name );
81 /// Starts a package block
82 void BeginPackage (const std::string &name );
84 /// Ends a package block
87 /// Starts the definition of a new ComplexBlackBox in package pack
88 /// scriptfilename is the file from which the def is read
89 void Define (const std::string &name,
90 const std::string& pack,
91 const std::string &scriptfilename);
93 /// Sets the file name to use for the current definition
94 /// (Used to set it after the Define command)
95 void SetCurrentFileName (const std::string &name );
97 /// End the definition of a ComplexBlackBox
100 /// Sets the kind of the currently defined ComplexBlackBox
101 void Kind(const std::string& kind);
103 /// Creates a new black box in current complex box
104 void Create ( const std::string& boxType, const std::string& boxName);
106 /// Destroys a black box
107 void Destroy (const std::string &boxName);
109 /// Connects the output boxOutput to the input boxInput
110 void Connect (const std::string &boxfrom,
111 const std::string &output,
112 const std::string &boxto,
113 const std::string &input);
116 void Execute(const std::string &box);
118 /// Defines an input of the current complex box
119 void DefineInput (const std::string &name,
120 const std::string &box,
121 const std::string &input,
122 const std::string &help);
124 /// Defines an output of the current complex box
125 void DefineOutput (const std::string &name,
126 const std::string &box,
127 const std::string &output,
128 const std::string &help);
130 /// sets the input of the box with the value
131 void Set (const std::string &box,
132 const std::string &input,
133 const std::string &value);
135 /// gets the output of the box
136 std::string Get (const std::string &box,
137 const std::string &output);
139 /// changes the workspace name
140 void SetWorkspaceName( const std::string& n );
142 ///Adds the authorName to the Box author list
143 void Author(const std::string &authorName);
145 ///Adds the Categories to the Box category list
146 void Category(const std::string &category);
148 /// The description string which explains what does the ComplexBox
149 void Description(const std::string & d);
151 /// prints the list off the boxes of the current box
154 /// Generate a HTML with a gif file with the actual pipeline (Graphviz-dot needed). Returns the file path
155 std::string ShowGraph(const std::string &nameblackbox,
156 const std::string &detailStr,
157 const std::string &levelStr,
158 const std::string &output_file,
159 const std::string &custom_header,
160 const std::string &custom_title,
161 bool system_display = true);
163 /// Generate a HTML with a gif file with the actual pipeline (Graphviz-dot needed). Returns the file path
164 std::string ShowGraphInstances(const std::string &nameblackbox, int detail, int level, bool system_display=true);
166 /// Description of the actual pipeline
167 void ShowRelations(const std::string &nameblackbox, const std::string &detailStr, const std::string &levelStr);
171 /// Sets the level of message for kind
172 void SetMessageLevel(const std::string &kind,
175 /// Prints help on the messages
178 /// Prints the string ... MORE : TO EXPLAIN
179 void Print(const std::string & message);
181 // static const std::string& GetObjectDescription()
182 // { static std::string s("Executer"); return s; }
188 Transcriptor(const std::string& filename);
190 /// The input values of the Root ComplexBlackBox
191 std::map<std::string,std::string> mInputs;
194 DialogModeType mDialogMode;
196 /// File Pointer, to hold generated C++ code.
197 // std::ofstream *m_Fp;