1 /*=========================================================================
4 Module: $RCSfile: bbtkTranscriptor.h,v $ $
6 Date: $Date: 2008/04/18 12:59:16 $
7 Version: $Revision: 1.10 $
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 bool GetNoExecMode() const { return mNoExecMode; }
63 /// Sets the mode of dialog of the executer for Root inputs
64 void SetDialogMode(DialogModeType t) { mDialogMode = t; }
67 void LoadPackage(const std::string &name );
70 void UnLoadPackage(const std::string &name );
72 /// Starts a package block
73 void BeginPackage (const std::string &name );
75 /// Ends a package block
78 /// Starts the definition of a new ComplexBlackBox in package pack
79 /// scriptfilename is the file from which the def is read
80 void Define (const std::string &name,
81 const std::string& pack,
82 const std::string &scriptfilename);
84 /// Sets the file name to use for the current definition
85 /// (Used to set it after the Define command)
86 void SetCurrentFileName (const std::string &name );
88 /// End the definition of a ComplexBlackBox
91 /// Sets the kind of the currently defined ComplexBlackBox
92 void Kind(const std::string& kind);
94 /// Creates a new black box in current complex box
95 void Create ( const std::string& boxType, const std::string& boxName);
97 /// Destroys a black box
98 void Destroy (const std::string &boxName);
100 /// Connects the output boxOutput to the input boxInput
101 void Connect (const std::string &boxfrom,
102 const std::string &output,
103 const std::string &boxto,
104 const std::string &input);
107 void Execute(const std::string &box);
109 /// Defines an input of the current complex box
110 void DefineInput (const std::string &name,
111 const std::string &box,
112 const std::string &input,
113 const std::string &help);
115 /// Defines an output of the current complex box
116 void DefineOutput (const std::string &name,
117 const std::string &box,
118 const std::string &output,
119 const std::string &help);
121 /// sets the input of the box with the value
122 void Set (const std::string &box,
123 const std::string &input,
124 const std::string &value);
126 /// gets the output of the box
127 std::string Get (const std::string &box,
128 const std::string &output);
130 /// changes the workspace name
131 void SetWorkspaceName( const std::string& n );
133 ///Adds the authorName to the Box author list
134 void Author(const std::string &authorName);
136 ///Adds the Categories to the Box category list
137 void Category(const std::string &category);
139 /// The description string which explains what does the ComplexBox
140 void Description(const std::string & d);
142 /// prints the list off the boxes of the current box
145 /// Generate a HTML with a gif file with the actual pipeline (Graphviz-dot needed). Returns the file path
146 std::string ShowGraph(const std::string &nameblackbox,
147 const std::string &detailStr,
148 const std::string &levelStr,
149 const std::string &output_file,
150 const std::string &custom_header,
151 const std::string &custom_title,
152 bool system_display = true);
154 /// Generate a HTML with a gif file with the actual pipeline (Graphviz-dot needed). Returns the file path
155 std::string ShowGraphInstances(const std::string &nameblackbox, int detail, int level, bool system_display=true);
157 /// Description of the actual pipeline
158 void ShowRelations(const std::string &nameblackbox, const std::string &detailStr, const std::string &levelStr);
162 /// Sets the level of message for kind
163 void SetMessageLevel(const std::string &kind,
166 /// Prints help on the messages
169 /// Prints the string ... MORE : TO EXPLAIN
170 void Print(const std::string & message);
172 // static const std::string& GetObjectDescription()
173 // { static std::string s("Executer"); return s; }
179 Transcriptor(const std::string& filename);
181 /// The input values of the Root ComplexBlackBox
182 std::map<std::string,std::string> mInputs;
184 /// no exec mode flag
188 DialogModeType mDialogMode;
190 /// File Pointer, to hold generated C++ code.
191 // std::ofstream *m_Fp;