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 =========================================================================*/
29 #ifndef vtkExecutive_h
30 #define vtkExecutive_h
31 
32 #include "vtkCommonExecutionModelModule.h" // For export macro
33 #include "vtkObject.h"
34 
35 class vtkAlgorithm;
36 class vtkAlgorithmOutput;
37 class vtkAlgorithmToExecutiveFriendship;
38 class vtkDataObject;
39 class vtkExecutiveInternals;
40 class vtkInformation;
47 
49 {
50 public:
51  vtkTypeMacro(vtkExecutive,vtkObject);
52  void PrintSelf(ostream& os, vtkIndent indent);
53 
55  vtkAlgorithm* GetAlgorithm();
56 
58 
60  virtual int ProcessRequest(vtkInformation* request,
61  vtkInformationVector** inInfo,
62  vtkInformationVector* outInfo);
64 
66 
75  virtual int
76  ComputePipelineMTime(vtkInformation* request,
77  vtkInformationVector** inInfoVec,
78  vtkInformationVector* outInfoVec,
79  int requestFromOutputPort,
80  unsigned long* mtime);
82 
84  virtual int UpdateInformation() {return 1;}
85 
87 
89  virtual int Update();
90  virtual int Update(int port);
92 
94 
96  int GetNumberOfInputPorts();
97  int GetNumberOfOutputPorts();
99 
101  int GetNumberOfInputConnections(int port);
102 
104  virtual vtkInformation* GetOutputInformation(int port);
105 
107  vtkInformationVector* GetOutputInformation();
108 
110  vtkInformation* GetInputInformation(int port, int connection);
111 
113  vtkInformationVector* GetInputInformation(int port);
114 
116  vtkInformationVector** GetInputInformation();
117 
119  vtkExecutive* GetInputExecutive(int port, int connection);
120 
122 
123  virtual vtkDataObject* GetOutputData(int port);
124  virtual void SetOutputData(int port, vtkDataObject*, vtkInformation *info);
125  virtual void SetOutputData(int port, vtkDataObject*);
127 
129 
130  virtual vtkDataObject* GetInputData(int port, int connection);
131  virtual vtkDataObject* GetInputData(int port, int connection,
132  vtkInformationVector **inInfoVec);
134 
146  void SetSharedInputInformation(vtkInformationVector** inInfoVec);
147  void SetSharedOutputInformation(vtkInformationVector* outInfoVec);
149 
151 
152  virtual void Register(vtkObjectBase* o);
153  virtual void UnRegister(vtkObjectBase* o);
155 
158  static vtkInformationExecutivePortKey* PRODUCER();
159 
162  static vtkInformationExecutivePortVectorKey* CONSUMERS();
163 
166  static vtkInformationIntegerKey* FROM_OUTPUT_PORT();
167 
169 
171  static vtkInformationIntegerKey* ALGORITHM_BEFORE_FORWARD();
172  static vtkInformationIntegerKey* ALGORITHM_AFTER_FORWARD();
173  static vtkInformationIntegerKey* ALGORITHM_DIRECTION();
174  static vtkInformationIntegerKey* FORWARD_DIRECTION();
175  static vtkInformationKeyVectorKey* KEYS_TO_COPY();
176  //BTX
177  enum { RequestUpstream, RequestDownstream };
178  enum { BeforeForward, AfterForward };
179  //ETX
181 
183 
185  virtual int CallAlgorithm(vtkInformation* request, int direction,
186  vtkInformationVector** inInfo,
187  vtkInformationVector* outInfo);
189 
190 protected:
191  vtkExecutive();
192  ~vtkExecutive();
193 
194  // Helper methods for subclasses.
195  int InputPortIndexInRange(int port, const char* action);
196  int OutputPortIndexInRange(int port, const char* action);
197 
198  // Called by methods to check for a recursive pipeline update. A
199  // request should be fulfilled without making another request. This
200  // is used to help enforce that behavior. Returns 1 if no recursive
201  // request is occurring, and 0 otherwise. An error message is
202  // produced automatically if 0 is returned. The first argument is
203  // the name of the calling method (the one that should not be
204  // invoked recursively during an update). The second argument is
205  // the recursive request information object, if any. It is used to
206  // construct the error message.
207  int CheckAlgorithm(const char* method, vtkInformation* request);
208 
209  virtual int ForwardDownstream(vtkInformation* request);
210  virtual int ForwardUpstream(vtkInformation* request);
211  virtual void CopyDefaultInformation(vtkInformation* request, int direction,
212  vtkInformationVector** inInfo,
213  vtkInformationVector* outInfo);
214 
215  // Reset the pipeline update values in the given output information object.
216  virtual void ResetPipelineInformation(int port, vtkInformation*)=0;
217 
218  // Bring the existence of output data objects up to date.
219  virtual int UpdateDataObject()=0;
220 
221  // Garbage collection support.
222  virtual void ReportReferences(vtkGarbageCollector*);
223 
224  virtual void SetAlgorithm(vtkAlgorithm* algorithm);
225 
226  // The algorithm managed by this executive.
228 
229  // Flag set when the algorithm is processing a request.
231 
232  // Pointers to an outside instance of input or output information.
233  // No references are held. These are used to implement internal
234  // pipelines.
237 
238 private:
239  // Store an information object for each output port of the algorithm.
240  vtkInformationVector* OutputInformation;
241 
242  // Internal implementation details.
243  vtkExecutiveInternals* ExecutiveInternal;
244 
245  //BTX
246  friend class vtkAlgorithmToExecutiveFriendship;
247  //ETX
248 private:
249  vtkExecutive(const vtkExecutive&); // Not implemented.
250  void operator=(const vtkExecutive&); // Not implemented.
251 };
252 
253 #endif
#define VTKCOMMONEXECUTIONMODEL_EXPORT
abstract base class for most VTK objects
Definition: vtkObject.h:61
virtual void Register(vtkObjectBase *o)
Store vtkAlgorithm input/output information.
virtual int UpdateInformation()
Definition: vtkExecutive.h:84
virtual void Update()
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:48
Detect and break reference loops.
Proxy object to connect input/output ports.
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:61
virtual void PrintSelf(ostream &os, vtkIndent indent)
virtual void UnRegister(vtkObjectBase *o)
vtkInformationVector * SharedOutputInformation
Definition: vtkExecutive.h:236
a simple class to control print indentation
Definition: vtkIndent.h:38
virtual void ReportReferences(vtkGarbageCollector *)
Key for pointer to pointer.
Key for integer values in vtkInformation.
abstract base class for most VTK objects
Definition: vtkObjectBase.h:59
Key for vector-of-keys values.
Key for vtkExecutive/Port value pair vectors.
Store zero or more vtkInformation instances.
vtkInformationVector ** SharedInputInformation
Definition: vtkExecutive.h:235
vtkAlgorithm * Algorithm
Definition: vtkExecutive.h:227
general representation of visualization data
Definition: vtkDataObject.h:64
Key for vtkExecutive/Port value pairs.