VTK  9.7.1
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
18 #ifndef vtkExecutive_h
19 #define vtkExecutive_h
20 
21 #include "vtkCommonExecutionModelModule.h" // For export macro
22 #include "vtkObject.h"
23 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
24 
25 VTK_ABI_NAMESPACE_BEGIN
26 class vtkAlgorithm;
27 class vtkAlgorithmOutput;
28 class vtkAlgorithmToExecutiveFriendship;
29 class vtkDataObject;
30 class vtkExecutiveInternals;
31 class vtkInformation;
38 
39 class VTKCOMMONEXECUTIONMODEL_EXPORT VTK_MARSHALAUTO vtkExecutive : public vtkObject
40 {
41 public:
42  vtkTypeMacro(vtkExecutive, vtkObject);
43  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
48  vtkAlgorithm* GetAlgorithm();
49 
54  virtual vtkTypeBool ProcessRequest(
55  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo);
56 
69  virtual int ComputePipelineMTime(vtkInformation* request, vtkInformationVector** inInfoVec,
70  vtkInformationVector* outInfoVec, int requestFromOutputPort, vtkMTimeType* mtime);
71 
75  virtual int UpdateInformation() { return 1; }
76 
78 
82  virtual vtkTypeBool Update();
83  virtual vtkTypeBool Update(int port);
85 
87 
91  int GetNumberOfInputPorts();
92  int GetNumberOfOutputPorts();
94 
98  int GetNumberOfInputConnections(int port);
99 
103  virtual vtkInformation* GetOutputInformation(int port);
104 
108  vtkInformationVector* GetOutputInformation();
109 
113  vtkInformation* GetInputInformation(int port, int connection);
114 
118  vtkInformationVector* GetInputInformation(int port);
119 
123  vtkInformationVector** GetInputInformation();
124 
128  vtkExecutive* GetInputExecutive(int port, int connection);
129 
131 
134  virtual vtkDataObject* GetOutputData(int port);
135  virtual void SetOutputData(int port, vtkDataObject*, vtkInformation* info);
136  virtual void SetOutputData(int port, vtkDataObject*);
138 
140 
143  virtual vtkDataObject* GetInputData(int port, int connection);
144  virtual vtkDataObject* GetInputData(int port, int connection, vtkInformationVector** inInfoVec);
146 
154 
163  void SetSharedInputInformation(vtkInformationVector** inInfoVec);
164  void SetSharedOutputInformation(vtkInformationVector* outInfoVec);
166 
168 
171  bool UsesGarbageCollector() const override { return true; }
173 
179  static vtkInformationExecutivePortKey* PRODUCER();
180 
186  static vtkInformationExecutivePortVectorKey* CONSUMERS();
187 
193  static vtkInformationIntegerKey* FROM_OUTPUT_PORT();
194 
196 
201  static vtkInformationIntegerKey* ALGORITHM_BEFORE_FORWARD();
202  static vtkInformationIntegerKey* ALGORITHM_AFTER_FORWARD();
203  static vtkInformationIntegerKey* ALGORITHM_DIRECTION();
204  static vtkInformationIntegerKey* FORWARD_DIRECTION();
205  static vtkInformationKeyVectorKey* KEYS_TO_COPY();
207 
208  enum
209  {
211  RequestDownstream
212  };
213  enum
214  {
216  AfterForward
217  };
218 
223  virtual int CallAlgorithm(vtkInformation* request, int direction, vtkInformationVector** inInfo,
224  vtkInformationVector* outInfo);
225 
226 protected:
227  vtkExecutive();
228  ~vtkExecutive() override;
229 
230  // Helper methods for subclasses.
231  int InputPortIndexInRange(int port, const char* action);
232  int OutputPortIndexInRange(int port, const char* action);
233 
234  // Called by methods to check for a recursive pipeline update. A
235  // request should be fulfilled without making another request. This
236  // is used to help enforce that behavior. Returns 1 if no recursive
237  // request is occurring, and 0 otherwise. An error message is
238  // produced automatically if 0 is returned. The first argument is
239  // the name of the calling method (the one that should not be
240  // invoked recursively during an update). The second argument is
241  // the recursive request information object, if any. It is used to
242  // construct the error message.
243  int CheckAlgorithm(const char* method, vtkInformation* request);
244 
249  bool CheckAbortedInput(vtkInformationVector** inInfoVec);
250 
251  virtual int ForwardDownstream(vtkInformation* request);
252  virtual int ForwardUpstream(vtkInformation* request);
253  virtual void CopyDefaultInformation(vtkInformation* request, int direction,
254  vtkInformationVector** inInfo, vtkInformationVector* outInfo);
255 
256  // Reset the pipeline update values in the given output information object.
257  virtual void ResetPipelineInformation(int port, vtkInformation*) = 0;
258 
259  // Bring the existence of output data objects up to date.
260  virtual int UpdateDataObject() = 0;
261 
262  // Garbage collection support.
263  void ReportReferences(vtkGarbageCollector*) override;
264 
265  virtual void SetAlgorithm(vtkAlgorithm* algorithm);
266 
267  // The algorithm managed by this executive.
269 
270  // Flag set when the algorithm is processing a request.
272 
273  // Pointers to an outside instance of input or output information.
274  // No references are held. These are used to implement internal
275  // pipelines.
278 
279 private:
280  // Store an information object for each output port of the algorithm.
281  vtkInformationVector* OutputInformation;
282 
283  // Internal implementation details.
284  vtkExecutiveInternals* ExecutiveInternal;
285 
286  friend class vtkAlgorithmToExecutiveFriendship;
287 
288  vtkExecutive(const vtkExecutive&) = delete;
289  void operator=(const vtkExecutive&) = delete;
290 };
291 
292 VTK_ABI_NAMESPACE_END
293 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:52
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:318
virtual int UpdateInformation()
Bring the output information up to date.
Definition: vtkExecutive.h:75
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:39
Detect and break reference loops.
bool UsesGarbageCollector() const override
Participate in garbage collection.
Definition: vtkExecutive.h:171
Proxy object to connect input/output ports.
int vtkTypeBool
Definition: vtkABI.h:64
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:53
vtkInformationVector * SharedOutputInformation
Definition: vtkExecutive.h:277
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual void ReportReferences(vtkGarbageCollector *)
Key for pointer to pointer.
Key for integer values in vtkInformation.
Key for vector-of-keys values.
Key for vtkExecutive/Port value pair vectors.
Store zero or more vtkInformation instances.
#define VTK_MARSHALAUTO
vtkInformationVector ** SharedInputInformation
Definition: vtkExecutive.h:276
vtkAlgorithm * Algorithm
Definition: vtkExecutive.h:268
general representation of visualization data
Definition: vtkDataObject.h:55
Key for vtkExecutive/Port value pairs.