VTK  9.1.0
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=========================================================================*/
36#ifndef vtkExecutive_h
37#define vtkExecutive_h
38
39#include "vtkCommonExecutionModelModule.h" // For export macro
40#include "vtkObject.h"
41
42class vtkAlgorithm;
44class vtkAlgorithmToExecutiveFriendship;
45class vtkDataObject;
46class vtkExecutiveInternals;
47class vtkInformation;
54
55class VTKCOMMONEXECUTIONMODEL_EXPORT vtkExecutive : public vtkObject
56{
57public:
58 vtkTypeMacro(vtkExecutive, vtkObject);
59 void PrintSelf(ostream& os, vtkIndent indent) override;
60
65
71 vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo);
72
85 virtual int ComputePipelineMTime(vtkInformation* request, vtkInformationVector** inInfoVec,
86 vtkInformationVector* outInfoVec, int requestFromOutputPort, vtkMTimeType* mtime);
87
91 virtual int UpdateInformation() { return 1; }
92
94
99 virtual vtkTypeBool Update(int port);
101
103
110
115
120
125
130
135
140
144 vtkExecutive* GetInputExecutive(int port, int connection);
145
147
152 virtual void SetOutputData(int port, vtkDataObject*);
154
156
159 virtual vtkDataObject* GetInputData(int port, int connection);
160 virtual vtkDataObject* GetInputData(int port, int connection, vtkInformationVector** inInfoVec);
162
171
182
184
187 void Register(vtkObjectBase* o) override;
188 void UnRegister(vtkObjectBase* o) override;
190
196
202
208
210
220
221 enum
222 {
224 RequestDownstream
225 };
226 enum
227 {
229 AfterForward
230 };
231
236 virtual int CallAlgorithm(vtkInformation* request, int direction, vtkInformationVector** inInfo,
237 vtkInformationVector* outInfo);
238
239protected:
241 ~vtkExecutive() override;
242
243 // Helper methods for subclasses.
244 int InputPortIndexInRange(int port, const char* action);
245 int OutputPortIndexInRange(int port, const char* action);
246
247 // Called by methods to check for a recursive pipeline update. A
248 // request should be fulfilled without making another request. This
249 // is used to help enforce that behavior. Returns 1 if no recursive
250 // request is occurring, and 0 otherwise. An error message is
251 // produced automatically if 0 is returned. The first argument is
252 // the name of the calling method (the one that should not be
253 // invoked recursively during an update). The second argument is
254 // the recursive request information object, if any. It is used to
255 // construct the error message.
256 int CheckAlgorithm(const char* method, vtkInformation* request);
257
258 virtual int ForwardDownstream(vtkInformation* request);
259 virtual int ForwardUpstream(vtkInformation* request);
261 vtkInformationVector** inInfo, vtkInformationVector* outInfo);
262
263 // Reset the pipeline update values in the given output information object.
265
266 // Bring the existence of output data objects up to date.
267 virtual int UpdateDataObject() = 0;
268
269 // Garbage collection support.
271
272 virtual void SetAlgorithm(vtkAlgorithm* algorithm);
273
274 // The algorithm managed by this executive.
276
277 // Flag set when the algorithm is processing a request.
279
280 // Pointers to an outside instance of input or output information.
281 // No references are held. These are used to implement internal
282 // pipelines.
285
286private:
287 // Store an information object for each output port of the algorithm.
288 vtkInformationVector* OutputInformation;
289
290 // Internal implementation details.
291 vtkExecutiveInternals* ExecutiveInternal;
292
293 friend class vtkAlgorithmToExecutiveFriendship;
294
295private:
296 vtkExecutive(const vtkExecutive&) = delete;
297 void operator=(const vtkExecutive&) = delete;
298};
299
300#endif
Proxy object to connect input/output ports.
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:64
general representation of visualization data
Definition: vtkDataObject.h:69
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:56
int CheckAlgorithm(const char *method, vtkInformation *request)
virtual int ForwardDownstream(vtkInformation *request)
virtual vtkTypeBool Update()
Bring the algorithm's outputs up-to-date.
virtual vtkTypeBool Update(int port)
Bring the algorithm's outputs up-to-date.
virtual int ForwardUpstream(vtkInformation *request)
vtkInformationVector * GetOutputInformation()
Get the pipeline information object for all output ports.
void ReportReferences(vtkGarbageCollector *) override
static vtkInformationKeyVectorKey * KEYS_TO_COPY()
Keys to program vtkExecutive::ProcessRequest with the default behavior for unknown requests.
~vtkExecutive() override
virtual int UpdateDataObject()=0
vtkInformationVector ** SharedInputInformation
Definition: vtkExecutive.h:283
vtkExecutive * GetInputExecutive(int port, int connection)
Get the executive managing the given input connection.
void UnRegister(vtkObjectBase *o) override
Participate in garbage collection.
vtkAlgorithm * Algorithm
Definition: vtkExecutive.h:275
virtual vtkTypeBool ProcessRequest(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo)
Generalized interface for asking the executive to fulfill pipeline requests.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkInformationIntegerKey * ALGORITHM_BEFORE_FORWARD()
Keys to program vtkExecutive::ProcessRequest with the default behavior for unknown requests.
virtual vtkDataObject * GetInputData(int port, int connection, vtkInformationVector **inInfoVec)
Get the data object for an input port of the algorithm.
static vtkInformationIntegerKey * FROM_OUTPUT_PORT()
Information key to store the output port number from which a request is made.
void SetSharedOutputInformation(vtkInformationVector *outInfoVec)
Get the output port that produces the given data object.
virtual void SetAlgorithm(vtkAlgorithm *algorithm)
vtkInformation * GetInputInformation(int port, int connection)
Get the pipeline information for the given input connection.
static vtkInformationIntegerKey * ALGORITHM_AFTER_FORWARD()
Keys to program vtkExecutive::ProcessRequest with the default behavior for unknown requests.
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.
static vtkInformationIntegerKey * FORWARD_DIRECTION()
Keys to program vtkExecutive::ProcessRequest with the default behavior for unknown requests.
virtual void ResetPipelineInformation(int port, vtkInformation *)=0
vtkInformationVector * GetInputInformation(int port)
Get the pipeline information vectors for the given input port.
virtual vtkInformation * GetOutputInformation(int port)
Get the pipeline information object for the given output port.
virtual vtkDataObject * GetInputData(int port, int connection)
Get the data object for an input port of the algorithm.
virtual void SetOutputData(int port, vtkDataObject *, vtkInformation *info)
Get/Set the data object for an output port of the algorithm.
int GetNumberOfInputPorts()
Get the number of input/output ports for the algorithm associated with this executive.
static vtkInformationExecutivePortKey * PRODUCER()
Information key to store the executive/port number producing an information object.
virtual vtkDataObject * GetOutputData(int port)
Get/Set the data object for an output port of the algorithm.
vtkAlgorithm * GetAlgorithm()
Get the algorithm to which this executive has been assigned.
void SetSharedInputInformation(vtkInformationVector **inInfoVec)
Get the output port that produces the given data object.
int OutputPortIndexInRange(int port, const char *action)
virtual void SetOutputData(int port, vtkDataObject *)
Get/Set the data object for an output port of the algorithm.
static vtkInformationExecutivePortVectorKey * CONSUMERS()
Information key to store the executive/port number pairs consuming an information object.
virtual int UpdateInformation()
Bring the output information up to date.
Definition: vtkExecutive.h:91
void Register(vtkObjectBase *o) override
Participate in garbage collection.
vtkInformationVector * SharedOutputInformation
Definition: vtkExecutive.h:284
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.
vtkInformationVector ** GetInputInformation()
Get the pipeline information vectors for all inputs.
virtual void CopyDefaultInformation(vtkInformation *request, int direction, vtkInformationVector **inInfo, vtkInformationVector *outInfo)
int GetNumberOfOutputPorts()
Get the number of input/output ports for the algorithm associated with this executive.
int InputPortIndexInRange(int port, const char *action)
static vtkInformationIntegerKey * ALGORITHM_DIRECTION()
Keys to program vtkExecutive::ProcessRequest with the default behavior for unknown requests.
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:43
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:79
abstract base class for most VTK objects
Definition: vtkObject.h:63
@ info
Definition: vtkX3D.h:382
@ direction
Definition: vtkX3D.h:266
@ port
Definition: vtkX3D.h:453
int vtkTypeBool
Definition: vtkABI.h:69
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287