VTK  9.2.6
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) override;
54 
58  vtkAlgorithm* GetAlgorithm();
59 
64  virtual vtkTypeBool ProcessRequest(
65  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo);
66 
79  virtual int ComputePipelineMTime(vtkInformation* request, vtkInformationVector** inInfoVec,
80  vtkInformationVector* outInfoVec, int requestFromOutputPort, vtkMTimeType* mtime);
81 
85  virtual int UpdateInformation() { return 1; }
86 
88 
92  virtual vtkTypeBool Update();
93  virtual vtkTypeBool Update(int port);
95 
97 
101  int GetNumberOfInputPorts();
102  int GetNumberOfOutputPorts();
104 
108  int GetNumberOfInputConnections(int port);
109 
113  virtual vtkInformation* GetOutputInformation(int port);
114 
118  vtkInformationVector* GetOutputInformation();
119 
123  vtkInformation* GetInputInformation(int port, int connection);
124 
128  vtkInformationVector* GetInputInformation(int port);
129 
133  vtkInformationVector** GetInputInformation();
134 
138  vtkExecutive* GetInputExecutive(int port, int connection);
139 
141 
144  virtual vtkDataObject* GetOutputData(int port);
145  virtual void SetOutputData(int port, vtkDataObject*, vtkInformation* info);
146  virtual void SetOutputData(int port, vtkDataObject*);
148 
150 
153  virtual vtkDataObject* GetInputData(int port, int connection);
154  virtual vtkDataObject* GetInputData(int port, int connection, vtkInformationVector** inInfoVec);
156 
164 
173  void SetSharedInputInformation(vtkInformationVector** inInfoVec);
174  void SetSharedOutputInformation(vtkInformationVector* outInfoVec);
176 
178 
181  bool UsesGarbageCollector() const override { return true; }
183 
188  static vtkInformationExecutivePortKey* PRODUCER();
189 
194  static vtkInformationExecutivePortVectorKey* CONSUMERS();
195 
200  static vtkInformationIntegerKey* FROM_OUTPUT_PORT();
201 
203 
207  static vtkInformationIntegerKey* ALGORITHM_BEFORE_FORWARD();
208  static vtkInformationIntegerKey* ALGORITHM_AFTER_FORWARD();
209  static vtkInformationIntegerKey* ALGORITHM_DIRECTION();
210  static vtkInformationIntegerKey* FORWARD_DIRECTION();
211  static vtkInformationKeyVectorKey* KEYS_TO_COPY();
213 
214  enum
215  {
217  RequestDownstream
218  };
219  enum
220  {
222  AfterForward
223  };
224 
229  virtual int CallAlgorithm(vtkInformation* request, int direction, vtkInformationVector** inInfo,
230  vtkInformationVector* outInfo);
231 
232 protected:
233  vtkExecutive();
234  ~vtkExecutive() 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, 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 private:
289  vtkExecutive(const vtkExecutive&) = delete;
290  void operator=(const vtkExecutive&) = delete;
291 };
292 
293 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:62
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:287
virtual int UpdateInformation()
Bring the output information up to date.
Definition: vtkExecutive.h:85
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:49
Detect and break reference loops.
bool UsesGarbageCollector() const override
Participate in garbage collection.
Definition: vtkExecutive.h:181
Proxy object to connect input/output ports.
int vtkTypeBool
Definition: vtkABI.h:69
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:62
vtkInformationVector * SharedOutputInformation
Definition: vtkExecutive.h:277
a simple class to control print indentation
Definition: vtkIndent.h:39
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:276
vtkAlgorithm * Algorithm
Definition: vtkExecutive.h:268
general representation of visualization data
Definition: vtkDataObject.h:65
Key for vtkExecutive/Port value pairs.