VTK  9.3.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 
24 VTK_ABI_NAMESPACE_BEGIN
25 class vtkAlgorithm;
26 class vtkAlgorithmOutput;
27 class vtkAlgorithmToExecutiveFriendship;
28 class vtkDataObject;
29 class vtkExecutiveInternals;
30 class vtkInformation;
37 
38 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkExecutive : public vtkObject
39 {
40 public:
41  vtkTypeMacro(vtkExecutive, vtkObject);
42  void PrintSelf(ostream& os, vtkIndent indent) override;
43 
47  vtkAlgorithm* GetAlgorithm();
48 
53  virtual vtkTypeBool ProcessRequest(
54  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo);
55 
68  virtual int ComputePipelineMTime(vtkInformation* request, vtkInformationVector** inInfoVec,
69  vtkInformationVector* outInfoVec, int requestFromOutputPort, vtkMTimeType* mtime);
70 
74  virtual int UpdateInformation() { return 1; }
75 
77 
81  virtual vtkTypeBool Update();
82  virtual vtkTypeBool Update(int port);
84 
86 
90  int GetNumberOfInputPorts();
91  int GetNumberOfOutputPorts();
93 
97  int GetNumberOfInputConnections(int port);
98 
102  virtual vtkInformation* GetOutputInformation(int port);
103 
107  vtkInformationVector* GetOutputInformation();
108 
112  vtkInformation* GetInputInformation(int port, int connection);
113 
117  vtkInformationVector* GetInputInformation(int port);
118 
122  vtkInformationVector** GetInputInformation();
123 
127  vtkExecutive* GetInputExecutive(int port, int connection);
128 
130 
133  virtual vtkDataObject* GetOutputData(int port);
134  virtual void SetOutputData(int port, vtkDataObject*, vtkInformation* info);
135  virtual void SetOutputData(int port, vtkDataObject*);
137 
139 
142  virtual vtkDataObject* GetInputData(int port, int connection);
143  virtual vtkDataObject* GetInputData(int port, int connection, vtkInformationVector** inInfoVec);
145 
153 
162  void SetSharedInputInformation(vtkInformationVector** inInfoVec);
163  void SetSharedOutputInformation(vtkInformationVector* outInfoVec);
165 
167 
170  bool UsesGarbageCollector() const override { return true; }
172 
177  static vtkInformationExecutivePortKey* PRODUCER();
178 
183  static vtkInformationExecutivePortVectorKey* CONSUMERS();
184 
189  static vtkInformationIntegerKey* FROM_OUTPUT_PORT();
190 
192 
196  static vtkInformationIntegerKey* ALGORITHM_BEFORE_FORWARD();
197  static vtkInformationIntegerKey* ALGORITHM_AFTER_FORWARD();
198  static vtkInformationIntegerKey* ALGORITHM_DIRECTION();
199  static vtkInformationIntegerKey* FORWARD_DIRECTION();
200  static vtkInformationKeyVectorKey* KEYS_TO_COPY();
202 
203  enum
204  {
206  RequestDownstream
207  };
208  enum
209  {
211  AfterForward
212  };
213 
218  virtual int CallAlgorithm(vtkInformation* request, int direction, vtkInformationVector** inInfo,
219  vtkInformationVector* outInfo);
220 
221 protected:
222  vtkExecutive();
223  ~vtkExecutive() override;
224 
225  // Helper methods for subclasses.
226  int InputPortIndexInRange(int port, const char* action);
227  int OutputPortIndexInRange(int port, const char* action);
228 
229  // Called by methods to check for a recursive pipeline update. A
230  // request should be fulfilled without making another request. This
231  // is used to help enforce that behavior. Returns 1 if no recursive
232  // request is occurring, and 0 otherwise. An error message is
233  // produced automatically if 0 is returned. The first argument is
234  // the name of the calling method (the one that should not be
235  // invoked recursively during an update). The second argument is
236  // the recursive request information object, if any. It is used to
237  // construct the error message.
238  int CheckAlgorithm(const char* method, vtkInformation* request);
239 
244  bool CheckAbortedInput(vtkInformationVector** inInfoVec);
245 
246  virtual int ForwardDownstream(vtkInformation* request);
247  virtual int ForwardUpstream(vtkInformation* request);
248  virtual void CopyDefaultInformation(vtkInformation* request, int direction,
249  vtkInformationVector** inInfo, vtkInformationVector* outInfo);
250 
251  // Reset the pipeline update values in the given output information object.
252  virtual void ResetPipelineInformation(int port, vtkInformation*) = 0;
253 
254  // Bring the existence of output data objects up to date.
255  virtual int UpdateDataObject() = 0;
256 
257  // Garbage collection support.
258  void ReportReferences(vtkGarbageCollector*) override;
259 
260  virtual void SetAlgorithm(vtkAlgorithm* algorithm);
261 
262  // The algorithm managed by this executive.
264 
265  // Flag set when the algorithm is processing a request.
267 
268  // Pointers to an outside instance of input or output information.
269  // No references are held. These are used to implement internal
270  // pipelines.
273 
274 private:
275  // Store an information object for each output port of the algorithm.
276  vtkInformationVector* OutputInformation;
277 
278  // Internal implementation details.
279  vtkExecutiveInternals* ExecutiveInternal;
280 
281  friend class vtkAlgorithmToExecutiveFriendship;
282 
283  vtkExecutive(const vtkExecutive&) = delete;
284  void operator=(const vtkExecutive&) = delete;
285 };
286 
287 VTK_ABI_NAMESPACE_END
288 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:51
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:270
virtual int UpdateInformation()
Bring the output information up to date.
Definition: vtkExecutive.h:74
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:38
Detect and break reference loops.
bool UsesGarbageCollector() const override
Participate in garbage collection.
Definition: vtkExecutive.h:170
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:51
vtkInformationVector * SharedOutputInformation
Definition: vtkExecutive.h:272
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.
vtkInformationVector ** SharedInputInformation
Definition: vtkExecutive.h:271
vtkAlgorithm * Algorithm
Definition: vtkExecutive.h:263
general representation of visualization data
Definition: vtkDataObject.h:54
Key for vtkExecutive/Port value pairs.