1 /*=========================================================================
4 Module: $RCSfile: bbtkTranscriptor.h,v $ $
6 Date: $Date: 2008/01/22 17:00:17 $
7 Version: $Revision: 1.1 $
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"
37 class /*BBTK_EXPORT*/ Transcriptor : public VirtualExec
43 Transcriptor(std::string filename);
48 /// Sets the inputs of the workspace :
49 void SetInputs(const std::map<std::string,std::string>& m) { mInputs = m; }
51 /// Puts the executer in "no exec" mode,
52 /// which creates but does not execute pipelines
54 //void SetNoExecMode(bool b) { mNoExecMode = b; }
55 void SetNoExecMode(bool b)
57 m_Fp << "e->SetNoExecMode(true);" << std::endl;
60 bool GetNoExecMode() const { return mNoExecMode; }
62 bool GetNoExecMode() const
64 // cannot compile, since ethos is 'const' !
65 //m_Fp << "e->GetNoExecMode(true);" << std::endl;
68 /// Sets the mode of dialog of the executer for Root inputs
69 void SetDialogMode(DialogModeType t) { mDialogMode = t; }
71 /// Starts the definition of a new ComplexBlackBox in package pack
72 /// scriptfilename is the file from which the def is read
73 void Define (const std::string &name,
74 const std::string& pack,
75 const std::string &scriptfilename);
77 /// End the definition of a ComplexBlackBox
80 /// Creates a new black box in current complex box
81 void Create ( const std::string& boxType, const std::string& boxName);
83 /// Destroys a black box
84 void Destroy (const std::string &boxName);
86 /// Connects the output boxOutput to the input boxInput
87 void Connect (const std::string &boxfrom,
88 const std::string &output,
89 const std::string &boxto,
90 const std::string &input);
93 /// would 'Execute' be more meaningfull ?
94 void Update (const std::string &box);
96 /// Defines an input of the current complex box
97 void DefineInput (const std::string &name,
98 const std::string &box,
99 const std::string &input,
100 const std::string &help);
102 /// Defines an output of the current complex box
103 void DefineOutput (const std::string &name,
104 const std::string &box,
105 const std::string &output,
106 const std::string &help);
108 /// sets the input of the box with the value
109 void Set (const std::string &box,
110 const std::string &input,
111 const std::string &value);
113 /// gets the output of the box
114 std::string Get (const std::string &box,
115 const std::string &output);
117 /// changes the workspace name
118 void SetWorkspaceName( const std::string& n );
120 ///Adds the authorName to the Box's author list
121 void Author(const std::string &authorName);
123 /// The description string which explains what does the ComplexBox
124 void Description(const std::string & d);
126 /// prints the list off the boxes of the current box
129 /// Generate a HTML with a gif file with the actual pipeline (Graphviz-dot needed). Returns the file path
130 std::string ShowGraph(const std::string &nameblackbox,
131 const std::string &detailStr,
132 const std::string &levelStr,
133 const std::string &output_file,
134 const std::string &custom_header,
135 const std::string &custom_title,
136 bool system_display = true);
138 /// Generate a HTML with a gif file with the actual pipeline (Graphviz-dot needed). Returns the file path
139 std::string ShowGraphInstances(const std::string &nameblackbox, int detail, int level, bool system_display=true);
141 /// Description of the actual pipeline
142 void ShowRelations(const std::string &nameblackbox, const std::string &detailStr, const std::string &levelStr);
146 // static const std::string& GetObjectDescription()
147 // { static std::string s("Executer"); return s; }
153 /// Gets the current working black box
154 ComplexBlackBoxDescriptor* Current() { return mCurrent.back().box; }
156 /// Returns true when we are inside a define/endefine block
157 // bool InDefinitionBlock() { return (mCurrent.size()>1); }
159 //==================================================================
163 // Factory* mFactory;
168 /// The root ComplexBlackBox, in which operations are done when outside a define/endefine block
169 /// Its name in bbi is 'workspace'
170 ComplexBlackBoxDescriptor* mRoot;
172 /// Struct that stores info on user defined complex black boxes
175 ComplexBlackBoxDescriptor* box;
177 CBBDefinition(ComplexBlackBoxDescriptor* d, const std::string& p )
178 : box(d), package(p) {}
181 /// The stack of current working ComplexBlackBox
182 /// (is a stack for nested definitions)
183 /// only contains the root when outside a define/endefine block
184 std::deque<CBBDefinition> mCurrent;
186 /// flag which is true when we are inside a Define/EndDefine block
189 /// The input values of the Root ComplexBlackBox
190 std::map<std::string,std::string> mInputs;
192 /// no exec mode flag
196 DialogModeType mDialogMode;
198 /// File Pointer, to hold generated C++ code.
199 // std::ofstream *m_Fp;