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 =========================================================================*/
32 #ifndef vtkExecutive_h
33 #define vtkExecutive_h
34 
35 #include "vtkCommonExecutionModelModule.h" // For export macro
36 #include "vtkObject.h"
37 
38 class vtkAlgorithm;
39 class vtkAlgorithmOutput;
40 class vtkAlgorithmToExecutiveFriendship;
41 class vtkDataObject;
42 class vtkExecutiveInternals;
43 class vtkInformation;
50 
52 {
53 public:
54  vtkTypeMacro(vtkExecutive,vtkObject);
55  void PrintSelf(ostream& os, vtkIndent indent);
56 
58  vtkAlgorithm* GetAlgorithm();
59 
61 
63  virtual int ProcessRequest(vtkInformation* request,
64  vtkInformationVector** inInfo,
65  vtkInformationVector* outInfo);
67 
69 
78  virtual int
79  ComputePipelineMTime(vtkInformation* request,
80  vtkInformationVector** inInfoVec,
81  vtkInformationVector* outInfoVec,
82  int requestFromOutputPort,
83  unsigned long* mtime);
85 
87  virtual int UpdateInformation() {return 1;}
88 
90 
92  virtual int Update();
93  virtual int Update(int port);
95 
97 
99  int GetNumberOfInputPorts();
100  int GetNumberOfOutputPorts();
102 
104  int GetNumberOfInputConnections(int port);
105 
107  virtual vtkInformation* GetOutputInformation(int port);
108 
110  vtkInformationVector* GetOutputInformation();
111 
113  vtkInformation* GetInputInformation(int port, int connection);
114 
116  vtkInformationVector* GetInputInformation(int port);
117 
119  vtkInformationVector** GetInputInformation();
120 
122  vtkExecutive* GetInputExecutive(int port, int connection);
123 
125 
126  virtual vtkDataObject* GetOutputData(int port);
127  virtual void SetOutputData(int port, vtkDataObject*, vtkInformation *info);
128  virtual void SetOutputData(int port, vtkDataObject*);
130 
132 
133  virtual vtkDataObject* GetInputData(int port, int connection);
134  virtual vtkDataObject* GetInputData(int port, int connection,
135  vtkInformationVector **inInfoVec);
137 
149  void SetSharedInputInformation(vtkInformationVector** inInfoVec);
150  void SetSharedOutputInformation(vtkInformationVector* outInfoVec);
152 
154 
155  virtual void Register(vtkObjectBase* o);
156  virtual void UnRegister(vtkObjectBase* o);
158 
161  static vtkInformationExecutivePortKey* PRODUCER();
162 
165  static vtkInformationExecutivePortVectorKey* CONSUMERS();
166 
169  static vtkInformationIntegerKey* FROM_OUTPUT_PORT();
170 
172 
174  static vtkInformationIntegerKey* ALGORITHM_BEFORE_FORWARD();
175  static vtkInformationIntegerKey* ALGORITHM_AFTER_FORWARD();
176  static vtkInformationIntegerKey* ALGORITHM_DIRECTION();
177  static vtkInformationIntegerKey* FORWARD_DIRECTION();
178  static vtkInformationKeyVectorKey* KEYS_TO_COPY();
179  //BTX
180  enum { RequestUpstream, RequestDownstream };
181  enum { BeforeForward, AfterForward };
182  //ETX
184 
186 
188  virtual int CallAlgorithm(vtkInformation* request, int direction,
189  vtkInformationVector** inInfo,
190  vtkInformationVector* outInfo);
192 
193 protected:
194  vtkExecutive();
195  ~vtkExecutive();
196 
197  // Helper methods for subclasses.
198  int InputPortIndexInRange(int port, const char* action);
199  int OutputPortIndexInRange(int port, const char* action);
200 
201  // Called by methods to check for a recursive pipeline update. A
202  // request should be fulfilled without making another request. This
203  // is used to help enforce that behavior. Returns 1 if no recursive
204  // request is occurring, and 0 otherwise. An error message is
205  // produced automatically if 0 is returned. The first argument is
206  // the name of the calling method (the one that should not be
207  // invoked recursively during an update). The second argument is
208  // the recursive request information object, if any. It is used to
209  // construct the error message.
210  int CheckAlgorithm(const char* method, vtkInformation* request);
211 
212  virtual int ForwardDownstream(vtkInformation* request);
213  virtual int ForwardUpstream(vtkInformation* request);
214  virtual void CopyDefaultInformation(vtkInformation* request, int direction,
215  vtkInformationVector** inInfo,
216  vtkInformationVector* outInfo);
217 
218  // Reset the pipeline update values in the given output information object.
219  virtual void ResetPipelineInformation(int port, vtkInformation*)=0;
220 
221  // Bring the existence of output data objects up to date.
222  virtual int UpdateDataObject()=0;
223 
224  // Garbage collection support.
225  virtual void ReportReferences(vtkGarbageCollector*);
226 
227  virtual void SetAlgorithm(vtkAlgorithm* algorithm);
228 
229  // The algorithm managed by this executive.
231 
232  // Flag set when the algorithm is processing a request.
234 
235  // Pointers to an outside instance of input or output information.
236  // No references are held. These are used to implement internal
237  // pipelines.
240 
241 private:
242  // Store an information object for each output port of the algorithm.
243  vtkInformationVector* OutputInformation;
244 
245  // Internal implementation details.
246  vtkExecutiveInternals* ExecutiveInternal;
247 
248  //BTX
249  friend class vtkAlgorithmToExecutiveFriendship;
250  //ETX
251 private:
252  vtkExecutive(const vtkExecutive&); // Not implemented.
253  void operator=(const vtkExecutive&); // Not implemented.
254 };
255 
256 #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:87
virtual void Update()
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:51
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:239
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:238
vtkAlgorithm * Algorithm
Definition: vtkExecutive.h:230
general representation of visualization data
Definition: vtkDataObject.h:64
Key for vtkExecutive/Port value pairs.