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 "vtkObject.h"
33 
34 class vtkAlgorithm;
35 class vtkAlgorithmOutput;
36 class vtkAlgorithmToExecutiveFriendship;
37 class vtkDataObject;
38 class vtkExecutiveInternals;
39 class vtkInformation;
46 
48 {
49 public:
50  vtkTypeMacro(vtkExecutive,vtkObject);
51  void PrintSelf(ostream& os, vtkIndent indent);
52 
54  vtkAlgorithm* GetAlgorithm();
55 
57 
59  virtual int ProcessRequest(vtkInformation* request,
60  vtkInformationVector** inInfo,
61  vtkInformationVector* outInfo);
63 
65 
74  virtual int
75  ComputePipelineMTime(vtkInformation* request,
76  vtkInformationVector** inInfoVec,
77  vtkInformationVector* outInfoVec,
78  int requestFromOutputPort,
79  unsigned long* mtime);
81 
83 
85  virtual int Update();
86  virtual int Update(int port);
88 
90 
92  int GetNumberOfInputPorts();
93  int GetNumberOfOutputPorts();
95 
97  int GetNumberOfInputConnections(int port);
98 
100  virtual vtkInformation* GetOutputInformation(int port);
101 
103  vtkInformationVector* GetOutputInformation();
104 
106  vtkInformation* GetInputInformation(int port, int connection);
107 
109  vtkInformationVector* GetInputInformation(int port);
110 
112  vtkInformationVector** GetInputInformation();
113 
115  vtkExecutive* GetInputExecutive(int port, int connection);
116 
118 
119  virtual vtkDataObject* GetOutputData(int port);
120  virtual void SetOutputData(int port, vtkDataObject*, vtkInformation *info);
121  virtual void SetOutputData(int port, vtkDataObject*);
123 
125 
126  virtual vtkDataObject* GetInputData(int port, int connection);
127  virtual vtkDataObject* GetInputData(int port, int connection,
128  vtkInformationVector **inInfoVec);
130 
132  virtual vtkAlgorithmOutput* GetProducerPort(vtkDataObject*);
133 
135 
141  void SetSharedInputInformation(vtkInformationVector** inInfoVec);
142  void SetSharedOutputInformation(vtkInformationVector* outInfoVec);
144 
146 
147  virtual void Register(vtkObjectBase* o);
148  virtual void UnRegister(vtkObjectBase* o);
150 
153  static vtkInformationExecutivePortKey* PRODUCER();
154 
157  static vtkInformationExecutivePortVectorKey* CONSUMERS();
158 
161  static vtkInformationIntegerKey* FROM_OUTPUT_PORT();
162 
164 
166  static vtkInformationIntegerKey* ALGORITHM_BEFORE_FORWARD();
167  static vtkInformationIntegerKey* ALGORITHM_AFTER_FORWARD();
168  static vtkInformationIntegerKey* ALGORITHM_DIRECTION();
169  static vtkInformationIntegerKey* FORWARD_DIRECTION();
170  static vtkInformationKeyVectorKey* KEYS_TO_COPY();
171  //BTX
172  enum { RequestUpstream, RequestDownstream };
173  enum { BeforeForward, AfterForward };
174  //ETX
176 
178 
180  virtual int CallAlgorithm(vtkInformation* request, int direction,
181  vtkInformationVector** inInfo,
182  vtkInformationVector* outInfo);
184 
185 protected:
186  vtkExecutive();
187  ~vtkExecutive();
188 
189  // Helper methods for subclasses.
190  int InputPortIndexInRange(int port, const char* action);
191  int OutputPortIndexInRange(int port, const char* action);
192 
193  // Called by methods to check for a recursive pipeline update. A
194  // request should be fulfilled without making another request. This
195  // is used to help enforce that behavior. Returns 1 if no recursive
196  // request is occurring, and 0 otherwise. An error message is
197  // produced automatically if 0 is returned. The first argument is
198  // the name of the calling method (the one that should not be
199  // invoked recursively during an update). The second argument is
200  // the recursive request information object, if any. It is used to
201  // construct the error message.
202  int CheckAlgorithm(const char* method, vtkInformation* request);
203 
204  virtual int ForwardDownstream(vtkInformation* request);
205  virtual int ForwardUpstream(vtkInformation* request);
206  virtual void CopyDefaultInformation(vtkInformation* request, int direction,
207  vtkInformationVector** inInfo,
208  vtkInformationVector* outInfo);
209 
210  // Reset the pipeline update values in the given output information object.
211  virtual void ResetPipelineInformation(int port, vtkInformation*)=0;
212 
213  // Bring the existence of output data objects up to date.
214  virtual int UpdateDataObject()=0;
215 
216  // Garbage collection support.
217  virtual void ReportReferences(vtkGarbageCollector*);
218 
219  virtual void SetAlgorithm(vtkAlgorithm* algorithm);
220 
221  // The algorithm managed by this executive.
223 
224  // Flag set when the algorithm is processing a request.
226 
227  // Pointers to an outside instance of input or output information.
228  // No references are held. These are used to implement internal
229  // pipelines.
232 
233 private:
234  // Store an information object for each output port of the algorithm.
235  vtkInformationVector* OutputInformation;
236 
237  // Internal implementation details.
238  vtkExecutiveInternals* ExecutiveInternal;
239 
240  //BTX
241  friend class vtkAlgorithmToExecutiveFriendship;
242  //ETX
243 private:
244  vtkExecutive(const vtkExecutive&); // Not implemented.
245  void operator=(const vtkExecutive&); // Not implemented.
246 };
247 
248 #endif