1 /*=========================================================================
4 Module: $RCSfile: bbtkVirtualExec.h,v $ $
6 Date: $Date: 2008/01/28 15:08:53 $
7 Version: $Revision: 1.3 $
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 "bbtkComplexBlackBox.h"
32 #include "bbtkFactory.h"
39 class /*BBTK_EXPORT*/ VirtualExec // All methods are pure virtual
56 // void SetFactory(Factory* f);
59 virtual ~VirtualExec() = 0;
61 /// Sets the inputs of the workspace :
62 virtual void SetInputs(const std::map<std::string,std::string>& m) = 0;
64 /// Puts the executer in "no exec" mode,
65 /// which creates but does not execute pipelines
66 virtual void SetNoExecMode(bool b) = 0;
68 virtual bool GetNoExecMode() const = 0;
70 /// Sets the mode of dialog of the executer for Root inputs
71 virtual void SetDialogMode(DialogModeType t) = 0;
73 /// Starts a package block
74 virtual void BeginPackage (const std::string &name ) = 0;
76 /// Ends a package block
77 virtual void EndPackage () = 0;
79 /// Starts the definition of a new ComplexBlackBox in package pack
80 /// scriptfilename is the file from which the def is read
81 virtual void Define (const std::string &name,
82 const std::string& pack,
83 const std::string &scriptfilename) = 0;
85 /// End the definition of a ComplexBlackBox
86 virtual void EndDefine () = 0;
88 /// Creates a new black box in current complex box
89 virtual void Create ( const std::string& boxType, const std::string&
92 /// Destroys a black box
93 //virtual void Destroy (const std::string &boxName) = 0;
95 /// Connects the output boxOutput to the input boxInput
96 virtual void Connect (const std::string &boxfrom,
97 const std::string &output,
98 const std::string &boxto,
99 const std::string &input) = 0;
102 /// would 'Execute' be more meaningfull ?
103 virtual void Update (const std::string &box) = 0;
105 /// Defines an input of the current complex box
106 virtual void DefineInput (const std::string &name,
107 const std::string &box,
108 const std::string &input,
109 const std::string &help) = 0;
111 /// Defines an output of the current complex box
112 virtual void DefineOutput (const std::string &name,
113 const std::string &box,
114 const std::string &output,
115 const std::string &help) = 0;
117 /// sets the input of the box with the value
118 virtual void Set (const std::string &box,
119 const std::string &input,
120 const std::string &value) = 0;
122 /// gets the output of the box
123 virtual std::string Get (const std::string &box,
124 const std::string &output) = 0;
126 /// changes the workspace name
127 virtual void SetWorkspaceName( const std::string& n ) = 0;
129 ///Adds the authorName to the Box's author list
130 virtual void Author(const std::string &authorName) = 0;
132 /// The description string which explains what does the ComplexBox
133 virtual void Description(const std::string & d) = 0;
135 /// prints the list off the boxes of the current box
136 virtual void PrintBoxes() = 0;
138 /// Generate a HTML with a gif file with the actual pipeline (Graphviz-dot needed). Returns the file path
139 virtual std::string ShowGraph(const std::string &nameblackbox,
140 const std::string &detailStr,
141 const std::string &levelStr,
142 const std::string &output_file,
143 const std::string &custom_header,
144 const std::string &custom_title,
145 bool system_display = true) = 0;
147 /// Generate a HTML with a gif file with the actual pipeline (Graphviz-dot needed). Returns the file path
148 virtual std::string ShowGraphInstances(const std::string &nameblackbox, int detail, int level, bool system_display=true) = 0;
150 /// Description of the actual pipeline
151 virtual void ShowRelations(const std::string &nameblackbox, const std::string &detailStr, const std::string &levelStr) = 0;
153 virtual void Reset() = 0;
155 // static const std::string& GetObjectDescription() = 0;
156 // { static std::string s("VirtualExec"); return s; }
162 /// Gets the current working black box
163 virtual ComplexBlackBoxDescriptor* Current() = 0;
165 /// Returns true when we are inside a define/endefine block
166 // virtual bool InDefinitionBlock() = 0;
168 //==================================================================
172 // Factory* mFactory;
177 /// The root ComplexBlackBox, in which operations are done when outside a define/endefine block
178 /// Its name in bbi is 'workspace'
179 ComplexBlackBoxDescriptor* mRoot;
181 /// Struct that stores info on user defined complex black boxes
184 ComplexBlackBoxDescriptor* box;
186 CBBDefinition(ComplexBlackBoxDescriptor* d, const std::string& p )
187 : box(d), package(p) {}
190 /// The stack of current working ComplexBlackBox
191 /// (is a stack for nested definitions)
192 /// only contains the root when outside a define/endefine block
193 std::deque<CBBDefinition> mCurrent;
195 /// flag which is true when we are inside a Define/EndDefine block
198 /// The input values of the Root ComplexBlackBox
199 std::map<std::string,std::string> mInputs;
201 /// no exec mode flag
205 DialogModeType mDialogMode;