VTK
vtkExecutive.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkExecutive.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
30 #ifndef vtkExecutive_h
31 #define vtkExecutive_h
32 
33 #include "vtkCommonExecutionModelModule.h" // For export macro
34 #include "vtkObject.h"
35 
36 class vtkAlgorithm;
37 class vtkAlgorithmOutput;
38 class vtkAlgorithmToExecutiveFriendship;
39 class vtkDataObject;
40 class vtkExecutiveInternals;
41 class vtkInformation;
48 
49 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkExecutive : public vtkObject
50 {
51 public:
52  vtkTypeMacro(vtkExecutive,vtkObject);
53  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
54 
59 
64  virtual int ProcessRequest(vtkInformation* request,
65  vtkInformationVector** inInfo,
66  vtkInformationVector* outInfo);
67 
80  virtual int
82  vtkInformationVector** inInfoVec,
83  vtkInformationVector* outInfoVec,
84  int requestFromOutputPort,
85  vtkMTimeType* mtime);
86 
90  virtual int UpdateInformation() {return 1;}
91 
93 
97  virtual int Update();
98  virtual int Update(int port);
100 
102 
109 
114 
119 
124 
128  vtkInformation* GetInputInformation(int port, int connection);
129 
134 
139 
143  vtkExecutive* GetInputExecutive(int port, int connection);
144 
146 
151  virtual void SetOutputData(int port, vtkDataObject*);
153 
155 
158  virtual vtkDataObject* GetInputData(int port, int connection);
159  virtual vtkDataObject* GetInputData(int port, int connection,
160  vtkInformationVector **inInfoVec);
162 
182 
184 
187  void Register(vtkObjectBase* o) VTK_OVERRIDE;
188  void UnRegister(vtkObjectBase* o) VTK_OVERRIDE;
190 
196 
202 
208 
210 
220 
221  enum { RequestUpstream, RequestDownstream };
222  enum { BeforeForward, AfterForward };
223 
228  virtual int CallAlgorithm(vtkInformation* request, int direction,
229  vtkInformationVector** inInfo,
230  vtkInformationVector* outInfo);
231 
232 protected:
234  ~vtkExecutive() VTK_OVERRIDE;
235 
236  // Helper methods for subclasses.
237  int InputPortIndexInRange(int port, const char* action);
238  int OutputPortIndexInRange(int port, const char* action);
239 
240  // Called by methods to check for a recursive pipeline update. A
241  // request should be fulfilled without making another request. This
242  // is used to help enforce that behavior. Returns 1 if no recursive
243  // request is occurring, and 0 otherwise. An error message is
244  // produced automatically if 0 is returned. The first argument is
245  // the name of the calling method (the one that should not be
246  // invoked recursively during an update). The second argument is
247  // the recursive request information object, if any. It is used to
248  // construct the error message.
249  int CheckAlgorithm(const char* method, vtkInformation* request);
250 
251  virtual int ForwardDownstream(vtkInformation* request);
252  virtual int ForwardUpstream(vtkInformation* request);
253  virtual void CopyDefaultInformation(vtkInformation* request, int direction,
254  vtkInformationVector** inInfo,
255  vtkInformationVector* outInfo);
256 
257  // Reset the pipeline update values in the given output information object.
258  virtual void ResetPipelineInformation(int port, vtkInformation*)=0;
259 
260  // Bring the existence of output data objects up to date.
261  virtual int UpdateDataObject()=0;
262 
263  // Garbage collection support.
264  void ReportReferences(vtkGarbageCollector*) VTK_OVERRIDE;
265 
266  virtual void SetAlgorithm(vtkAlgorithm* algorithm);
267 
268  // The algorithm managed by this executive.
269  vtkAlgorithm* Algorithm;
270 
271  // Flag set when the algorithm is processing a request.
272  int InAlgorithm;
273 
274  // Pointers to an outside instance of input or output information.
275  // No references are held. These are used to implement internal
276  // pipelines.
277  vtkInformationVector** SharedInputInformation;
278  vtkInformationVector* SharedOutputInformation;
279 
280 private:
281  // Store an information object for each output port of the algorithm.
282  vtkInformationVector* OutputInformation;
283 
284  // Internal implementation details.
285  vtkExecutiveInternals* ExecutiveInternal;
286 
287  friend class vtkAlgorithmToExecutiveFriendship;
288 
289 private:
290  vtkExecutive(const vtkExecutive&) VTK_DELETE_FUNCTION;
291  void operator=(const vtkExecutive&) VTK_DELETE_FUNCTION;
292 };
293 
294 #endif
Proxy object to connect input/output ports.
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:60
general representation of visualization data
Definition: vtkDataObject.h:65
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:50
vtkExecutive * GetInputExecutive(int port, int connection)
Get the executive managing the given input connection.
vtkInformationVector ** GetInputInformation()
Get the pipeline information vectors for all inputs.
static vtkInformationIntegerKey * ALGORITHM_BEFORE_FORWARD()
Keys to program vtkExecutive::ProcessRequest with the default behavior for unknown requests.
static vtkInformationKeyVectorKey * KEYS_TO_COPY()
virtual vtkDataObject * GetInputData(int port, int connection)
Get the data object for an input port of the algorithm.
~vtkExecutive() override
void UnRegister(vtkObjectBase *o) override
Decrease the reference count (release by another object).
static vtkInformationIntegerKey * FROM_OUTPUT_PORT()
Information key to store the output port number from which a request is made.
virtual int Update(int port)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkAlgorithm * GetAlgorithm()
Get the algorithm to which this executive has been assigned.
void SetSharedOutputInformation(vtkInformationVector *outInfoVec)
static vtkInformationIntegerKey * ALGORITHM_AFTER_FORWARD()
static vtkInformationIntegerKey * ALGORITHM_DIRECTION()
vtkInformationVector * GetInputInformation(int port)
Get the pipeline information vectors for the given input port.
virtual int Update()
Bring the algorithm's outputs up-to-date.
virtual int ComputePipelineMTime(vtkInformation *request, vtkInformationVector **inInfoVec, vtkInformationVector *outInfoVec, int requestFromOutputPort, vtkMTimeType *mtime)
A special version of ProcessRequest meant specifically for the pipeline modified time request.
vtkInformation * GetInputInformation(int port, int connection)
Get the pipeline information for the given input connection.
vtkInformationVector * GetOutputInformation()
Get the pipeline information object for all output ports.
virtual vtkInformation * GetOutputInformation(int port)
Get the pipeline information object for the given output port.
virtual void SetOutputData(int port, vtkDataObject *, vtkInformation *info)
static vtkInformationExecutivePortKey * PRODUCER()
Information key to store the executive/port number producing an information object.
int GetNumberOfInputPorts()
Get the number of input/output ports for the algorithm associated with this executive.
static vtkInformationIntegerKey * FORWARD_DIRECTION()
virtual int ProcessRequest(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo)
Generalized interface for asking the executive to fulfill pipeline requests.
void SetSharedInputInformation(vtkInformationVector **inInfoVec)
Get the output port that produces the given data object.
virtual void SetOutputData(int port, vtkDataObject *)
virtual int UpdateInformation()
Bring the output information up to date.
Definition: vtkExecutive.h:90
void Register(vtkObjectBase *o) override
Participate in garbage collection.
virtual int CallAlgorithm(vtkInformation *request, int direction, vtkInformationVector **inInfo, vtkInformationVector *outInfo)
An API to CallAlgorithm that allows you to pass in the info objects to be used.
int GetNumberOfOutputPorts()
virtual vtkDataObject * GetOutputData(int port)
Get/Set the data object for an output port of the algorithm.
virtual vtkDataObject * GetInputData(int port, int connection, vtkInformationVector **inInfoVec)
static vtkInformationExecutivePortVectorKey * CONSUMERS()
Information key to store the executive/port number pairs consuming an information object.
int GetNumberOfInputConnections(int port)
Get the number of input connections on the given port.
Detect and break reference loops.
a simple class to control print indentation
Definition: vtkIndent.h:40
Key for vtkExecutive/Port value pairs.
Key for vtkExecutive/Port value pair vectors.
Key for integer values in vtkInformation.
Key for vector-of-keys values.
Key for pointer to pointer.
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
abstract base class for most VTK objects
Definition: vtkObjectBase.h:66
abstract base class for most VTK objects
Definition: vtkObject.h:60
@ info
Definition: vtkX3D.h:376
@ direction
Definition: vtkX3D.h:260
@ port
Definition: vtkX3D.h:447
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248