VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkInformationObjectBaseVectorKey.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00024 #ifndef __vtkInformationObjectBaseVectorKey_h 00025 #define __vtkInformationObjectBaseVectorKey_h 00026 00027 #include "vtkInformationKey.h" 00028 #include "vtkCommonInformationKeyManager.h" // Manage instances of this type. 00029 00030 class vtkInformationObjectBaseVectorValue; 00031 00032 class VTK_COMMON_EXPORT vtkInformationObjectBaseVectorKey : public vtkInformationKey 00033 { 00034 public: 00035 vtkTypeMacro(vtkInformationObjectBaseVectorKey,vtkInformationKey); 00036 void PrintSelf(ostream& os, vtkIndent indent); 00038 00044 vtkInformationObjectBaseVectorKey(const char* name, 00045 const char* location, 00046 const char* requiredClass=0); 00047 // 00048 ~vtkInformationObjectBaseVectorKey(); 00050 00052 00053 void Clear(vtkInformation* info); 00054 // Description: 00055 // Resize (extend) the vector to hold n objects. Any new elements 00056 // created will be null initialized. 00057 void Resize(vtkInformation* info, int n); 00058 // Description: 00059 // Get the vector's length. 00060 int Size(vtkInformation* info); 00061 int Length(vtkInformation* info){ return this->Size(info); } 00062 // Description: 00063 // Put the value on the back of the vector, with ref counting. 00064 void Append(vtkInformation* info, vtkObjectBase *value); 00065 // Description: 00066 // Set element i of the vector to value. Resizes the vector 00067 // if needed. 00068 void Set(vtkInformation* info, vtkObjectBase *value, int i); 00069 // Description: 00070 // Copy n values from the range in source defined by [from from+n-1] 00071 // into the range in this vector defined by [to to+n-1]. Resizes 00072 // the vector if needed. 00073 void SetRange(vtkInformation* info, 00074 vtkObjectBase **source, 00075 int from, 00076 int to, 00077 int n); 00079 00081 00084 void GetRange(vtkInformation *info, 00085 vtkObjectBase **dest, 00086 int from, 00087 int to, 00088 int n); 00090 00092 vtkObjectBase *Get(vtkInformation* info, int idx); 00093 00094 // _escription: 00095 // Get a pointer to the first vtkObjectBase in the vector. We are 00096 // uysing a vector of smart pointers so this is not easy to 00097 // implement. 00098 // vtkObjectBase **Get(vtkInformation* info); 00099 00103 virtual void ShallowCopy(vtkInformation* from, vtkInformation* to); 00104 00106 virtual void Print(ostream& os, vtkInformation* info); 00107 00108 protected: 00109 // The type required of all objects stored with this key. 00110 const char* RequiredClass; 00111 00112 private: 00114 00116 void CreateObjectBase(); 00117 // Description: 00118 // Check insures that if RequiredClass is set then the 00119 // type of aValue matches. return true if the two match. 00120 bool ValidateDerivedType(vtkInformation* info,vtkObjectBase* aValue); 00121 // Description: 00122 // Get the vector associated with this key, if there is 00123 // none then associate a new vector with this key and return 00124 // that. 00125 vtkInformationObjectBaseVectorValue *GetObjectBaseVector(vtkInformation *info); 00127 00128 // 00129 vtkInformationObjectBaseVectorKey(const vtkInformationObjectBaseVectorKey&); // Not implemented. 00130 void operator=(const vtkInformationObjectBaseVectorKey&); // Not implemented. 00131 }; 00132 00133 #endif