VTK
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 
55  vtkAlgorithm* GetAlgorithm();
56 
61  virtual int ProcessRequest(vtkInformation* request,
62  vtkInformationVector** inInfo,
63  vtkInformationVector* outInfo);
64 
77  virtual int
78  ComputePipelineMTime(vtkInformation* request,
79  vtkInformationVector** inInfoVec,
80  vtkInformationVector* outInfoVec,
81  int requestFromOutputPort,
82  vtkMTimeType* mtime);
83 
87  virtual int UpdateInformation() {return 1;}
88 
90 
94  virtual int Update();
95  virtual int Update(int port);
97 
99 
103  int GetNumberOfInputPorts();
104  int GetNumberOfOutputPorts();
106 
110  int GetNumberOfInputConnections(int port);
111 
115  virtual vtkInformation* GetOutputInformation(int port);
116 
120  vtkInformationVector* GetOutputInformation();
121 
125  vtkInformation* GetInputInformation(int port, int connection);
126 
130  vtkInformationVector* GetInputInformation(int port);
131 
135  vtkInformationVector** GetInputInformation();
136 
140  vtkExecutive* GetInputExecutive(int port, int connection);
141 
143 
146  virtual vtkDataObject* GetOutputData(int port);
147  virtual void SetOutputData(int port, vtkDataObject*, vtkInformation *info);
148  virtual void SetOutputData(int port, vtkDataObject*);
150 
152 
155  virtual vtkDataObject* GetInputData(int port, int connection);
156  virtual vtkDataObject* GetInputData(int port, int connection,
157  vtkInformationVector **inInfoVec);
159 
176  void SetSharedInputInformation(vtkInformationVector** inInfoVec);
177  void SetSharedOutputInformation(vtkInformationVector* outInfoVec);
179 
181 
184  void Register(vtkObjectBase* o) override;
185  void UnRegister(vtkObjectBase* o) override;
187 
192  static vtkInformationExecutivePortKey* PRODUCER();
193 
198  static vtkInformationExecutivePortVectorKey* CONSUMERS();
199 
204  static vtkInformationIntegerKey* FROM_OUTPUT_PORT();
205 
207 
211  static vtkInformationIntegerKey* ALGORITHM_BEFORE_FORWARD();
212  static vtkInformationIntegerKey* ALGORITHM_AFTER_FORWARD();
213  static vtkInformationIntegerKey* ALGORITHM_DIRECTION();
214  static vtkInformationIntegerKey* FORWARD_DIRECTION();
215  static vtkInformationKeyVectorKey* KEYS_TO_COPY();
217 
218  enum { RequestUpstream, RequestDownstream };
219  enum { BeforeForward, AfterForward };
220 
225  virtual int CallAlgorithm(vtkInformation* request, int direction,
226  vtkInformationVector** inInfo,
227  vtkInformationVector* outInfo);
228 
229 protected:
230  vtkExecutive();
231  ~vtkExecutive() override;
232 
233  // Helper methods for subclasses.
234  int InputPortIndexInRange(int port, const char* action);
235  int OutputPortIndexInRange(int port, const char* action);
236 
237  // Called by methods to check for a recursive pipeline update. A
238  // request should be fulfilled without making another request. This
239  // is used to help enforce that behavior. Returns 1 if no recursive
240  // request is occurring, and 0 otherwise. An error message is
241  // produced automatically if 0 is returned. The first argument is
242  // the name of the calling method (the one that should not be
243  // invoked recursively during an update). The second argument is
244  // the recursive request information object, if any. It is used to
245  // construct the error message.
246  int CheckAlgorithm(const char* method, vtkInformation* request);
247 
248  virtual int ForwardDownstream(vtkInformation* request);
249  virtual int ForwardUpstream(vtkInformation* request);
250  virtual void CopyDefaultInformation(vtkInformation* request, int direction,
251  vtkInformationVector** inInfo,
252  vtkInformationVector* outInfo);
253 
254  // Reset the pipeline update values in the given output information object.
255  virtual void ResetPipelineInformation(int port, vtkInformation*)=0;
256 
257  // Bring the existence of output data objects up to date.
258  virtual int UpdateDataObject()=0;
259 
260  // Garbage collection support.
261  void ReportReferences(vtkGarbageCollector*) override;
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
vtkExecutive::BeforeForward
Definition: vtkExecutive.h:219
vtkInformationKeyVectorKey
Key for vector-of-keys values.
Definition: vtkInformationKeyVectorKey.h:31
vtkExecutive::Algorithm
vtkAlgorithm * Algorithm
Definition: vtkExecutive.h:266
vtkObjectBase::Register
virtual void Register(vtkObjectBase *o)
Increase the reference count (mark as used by another object).
vtkAlgorithm
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:53
vtkX3D::direction
Definition: vtkX3D.h:260
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkObjectBase::ReportReferences
virtual void ReportReferences(vtkGarbageCollector *)
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:53
vtkExecutive::SharedOutputInformation
vtkInformationVector * SharedOutputInformation
Definition: vtkExecutive.h:275
vtkX3D::port
Definition: vtkX3D.h:447
vtkExecutive
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:46
vtkExecutive::UpdateInformation
virtual int UpdateInformation()
Bring the output information up to date.
Definition: vtkExecutive.h:87
vtkObjectBase
abstract base class for most VTK objects
Definition: vtkObjectBase.h:62
vtkInformationIntegerKey
Key for integer values in vtkInformation.
Definition: vtkInformationIntegerKey.h:31
vtkInformationExecutivePortVectorKey
Key for vtkExecutive/Port value pair vectors.
Definition: vtkInformationExecutivePortVectorKey.h:34
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkInformationRequestKey
Key for pointer to pointer.
Definition: vtkInformationRequestKey.h:31
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkExecutive::RequestUpstream
Definition: vtkExecutive.h:218
vtkGarbageCollector
Detect and break reference loops.
Definition: vtkGarbageCollector.h:96
vtkObject.h
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:80
vtkX3D::info
Definition: vtkX3D.h:376
vtkAlgorithmOutput
Proxy object to connect input/output ports.
Definition: vtkAlgorithmOutput.h:36
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:58
vtkExecutive::InAlgorithm
int InAlgorithm
Definition: vtkExecutive.h:269
vtkObjectBase::UnRegister
virtual void UnRegister(vtkObjectBase *o)
Decrease the reference count (release by another object).
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302
vtkInformationExecutivePortKey
Key for vtkExecutive/Port value pairs.
Definition: vtkInformationExecutivePortKey.h:34
vtkExecutive::SharedInputInformation
vtkInformationVector ** SharedInputInformation
Definition: vtkExecutive.h:274