00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00027
#ifndef __vtkVoidArray_h
00028
#define __vtkVoidArray_h
00029
00030
#include "vtkDataArray.h"
00031
00032 class VTK_COMMON_EXPORT vtkVoidArray :
public vtkDataArray
00033 {
00034
public:
00035
static vtkVoidArray *
New();
00036
00037 vtkTypeRevisionMacro(vtkVoidArray,
vtkDataArray);
00038
void PrintSelf(ostream& os,
vtkIndent indent);
00039
00042
int Allocate(
const vtkIdType sz,
const vtkIdType ext=1000);
00043
00045
void Initialize();
00046
00048 int GetDataType() {
return VTK_VOID;};
00049
00051 int GetDataTypeSize() {
return sizeof(
void*); }
00052
00054
void SetNumberOfTuples(
const vtkIdType number);
00055
00057
float *
GetTuple(
const vtkIdType i);
00058
00060
00061
void GetTuple(
const vtkIdType i,
float * tuple);
00062
void GetTuple(
const vtkIdType i,
double * tuple);
00064
00066
00067
void SetTuple(
const vtkIdType i,
const float * tuple);
00068
void SetTuple(
const vtkIdType i,
const double * tuple);
00070
00072
00074
void InsertTuple(
const vtkIdType i,
const float * tuple);
00075
void InsertTuple(
const vtkIdType i,
const double * tuple);
00077
00079
00081
vtkIdType InsertNextTuple(
const float * tuple);
00082
vtkIdType InsertNextTuple(
const double * tuple);
00084
00086 void Squeeze() {this->ResizeAndExtend (this->MaxId+1);};
00087
00089
virtual void Resize(
vtkIdType numTuples);
00090
00092 void* GetValue(
const vtkIdType id) {
return this->Array[
id];};
00093
00097
void SetNumberOfValues(
const vtkIdType number);
00098
00101
void SetValue(
const vtkIdType id,
void *value);
00102
00104
void InsertValue(
const vtkIdType id,
void* p);
00105
00108
vtkIdType InsertNextValue(
void* v);
00109
00111
00113 void** GetPointer(
const vtkIdType id) {
return this->Array +
id;}
00114 void *
GetVoidPointer(
const vtkIdType id) {
return this->GetPointer(
id);};
00116
00120
void** WritePointer(
const vtkIdType id,
const vtkIdType number);
00121
00123
void DeepCopy(
vtkDataArray *da);
00124
00125
00126
protected:
00127 vtkVoidArray();
00128 ~vtkVoidArray();
00129
00130 void** Array;
00131
void** ResizeAndExtend(
const vtkIdType sz);
00132
00133 int TupleSize;
00134 float *Tuple;
00135
private:
00136 vtkVoidArray(
const vtkVoidArray&);
00137
void operator=(
const vtkVoidArray&);
00138 };
00139
00140
00141 inline void vtkVoidArray::SetNumberOfValues(
const vtkIdType number)
00142 {
00143 this->
Allocate(number);
00144 this->MaxId = number - 1;
00145 }
00146
00147 inline void vtkVoidArray::SetValue(
const vtkIdType id,
void *value)
00148 {
00149 this->
Array[
id] = value;
00150 }
00151
00152 inline void**
vtkVoidArray::WritePointer(
const vtkIdType id,
00153
const vtkIdType number)
00154 {
00155
vtkIdType newSize=
id+number;
00156
if ( newSize > this->Size )
00157 {
00158 this->
ResizeAndExtend(newSize);
00159 }
00160
if ( (--newSize) > this->MaxId )
00161 {
00162 this->MaxId = newSize;
00163 }
00164
return this->
Array +
id;
00165 }
00166
00167 inline void vtkVoidArray::InsertValue(
const vtkIdType id,
void* p)
00168 {
00169
if (
id >= this->Size )
00170 {
00171 this->
ResizeAndExtend(
id+1);
00172 }
00173 this->
Array[
id] = p;
00174
if (
id > this->MaxId )
00175 {
00176 this->MaxId =
id;
00177 }
00178 }
00179
00180 inline vtkIdType vtkVoidArray::InsertNextValue(
void* p)
00181 {
00182 this->
InsertValue (++this->MaxId,p);
00183
return this->MaxId;
00184 }
00185
00186
00187
#endif