OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / I386LINUX / util / I386LINUX / include / vtk / vtkSource.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    $RCSfile: vtkSource.h,v $
5   Language:  C++
6   Date:      $Date: 2002/12/26 18:24:22 $
7   Version:   $Revision: 1.70 $
8
9   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
10   All rights reserved.
11   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
12
13      This software is distributed WITHOUT ANY WARRANTY; without even 
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15      PURPOSE.  See the above copyright notice for more information.
16
17 =========================================================================*/
18 // .NAME vtkSource - abstract class specifies interface for visualization network source
19 // .SECTION Description
20 // vtkSource is an abstract object that specifies behavior and interface
21 // of source objects. Source objects are objects that begin visualization
22 // pipeline. Sources include readers (read data from file or communications
23 // port) and procedural sources (generate data programmatically). vtkSource 
24 // objects are also objects that generate output data. In this sense
25 // vtkSource is used as a superclass to vtkFilter.
26 //
27 // Concrete subclasses of vtkSource must define Update() and Execute() 
28 // methods. The public method Update() invokes network execution and will
29 // bring the network up-to-date. The protected Execute() method actually
30 // does the work of data creation/generation. The difference between the two
31 // methods is that Update() implements input consistency checks and modified
32 // time comparisons and then invokes the Execute() which is an implementation 
33 // of a particular algorithm.
34 //
35 // An important feature of subclasses of vtkSource is that it is possible 
36 // to control the memory-management model (i.e., retain output versus delete
37 // output data). If enabled the ReleaseDataFlag enables the deletion of the
38 // output data once the downstream process object finishes processing the
39 // data (please see text).
40
41 // .SECTION See Also
42 // vtkProcessObject vtkDataSetReader vtkFilter vtkPolyDataSource 
43 // vtkStructuredGridSource vtkStructuredPointsSource vtkUnstructuredGridSource
44
45 #ifndef __vtkSource_h
46 #define __vtkSource_h
47
48 #include "vtkProcessObject.h"
49
50 class vtkDataObject;
51 class vtkErrorCode;
52
53 class VTK_COMMON_EXPORT vtkSource : public vtkProcessObject
54 {
55 public:
56   vtkTypeRevisionMacro(vtkSource,vtkProcessObject);
57   void PrintSelf(ostream& os, vtkIndent indent);
58
59   // Description:
60   // Bring object up-to-date before execution. Update() checks modified
61   // time against last execution time, and re-executes object if necessary.
62   virtual void Update();
63
64   // Description:
65   // Like update, but make sure the update extent is the whole extent in
66   // the output.
67   virtual void UpdateWholeExtent();
68
69   // Description:
70   // Updates any global information about the data 
71   // (like spacing for images)
72   virtual void UpdateInformation();
73
74   // Description:
75   virtual void PropagateUpdateExtent(vtkDataObject *output);
76
77   // Description:
78   virtual void TriggerAsynchronousUpdate();
79
80   // Description:
81   virtual void UpdateData(vtkDataObject *output);
82
83   // Description:
84   // What is the input update extent that is required to produce the
85   // desired output? By default, the whole input is always required but
86   // this is overridden in many subclasses. 
87   virtual void ComputeInputUpdateExtents( vtkDataObject *output );
88
89   // Description:
90   // Turn on/off flag to control whether this object's data is released
91   // after being used by a source.
92   virtual void SetReleaseDataFlag(int);
93   virtual int GetReleaseDataFlag();
94   vtkBooleanMacro(ReleaseDataFlag,int);
95
96   // Description:
97   // Handle the source/data loop.
98   virtual void UnRegister(vtkObjectBase *o);
99   
100   // Description:
101   // Test to see if this object is in a reference counting loop.
102   virtual int InRegisterLoop(vtkObject *);
103
104   // Description:
105   // Return an array with all the inputs of this process object.
106   // This is useful for tracing back in the pipeline to construct
107   // graphs etc.
108   vtkDataObject **GetOutputs();
109   vtkGetMacro(NumberOfOutputs,int);
110
111   // Description:
112   // Release/disconnect all outputs of this source. This is intended to be
113   // called prior to Delete() if the user is concerned about outputs holding
114   // on to the filter/source.
115   void UnRegisterAllOutputs(void);
116
117   // Description:
118   // Return what index output the passed in output is, return -1 if it
119   // does not match any of the outputs
120   int GetOutputIndex(vtkDataObject *out);
121   
122   // Description:
123   // The reader should set this code at the end of the update.
124   // The error code contains a possible error that occured while
125   // reading the file.
126   vtkGetMacro( ErrorCode, unsigned long );
127
128 protected:
129   vtkSource();
130   ~vtkSource();
131
132   // Description:
133   // This method is the one that should be used by subclasses, right now the 
134   // default implementation is to call the backwards compatibility method
135   virtual void ExecuteData(vtkDataObject *vtkNotUsed(output)) {
136     this->Execute(); };
137
138   // Description:
139   // This method is the old style execute method
140   virtual void Execute();
141
142   // By default, UpdateInformation calls this method to copy information
143   // unmodified from the input to the output.
144   virtual void ExecuteInformation();
145
146   // Called to allocate the input array.  Copies old inputs.
147   void SetNumberOfOutputs(int num);
148
149   // method used internally for getting an output.
150   vtkDataObject *GetOutput(int idx);
151
152   // protected methods for setting inputs.
153   virtual void SetNthOutput(int num, vtkDataObject *output);
154   virtual void AddOutput(vtkDataObject *output);
155   virtual void RemoveOutput(vtkDataObject *output);
156   
157   vtkDataObject **Outputs;     // An Array of the outputs to the filter
158   int NumberOfOutputs;
159   int Updating;
160   // Time when ExecuteInformation was last called.
161   vtkTimeStamp InformationTime;
162
163   // Description:
164   // The reader should set this code at the end of the update.
165   // The error code contains a possible error that occured while
166   // reading the file.
167   vtkSetMacro( ErrorCode, unsigned long );
168 private:
169   vtkSource(const vtkSource&);  // Not implemented.
170   void operator=(const vtkSource&);  // Not implemented.
171
172   unsigned long ErrorCode;
173 };
174
175 #endif
176
177
178