VTK  9.3.20240329
vtkExecutive.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
47 #ifndef vtkExecutive_h
48 #define vtkExecutive_h
49 
50 #include "vtkCommonExecutionModelModule.h" // For export macro
51 #include "vtkObject.h"
52 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
53 
54 VTK_ABI_NAMESPACE_BEGIN
55 class vtkAlgorithm;
56 class vtkAlgorithmOutput;
57 class vtkAlgorithmToExecutiveFriendship;
58 class vtkDataObject;
59 class vtkExecutiveInternals;
60 class vtkInformation;
67 
68 class VTKCOMMONEXECUTIONMODEL_EXPORT VTK_MARSHALAUTO vtkExecutive : public vtkObject
69 {
70 public:
71  vtkTypeMacro(vtkExecutive, vtkObject);
72  void PrintSelf(ostream& os, vtkIndent indent) override;
73 
78 
84  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo);
85 
98  virtual int ComputePipelineMTime(vtkInformation* request, vtkInformationVector** inInfoVec,
99  vtkInformationVector* outInfoVec, int requestFromOutputPort, vtkMTimeType* mtime);
100 
104  virtual int UpdateInformation() { return 1; }
105 
107 
111  virtual vtkTypeBool Update();
112  virtual vtkTypeBool Update(int port);
114 
116 
123 
128 
133 
138 
142  vtkInformation* GetInputInformation(int port, int connection);
143 
148 
153 
157  vtkExecutive* GetInputExecutive(int port, int connection);
158 
160 
165  virtual void SetOutputData(int port, vtkDataObject*);
167 
169 
172  virtual vtkDataObject* GetInputData(int port, int connection);
173  virtual vtkDataObject* GetInputData(int port, int connection, vtkInformationVector** inInfoVec);
175 
184 
195 
197 
200  bool UsesGarbageCollector() const override { return true; }
202 
208 
214 
220 
222 
232 
233  enum
234  {
236  RequestDownstream
237  };
238  enum
239  {
241  AfterForward
242  };
243 
248  virtual int CallAlgorithm(vtkInformation* request, int direction, vtkInformationVector** inInfo,
249  vtkInformationVector* outInfo);
250 
251 protected:
253  ~vtkExecutive() override;
254 
255  // Helper methods for subclasses.
256  int InputPortIndexInRange(int port, const char* action);
257  int OutputPortIndexInRange(int port, const char* action);
258 
259  // Called by methods to check for a recursive pipeline update. A
260  // request should be fulfilled without making another request. This
261  // is used to help enforce that behavior. Returns 1 if no recursive
262  // request is occurring, and 0 otherwise. An error message is
263  // produced automatically if 0 is returned. The first argument is
264  // the name of the calling method (the one that should not be
265  // invoked recursively during an update). The second argument is
266  // the recursive request information object, if any. It is used to
267  // construct the error message.
268  int CheckAlgorithm(const char* method, vtkInformation* request);
269 
275 
276  virtual int ForwardDownstream(vtkInformation* request);
277  virtual int ForwardUpstream(vtkInformation* request);
278  virtual void CopyDefaultInformation(vtkInformation* request, int direction,
279  vtkInformationVector** inInfo, vtkInformationVector* outInfo);
280 
281  // Reset the pipeline update values in the given output information object.
283 
284  // Bring the existence of output data objects up to date.
285  virtual int UpdateDataObject() = 0;
286 
287  // Garbage collection support.
289 
290  virtual void SetAlgorithm(vtkAlgorithm* algorithm);
291 
292  // The algorithm managed by this executive.
294 
295  // Flag set when the algorithm is processing a request.
297 
298  // Pointers to an outside instance of input or output information.
299  // No references are held. These are used to implement internal
300  // pipelines.
303 
304 private:
305  // Store an information object for each output port of the algorithm.
306  vtkInformationVector* OutputInformation;
307 
308  // Internal implementation details.
309  vtkExecutiveInternals* ExecutiveInternal;
310 
311  friend class vtkAlgorithmToExecutiveFriendship;
312 
313  vtkExecutive(const vtkExecutive&) = delete;
314  void operator=(const vtkExecutive&) = delete;
315 };
316 
317 VTK_ABI_NAMESPACE_END
318 #endif
Proxy object to connect input/output ports.
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:162
general representation of visualization data
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:69
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.
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.
virtual int ForwardUpstream(vtkInformation *request)
static vtkInformationKeyVectorKey * KEYS_TO_COPY()
Keys to program vtkExecutive::ProcessRequest with the default behavior for unknown requests.
void ReportReferences(vtkGarbageCollector *) override
virtual vtkDataObject * GetInputData(int port, int connection)
Get the data object for an input port of the algorithm.
~vtkExecutive() override
virtual int UpdateDataObject()=0
vtkInformationVector ** SharedInputInformation
Definition: vtkExecutive.h:301
vtkAlgorithm * Algorithm
Definition: vtkExecutive.h:293
static vtkInformationIntegerKey * FROM_OUTPUT_PORT()
Information key to store the output port number from which a request is made.
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.
bool CheckAbortedInput(vtkInformationVector **inInfoVec)
Checks to see if an inputs have ABORTED set.
vtkAlgorithm * GetAlgorithm()
Get the algorithm to which this executive has been assigned.
void SetSharedOutputInformation(vtkInformationVector *outInfoVec)
Get the output port that produces the given data object.
virtual void SetAlgorithm(vtkAlgorithm *algorithm)
bool UsesGarbageCollector() const override
Participate in garbage collection.
Definition: vtkExecutive.h:200
static vtkInformationIntegerKey * ALGORITHM_AFTER_FORWARD()
Keys to program vtkExecutive::ProcessRequest with the default behavior for unknown requests.
static vtkInformationIntegerKey * ALGORITHM_DIRECTION()
Keys to program vtkExecutive::ProcessRequest with the default behavior for unknown requests.
vtkInformationVector * GetInputInformation(int port)
Get the pipeline information vectors for the given input port.
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.
virtual void ResetPipelineInformation(int port, vtkInformation *)=0
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)
Get/Set the data object for an output port of the algorithm.
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()
Keys to program vtkExecutive::ProcessRequest with the default behavior for unknown requests.
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.
virtual int UpdateInformation()
Bring the output information up to date.
Definition: vtkExecutive.h:104
vtkInformationVector * SharedOutputInformation
Definition: vtkExecutive.h:302
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.
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)
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)
Get the data object for an input port of the algorithm.
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:108
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: vtkObject.h:162
@ info
Definition: vtkX3D.h:376
@ direction
Definition: vtkX3D.h:260
@ port
Definition: vtkX3D.h:447
int vtkTypeBool
Definition: vtkABI.h:64
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
#define VTK_MARSHALAUTO