1 /*=========================================================================
4 Module: $RCSfile: bbtkVirtualExec.h,v $ $
6 Date: $Date: 2008/02/06 09:27:52 $
7 Version: $Revision: 1.7 $
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
51 /// Sets the inputs of the workspace :
52 virtual void SetInputs(const std::map<std::string,std::string>& m) = 0;
54 /// Puts the executer in "no exec" mode,
55 /// which creates but does not execute pipelines
56 virtual void SetNoExecMode(bool b) = 0;
58 virtual bool GetNoExecMode() const = 0;
60 /// Sets the mode of dialog of the executer for Root inputs
61 virtual void SetDialogMode(DialogModeType t) = 0;
63 /// Starts a package block
64 virtual void BeginPackage (const std::string &name ) = 0;
66 /// Ends a package block
67 virtual void EndPackage () = 0;
69 /// Starts the definition of a new ComplexBlackBox in package pack
70 /// scriptfilename is the file from which the def is read
71 virtual void Define (const std::string &name,
72 const std::string& pack,
73 const std::string &scriptfilename) = 0;
75 /// Sets the file name to use for the current definition
76 /// (Used to set it after the Define command)
77 virtual void SetCurrentFileName (const std::string &name ) = 0;
79 /// End the definition of a ComplexBlackBox
80 virtual void EndDefine () = 0;
82 /// Creates a new black box in current complex box
83 virtual void Create ( const std::string& boxType, const std::string&
86 /// Destroys a black box
87 //virtual void Destroy (const std::string &boxName) = 0;
89 /// Connects the output boxOutput to the input boxInput
90 virtual void Connect (const std::string &boxfrom,
91 const std::string &output,
92 const std::string &boxto,
93 const std::string &input) = 0;
96 /// would 'Execute' be more meaningfull ?
97 virtual void Update (const std::string &box) = 0;
99 /// Defines an input of the current complex box
100 virtual void DefineInput (const std::string &name,
101 const std::string &box,
102 const std::string &input,
103 const std::string &help) = 0;
105 /// Defines an output of the current complex box
106 virtual void DefineOutput (const std::string &name,
107 const std::string &box,
108 const std::string &output,
109 const std::string &help) = 0;
111 /// sets the input of the box with the value
112 virtual void Set (const std::string &box,
113 const std::string &input,
114 const std::string &value) = 0;
116 /// gets the output of the box
117 virtual std::string Get (const std::string &box,
118 const std::string &output) = 0;
120 /// changes the workspace name
121 virtual void SetWorkspaceName( const std::string& n ) = 0;
123 ///Adds the authorName to the Box author list
124 virtual void Author(const std::string &authorName) = 0;
126 ///Adds the categories to the Box categoris list
127 virtual void Category(const std::string &categories) = 0;
129 /// The description string which explains what does the ComplexBox
130 virtual void Description(const std::string &d) = 0;
132 /// prints the list off the boxes of the current box
133 virtual void PrintBoxes() = 0;
135 /// Generate a HTML with a gif file with the actual pipeline (Graphviz-dot needed). Returns the file path
136 virtual std::string ShowGraph(const std::string &nameblackbox,
137 const std::string &detailStr,
138 const std::string &levelStr,
139 const std::string &output_file,
140 const std::string &custom_header,
141 const std::string &custom_title,
142 bool system_display = true) = 0;
144 /// Generate a HTML with a gif file with the actual pipeline (Graphviz-dot needed). Returns the file path
145 virtual std::string ShowGraphInstances(const std::string &nameblackbox, int detail, int level, bool system_display=true) = 0;
147 /// Description of the actual pipeline
148 virtual void ShowRelations(const std::string &nameblackbox, const std::string &detailStr, const std::string &levelStr) = 0;
150 virtual void Reset() = 0;
153 // static const std::string& GetObjectDescription() = 0;
154 // { static std::string s("VirtualExec"); return s; }
159 /// Gets the current working black box
160 virtual ComplexBlackBoxDescriptor* Current() = 0;
162 /// Returns true when we are inside a define/endefine block
163 // virtual bool InDefinitionBlock() = 0;
165 //==================================================================
169 // Factory* mFactory;
174 /// The root ComplexBlackBox, in which operations are done when outside a define/endefine block
175 /// Its name in bbi is 'workspace'
176 ComplexBlackBoxDescriptor* mRoot;
178 /// Struct that stores info on user defined complex black boxes
181 ComplexBlackBoxDescriptor* box;
183 CBBDefinition(ComplexBlackBoxDescriptor* d, const std::string& p )
184 : box(d), package(p) {}
187 /// The stack of current working ComplexBlackBox
188 /// (is a stack for nested definitions)
189 /// only contains the root when outside a define/endefine block
190 std::deque<CBBDefinition> mOpenDefinition;
192 /// The stack of current working package
193 /// (is a stack for nested definitions)
194 std::deque<Package*> mOpenPackage;
196 /// flag which is true when we are inside a Define/EndDefine block
199 /// The input values of the Root ComplexBlackBox
200 std::map<std::string,std::string> mInputs;
202 /// no exec mode flag
206 DialogModeType mDialogMode;