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: bbtkVirtualExec.h,v $
32 Date: $Date: 2012/11/16 08:49:01 $
33 Version: $Revision: 1.21 $
34 =========================================================================*/
40 * \brief class VirtualExec: level 0 of script execution (header)
43 * \class bbtk::VirtualExec
44 * \brief class VirtualExec: level 0 of script execution
47 #ifndef __bbtkVirtualExec_h__
48 #define __bbtkVirtualExec_h__
50 #include "bbtkSystem.h"
51 #include "bbtkComplexBlackBoxDescriptor.h"
52 #include "bbtkFactory.h"
58 BBTK_FORWARD_DECLARE_POINTER(Interpreter);
60 class BBTK_EXPORT VirtualExec : public Object
62 BBTK_ABSTRACT_OBJECT_INTERFACE(VirtualExec);
73 /// Sets the interpreter who uses it
74 void SetInterpreter(InterpreterPointer i) { mInterpreter = i; }
75 /// Gets the interpreter who uses it
76 InterpreterPointer GetInterpreter(); // { return mInterpreter.lock(); }
77 /// Gets the interpreter who uses it (const)
78 // const Interpreter::Pointer GetInterpreter() const { return mInterpreter; }
80 /// Gets the factory used by the executer
81 virtual Factory::Pointer GetFactory() { return Factory::Pointer(); }
82 /// Gets the factory used by the executer (const)
83 // virtual const Factory* GetFactory() const { return 0; }
85 /// Sets the inputs of the workspace :
86 virtual void SetInputs(const std::map<std::string,std::string>& m) = 0;
88 /// Puts the executer in "no exec" mode,
89 /// which creates but does not execute pipelines
90 virtual void SetNoExecMode(bool b) = 0;
92 virtual bool GetNoExecMode() const = 0;
94 /// Sets the mode of dialog of the executer for Root inputs
95 virtual void SetDialogMode(DialogModeType t) = 0;
97 /// Puts the executer in "no error" mode,
98 /// Errors do not stop execution (but warnings are produced)
99 virtual void SetNoErrorMode(bool b) = 0;
100 virtual bool GetNoErrorMode() const = 0;
101 //=================================================================
103 virtual void LoadPackage(const std::string &name ) = 0;
105 /// Unloads a package
106 virtual void UnLoadPackage(const std::string &name ) = 0;
108 /// Starts a package block
109 virtual void BeginPackage (const std::string &name ) = 0;
111 /// Ends a package block
112 virtual void EndPackage () = 0;
114 /// Starts the definition of a new ComplexBlackBox in package pack
115 /// scriptfilename is the file from which the def is read
116 virtual void Define (const std::string &name,
117 const std::string& pack,
118 const std::string &scriptfilename) = 0;
120 /// Sets the file name to use for the current definition
121 /// (Used to set it after the Define command)
122 virtual void SetCurrentFileName (const std::string &name ) = 0;
124 virtual void SetTypeOfScript_Application( ) = 0;
126 /// End the definition of a ComplexBlackBox
127 virtual void EndDefine () = 0;
129 /// Sets the kind of the currently defined ComplexBlackBox
130 virtual void Kind(const std::string& kind) = 0;
132 /// Creates a new black box in current complex box
133 virtual void Create ( const std::string& boxType, const std::string&
136 /// Destroys a black box
137 virtual void Destroy (const std::string &boxName) = 0;
139 /// Clears the currently defined ComplexBlackBox
140 virtual void Clear() = 0;
142 /// Connects the output boxOutput to the input boxInput
143 virtual void Connect (const std::string &boxfrom,
144 const std::string &output,
145 const std::string &boxto,
146 const std::string &input) = 0;
149 virtual void Execute (const std::string &box) = 0;
151 /// Defines an input of the current complex box
152 virtual void DefineInput (const std::string &name,
153 const std::string &box,
154 const std::string &input,
155 const std::string &help) = 0;
157 /// Defines an output of the current complex box
158 virtual void DefineOutput (const std::string &name,
159 const std::string &box,
160 const std::string &output,
161 const std::string &help) = 0;
163 /// sets the input of the box with the value
164 virtual void Set (const std::string &box,
165 const std::string &input,
166 const std::string &value) = 0;
168 /// gets the output of the box
169 virtual std::string Get (const std::string &box,
170 const std::string &output) = 0;
172 /// changes the workspace name
173 virtual void SetWorkspaceName( const std::string& n ) = 0;
175 ///Adds the authorName to the Box author list
176 virtual void Author(const std::string &authorName) = 0;
178 ///Adds the categories to the Box categoris list
179 virtual void Category(const std::string &categories) = 0;
181 /// The description string which explains what does the ComplexBox
182 virtual void Description(const std::string &d) = 0;
184 /// prints the list of the boxes of the current box
185 virtual void PrintHelpListBoxes() = 0;
187 /// Generate a HTML file with a gif file with the actual pipeline (Graphviz-dot needed). Returns the file path
188 virtual std::string ShowGraph(const std::string &nameblackbox,
189 const std::string &detailStr,
190 const std::string &levelStr,
191 const std::string &output_file,
192 const std::string &custom_header,
193 const std::string &custom_title,
194 bool system_display = true) = 0;
196 /// Generate a HTML with a gif file with the actual pipeline (Graphviz-dot needed). Returns the file path
197 virtual std::string ShowGraphInstances(const std::string &nameblackbox, int detail, int level, bool system_display=true) = 0;
199 /// Prints help on a black box
200 virtual void PrintHelpBlackBox(const std::string &nameblackbox, const std::string &detailStr, const std::string &levelStr) = 0;
202 virtual void Reset() = 0;
204 /// Sets the level of message for kind
205 virtual void SetMessageLevel(const std::string &kind, int level) = 0;
207 /// Prints help on the messages
208 virtual void HelpMessages() = 0;
210 /// Prints the string ... MORE : TO EXPLAIN
211 virtual void Print(const std::string & message) = 0;
213 virtual ComplexBlackBoxDescriptor::Pointer GetWorkspace()
214 { return ComplexBlackBoxDescriptor::Pointer(); }
216 // static const std::string& GetObjectDescription() = 0;
217 // { static std::string s("VirtualExec"); return s; }
222 /// The interpreter which uses it (0 if none)
223 InterpreterWeakPointer mInterpreter;