Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

dox/Common/vtkDataObject.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkDataObject.h,v $ 00005 Language: C++ 00006 00007 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 00008 All rights reserved. 00009 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00010 00011 This software is distributed WITHOUT ANY WARRANTY; without even 00012 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00013 PURPOSE. See the above copyright notice for more information. 00014 00015 =========================================================================*/ 00038 #ifndef __vtkDataObject_h 00039 #define __vtkDataObject_h 00040 00041 #include "vtkObject.h" 00042 00043 class vtkFieldData; 00044 class vtkProcessObject; 00045 class vtkSource; 00046 class vtkExtentTranslator; 00047 00048 #define VTK_PIECES_EXTENT 0 00049 #define VTK_3D_EXTENT 1 00050 00051 class VTK_COMMON_EXPORT vtkDataObject : public vtkObject 00052 { 00053 public: 00054 static vtkDataObject *New(); 00055 00056 vtkTypeRevisionMacro(vtkDataObject,vtkObject); 00057 void PrintSelf(ostream& os, vtkIndent indent); 00058 00059 #ifndef VTK_REMOVE_LEGACY_CODE 00060 00061 virtual vtkDataObject* MakeObject(); 00062 #endif 00063 00065 00066 vtkGetObjectMacro(Source,vtkSource); 00067 void SetSource(vtkSource *s); 00069 00072 unsigned long int GetMTime(); 00073 00074 // Rescription: 00075 // Restore data object to initial state, 00076 virtual void Initialize(); 00077 00082 void ReleaseData(); 00083 00086 int ShouldIReleaseData(); 00087 00089 00090 vtkGetMacro(DataReleased,int); 00092 00094 00096 vtkSetMacro(ReleaseDataFlag,int); 00097 vtkGetMacro(ReleaseDataFlag,int); 00098 vtkBooleanMacro(ReleaseDataFlag,int); 00100 00102 00104 static void SetGlobalReleaseDataFlag(int val); 00105 void GlobalReleaseDataFlagOn() {this->SetGlobalReleaseDataFlag(1);}; 00106 void GlobalReleaseDataFlagOff() {this->SetGlobalReleaseDataFlag(0);}; 00107 static int GetGlobalReleaseDataFlag(); 00109 00111 00112 virtual void SetFieldData(vtkFieldData*); 00113 vtkGetObjectMacro(FieldData,vtkFieldData); 00115 00116 // Handle the source/data loop. 00117 virtual void UnRegister(vtkObjectBase *o); 00118 00122 virtual int GetNetReferenceCount() {return this->ReferenceCount;}; 00123 00129 virtual void Update(); 00130 00136 virtual void UpdateInformation(); 00137 00142 virtual void PropagateUpdateExtent(); 00143 00149 virtual void TriggerAsynchronousUpdate(); 00150 00157 virtual void UpdateData(); 00158 00164 virtual unsigned long GetEstimatedMemorySize(); 00165 00167 00170 virtual void SetUpdateExtent(int vtkNotUsed(piece),int vtkNotUsed(numPieces), 00171 int vtkNotUsed(ghostLevel)) 00172 {vtkErrorMacro("Subclass did not implement 'SetUpdateExtent'");} 00173 void SetUpdateExtent(int piece, int numPieces) 00174 {this->SetUpdateExtent(piece, numPieces, 0);} 00176 00178 00185 virtual void SetUpdateExtent(int x1, int x2, int y1, int y2, int z1, int z2); 00186 virtual void SetUpdateExtent( int ext[6] ); 00187 vtkGetVector6Macro( UpdateExtent, int ); 00189 00194 virtual int GetDataObjectType() {return VTK_DATA_OBJECT;} 00195 00198 unsigned long GetUpdateTime(); 00199 00204 void SetUpdateExtentToWholeExtent(); 00205 00206 void SetPipelineMTime(unsigned long time) {this->PipelineMTime = time; } 00207 vtkGetMacro(PipelineMTime, unsigned long); 00208 00214 virtual unsigned long GetActualMemorySize(); 00215 00217 void CopyInformation( vtkDataObject *data ); 00218 00220 00221 virtual void CopyTypeSpecificInformation( vtkDataObject *data ) 00222 {this->CopyInformation( data );}; 00224 00226 00228 void SetUpdatePiece(int piece); 00229 void SetUpdateNumberOfPieces(int num); 00230 vtkGetMacro( UpdatePiece, int ); 00231 vtkGetMacro( UpdateNumberOfPieces, int ); 00233 00235 00237 void SetUpdateGhostLevel(int level); 00238 vtkGetMacro(UpdateGhostLevel, int); 00240 00242 00247 void SetRequestExactExtent(int v); 00248 vtkGetMacro(RequestExactExtent, int); 00249 vtkBooleanMacro(RequestExactExtent, int); 00251 00253 00256 vtkSetVector6Macro( WholeExtent, int ); 00257 vtkGetVector6Macro( WholeExtent, int ); 00259 00261 00265 vtkSetMacro( MaximumNumberOfPieces, int ); 00266 vtkGetMacro( MaximumNumberOfPieces, int ); 00268 00272 void DataHasBeenGenerated(); 00273 00277 virtual void PrepareForNewData() {this->Initialize();}; 00278 00280 00282 virtual void ShallowCopy(vtkDataObject *src); 00283 virtual void DeepCopy(vtkDataObject *src); 00285 00287 00290 vtkSetMacro(Locality, float); 00291 vtkGetMacro(Locality, float); 00293 00295 00296 void SetExtentTranslator(vtkExtentTranslator *translator); 00297 vtkExtentTranslator *GetExtentTranslator(); 00299 00301 00302 vtkGetMacro(NumberOfConsumers,int); 00304 00306 00307 void AddConsumer(vtkObject *c); 00308 void RemoveConsumer(vtkObject *c); 00309 vtkObject *GetConsumer(int i); 00310 int IsConsumer(vtkObject *c); 00312 00313 00314 protected: 00315 00316 vtkDataObject(); 00317 ~vtkDataObject(); 00318 00319 // General field data associated with data object 00320 vtkFieldData *FieldData; 00321 00322 // Who generated this data as output? 00323 vtkSource *Source; 00324 00325 // Keep track of data release during network execution 00326 int DataReleased; 00327 00328 // how many consumers does this object have 00329 int NumberOfConsumers; 00330 vtkObject **Consumers; 00331 00333 int UpdateExtentIsOutsideOfTheExtent(); 00334 00339 int UpdateExtentIsEmpty(); 00340 00348 virtual int VerifyUpdateExtent(); 00349 00350 // The ExtentType will be left as VTK_PIECES_EXTENT for data objects 00351 // such as vtkPolyData and vtkUnstructuredGrid. The ExtentType will be 00352 // changed to VTK_3D_EXTENT for data objects with 3D structure such as 00353 // vtkImageData (and its subclass vtkStructuredPoints), vtkRectilinearGrid, 00354 // and vtkStructuredGrid. The default is the have an extent in pieces, 00355 // with only one piece (no streaming possible). 00356 virtual int GetExtentType() { return VTK_PIECES_EXTENT; }; 00357 00358 // If the ExtentType is VTK_3D_EXTENT, then these three extent variables 00359 // represent the whole extent, the extent currently in memory, and the 00360 // requested update extent. The extent is given as 3 min/max pairs. 00361 int WholeExtent[6]; 00362 int Extent[6]; 00363 int UpdateExtent[6]; 00364 // First update, the update extent will be set to the whole extent. 00365 unsigned char UpdateExtentInitialized; 00366 // An object to translate from unstructured pieces to structured extents. 00367 vtkExtentTranslator *ExtentTranslator; 00368 00369 // Unstructured request stuff 00370 int NumberOfPieces; 00371 int Piece; 00372 int MaximumNumberOfPieces; 00373 int UpdateNumberOfPieces; 00374 int UpdatePiece; 00375 00376 // This request flag indicates whether the requester can handle 00377 // more data than requested. Right now it is used in vtkImageData. 00378 // Image filters can return more data than requested. The the 00379 // consumer cannot handle this (i.e. DataSetToDataSetFitler) 00380 // this image will crop itself. This functionality used to be in 00381 // ImageToStructuredPoints. 00382 int RequestExactExtent; 00383 00384 // This method crops the data object (if necesary) so that the extent 00385 // matches the update extent. 00386 virtual void Crop(); 00387 00388 int GhostLevel; 00389 int UpdateGhostLevel; 00390 00391 // Data will release after use by a filter if this flag is set 00392 int ReleaseDataFlag; 00393 00394 // When was this data last generated? 00395 vtkTimeStamp UpdateTime; 00396 00397 // The Maximum MTime of all upstream filters and data objects. 00398 // This does not include the MTime of this data object. 00399 unsigned long PipelineMTime; 00400 00401 // Was the update extent propagated down the pipeline 00402 int LastUpdateExtentWasOutsideOfTheExtent; 00403 00404 // A value indicating whether we have a port upstream and how 00405 // many filters removed it is. 00406 // 0.0 : no ports. 00407 // 1.0 : my source is a port. 00408 // 0.5 : the next upstream filter is a port ... 00409 float Locality; 00410 00411 private: 00412 // Helper method for the ShallowCopy and DeepCopy methods. 00413 void InternalDataObjectCopy(vtkDataObject *src); 00414 private: 00415 vtkDataObject(const vtkDataObject&); // Not implemented. 00416 void operator=(const vtkDataObject&); // Not implemented. 00417 }; 00418 00419 #endif 00420