1 /*=========================================================================
4 Module: $RCSfile: bbtkVirtualExec.h,v $ $
6 Date: $Date: 2008/10/02 07:43:21 $
7 Version: $Revision: 1.16 $
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 VirtualExec: level 0 of script execution (header)
23 * \class bbtk::VirtualExec
24 * \brief class VirtualExec: level 0 of script execution
27 #ifndef __bbtkVirtualExec_h__
28 #define __bbtkVirtualExec_h__
30 #include "bbtkSystem.h"
31 #include "bbtkComplexBlackBoxDescriptor.h"
32 #include "bbtkFactory.h"
38 BBTK_FORWARD_DECLARE_POINTER(Interpreter);
40 class BBTK_EXPORT VirtualExec : public Object
42 BBTK_ABSTRACT_OBJECT_INTERFACE(VirtualExec);
53 /// Sets the interpreter who uses it
54 void SetInterpreter(InterpreterPointer i) { mInterpreter = i; }
55 /// Gets the interpreter who uses it
56 InterpreterPointer GetInterpreter(); // { return mInterpreter.lock(); }
57 /// Gets the interpreter who uses it (const)
58 // const Interpreter::Pointer GetInterpreter() const { return mInterpreter; }
60 /// Gets the factory used by the executer
61 virtual Factory::Pointer GetFactory() { return Factory::Pointer(); }
62 /// Gets the factory used by the executer (const)
63 // virtual const Factory* GetFactory() const { return 0; }
65 /// Sets the inputs of the workspace :
66 virtual void SetInputs(const std::map<std::string,std::string>& m) = 0;
68 /// Puts the executer in "no exec" mode,
69 /// which creates but does not execute pipelines
70 virtual void SetNoExecMode(bool b) = 0;
72 virtual bool GetNoExecMode() const = 0;
74 /// Sets the mode of dialog of the executer for Root inputs
75 virtual void SetDialogMode(DialogModeType t) = 0;
77 /// Puts the executer in "no error" mode,
78 /// Errors do not stop execution (but warnings are produced)
79 virtual void SetNoErrorMode(bool b) = 0;
80 virtual bool GetNoErrorMode() const = 0;
81 //=================================================================
83 virtual void LoadPackage(const std::string &name ) = 0;
86 virtual void UnLoadPackage(const std::string &name ) = 0;
88 /// Starts a package block
89 virtual void BeginPackage (const std::string &name ) = 0;
91 /// Ends a package block
92 virtual void EndPackage () = 0;
94 /// Starts the definition of a new ComplexBlackBox in package pack
95 /// scriptfilename is the file from which the def is read
96 virtual void Define (const std::string &name,
97 const std::string& pack,
98 const std::string &scriptfilename) = 0;
100 /// Sets the file name to use for the current definition
101 /// (Used to set it after the Define command)
102 virtual void SetCurrentFileName (const std::string &name ) = 0;
104 /// End the definition of a ComplexBlackBox
105 virtual void EndDefine () = 0;
107 /// Sets the kind of the currently defined ComplexBlackBox
108 virtual void Kind(const std::string& kind) = 0;
110 /// Creates a new black box in current complex box
111 virtual void Create ( const std::string& boxType, const std::string&
114 /// Destroys a black box
115 virtual void Destroy (const std::string &boxName) = 0;
117 /// Connects the output boxOutput to the input boxInput
118 virtual void Connect (const std::string &boxfrom,
119 const std::string &output,
120 const std::string &boxto,
121 const std::string &input) = 0;
124 virtual void Execute (const std::string &box) = 0;
126 /// Defines an input of the current complex box
127 virtual void DefineInput (const std::string &name,
128 const std::string &box,
129 const std::string &input,
130 const std::string &help) = 0;
132 /// Defines an output of the current complex box
133 virtual void DefineOutput (const std::string &name,
134 const std::string &box,
135 const std::string &output,
136 const std::string &help) = 0;
138 /// sets the input of the box with the value
139 virtual void Set (const std::string &box,
140 const std::string &input,
141 const std::string &value) = 0;
143 /// gets the output of the box
144 virtual std::string Get (const std::string &box,
145 const std::string &output) = 0;
147 /// changes the workspace name
148 virtual void SetWorkspaceName( const std::string& n ) = 0;
150 ///Adds the authorName to the Box author list
151 virtual void Author(const std::string &authorName) = 0;
153 ///Adds the categories to the Box categoris list
154 virtual void Category(const std::string &categories) = 0;
156 /// The description string which explains what does the ComplexBox
157 virtual void Description(const std::string &d) = 0;
159 /// prints the list off the boxes of the current box
160 virtual void PrintBoxes() = 0;
162 /// Generate a HTML with a gif file with the actual pipeline (Graphviz-dot needed). Returns the file path
163 virtual std::string ShowGraph(const std::string &nameblackbox,
164 const std::string &detailStr,
165 const std::string &levelStr,
166 const std::string &output_file,
167 const std::string &custom_header,
168 const std::string &custom_title,
169 bool system_display = true) = 0;
171 /// Generate a HTML with a gif file with the actual pipeline (Graphviz-dot needed). Returns the file path
172 virtual std::string ShowGraphInstances(const std::string &nameblackbox, int detail, int level, bool system_display=true) = 0;
174 /// Description of the actual pipeline
175 virtual void ShowRelations(const std::string &nameblackbox, const std::string &detailStr, const std::string &levelStr) = 0;
177 virtual void Reset() = 0;
179 /// Sets the level of message for kind
180 virtual void SetMessageLevel(const std::string &kind, int level) = 0;
182 /// Prints help on the messages
183 virtual void HelpMessages() = 0;
185 /// Prints the string ... MORE : TO EXPLAIN
186 virtual void Print(const std::string & message) = 0;
188 virtual ComplexBlackBoxDescriptor::Pointer GetWorkspace()
189 { return ComplexBlackBoxDescriptor::Pointer(); }
191 // static const std::string& GetObjectDescription() = 0;
192 // { static std::string s("VirtualExec"); return s; }
197 /// The interpreter which uses it (0 if none)
198 InterpreterWeakPointer mInterpreter;