VTK  9.0.3
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 =========================================================================*/
27 #ifndef vtkExecutive_h
28 #define vtkExecutive_h
29 
30 #include "vtkCommonExecutionModelModule.h" // For export macro
31 #include "vtkObject.h"
32 
33 class vtkAlgorithm;
34 class vtkAlgorithmOutput;
35 class vtkAlgorithmToExecutiveFriendship;
36 class vtkDataObject;
37 class vtkExecutiveInternals;
38 class vtkInformation;
45 
46 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkExecutive : public vtkObject
47 {
48 public:
49  vtkTypeMacro(vtkExecutive, vtkObject);
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
56 
62  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo);
63 
76  virtual int ComputePipelineMTime(vtkInformation* request, vtkInformationVector** inInfoVec,
77  vtkInformationVector* outInfoVec, int requestFromOutputPort, vtkMTimeType* mtime);
78 
82  virtual int UpdateInformation() { return 1; }
83 
85 
89  virtual vtkTypeBool Update();
90  virtual vtkTypeBool Update(int port);
92 
94 
101 
106 
111 
116 
120  vtkInformation* GetInputInformation(int port, int connection);
121 
126 
131 
135  vtkExecutive* GetInputExecutive(int port, int connection);
136 
138 
143  virtual void SetOutputData(int port, vtkDataObject*);
145 
147 
150  virtual vtkDataObject* GetInputData(int port, int connection);
151  virtual vtkDataObject* GetInputData(int port, int connection, vtkInformationVector** inInfoVec);
153 
173 
175 
178  void Register(vtkObjectBase* o) override;
179  void UnRegister(vtkObjectBase* o) override;
181 
187 
193 
199 
201 
211 
212  enum
213  {
215  RequestDownstream
216  };
217  enum
218  {
220  AfterForward
221  };
222 
227  virtual int CallAlgorithm(vtkInformation* request, int direction, vtkInformationVector** inInfo,
228  vtkInformationVector* outInfo);
229 
230 protected:
232  ~vtkExecutive() override;
233 
234  // Helper methods for subclasses.
235  int InputPortIndexInRange(int port, const char* action);
236  int OutputPortIndexInRange(int port, const char* action);
237 
238  // Called by methods to check for a recursive pipeline update. A
239  // request should be fulfilled without making another request. This
240  // is used to help enforce that behavior. Returns 1 if no recursive
241  // request is occurring, and 0 otherwise. An error message is
242  // produced automatically if 0 is returned. The first argument is
243  // the name of the calling method (the one that should not be
244  // invoked recursively during an update). The second argument is
245  // the recursive request information object, if any. It is used to
246  // construct the error message.
247  int CheckAlgorithm(const char* method, vtkInformation* request);
248 
249  virtual int ForwardDownstream(vtkInformation* request);
250  virtual int ForwardUpstream(vtkInformation* request);
251  virtual void CopyDefaultInformation(vtkInformation* request, int direction,
252  vtkInformationVector** inInfo, vtkInformationVector* outInfo);
253 
254  // Reset the pipeline update values in the given output information object.
256 
257  // Bring the existence of output data objects up to date.
258  virtual int UpdateDataObject() = 0;
259 
260  // Garbage collection support.
262 
263  virtual void SetAlgorithm(vtkAlgorithm* algorithm);
264 
265  // The algorithm managed by this executive.
267 
268  // Flag set when the algorithm is processing a request.
270 
271  // Pointers to an outside instance of input or output information.
272  // No references are held. These are used to implement internal
273  // pipelines.
276 
277 private:
278  // Store an information object for each output port of the algorithm.
279  vtkInformationVector* OutputInformation;
280 
281  // Internal implementation details.
282  vtkExecutiveInternals* ExecutiveInternal;
283 
284  friend class vtkAlgorithmToExecutiveFriendship;
285 
286 private:
287  vtkExecutive(const vtkExecutive&) = delete;
288  void operator=(const vtkExecutive&) = delete;
289 };
290 
291 #endif
Proxy object to connect input/output ports.
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:54
general representation of visualization data
Definition: vtkDataObject.h:60
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:47
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)
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()
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:274
void UnRegister(vtkObjectBase *o) override
Decrease the reference count (release by another object).
vtkAlgorithm * Algorithm
Definition: vtkExecutive.h:266
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.
vtkAlgorithm * GetAlgorithm()
Get the algorithm to which this executive has been assigned.
void SetSharedOutputInformation(vtkInformationVector *outInfoVec)
virtual void SetAlgorithm(vtkAlgorithm *algorithm)
static vtkInformationIntegerKey * ALGORITHM_AFTER_FORWARD()
static vtkInformationIntegerKey * ALGORITHM_DIRECTION()
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)
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()
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 *)
virtual int UpdateInformation()
Bring the output information up to date.
Definition: vtkExecutive.h:82
void Register(vtkObjectBase *o) override
Participate in garbage collection.
vtkInformationVector * SharedOutputInformation
Definition: vtkExecutive.h:275
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()
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)
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:34
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:64
abstract base class for most VTK objects
Definition: vtkObject.h:54
@ 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:293