dox/Common/vtkLongArray.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00030
#ifndef __vtkLongArray_h
00031
#define __vtkLongArray_h
00032
00033
#include "vtkDataArray.h"
00034
00035 class VTK_COMMON_EXPORT vtkLongArray :
public vtkDataArray
00036 {
00037
public:
00038
static vtkLongArray *
New();
00039
00040 vtkTypeRevisionMacro(vtkLongArray,
vtkDataArray);
00041
void PrintSelf(ostream& os,
vtkIndent indent);
00042
00045
int Allocate(
const vtkIdType sz,
const vtkIdType ext=1000);
00046
00048
void Initialize();
00049
00051 void Squeeze() {this->ResizeAndExtend (this->MaxId+1);};
00052
00054
virtual void Resize(
vtkIdType numTuples);
00055
00057 int GetDataType() {
return VTK_LONG;};
00058
00060 int GetDataTypeSize() {
return sizeof(
long); }
00061
00063
void SetNumberOfTuples(
const vtkIdType number);
00064
00067
float *
GetTuple(
const vtkIdType i);
00068
00070
00071
void GetTuple(
const vtkIdType i,
float * tuple);
00072
void GetTuple(
const vtkIdType i,
double * tuple);
00074
00076
00077
void SetTuple(
const vtkIdType i,
const float * tuple);
00078
void SetTuple(
const vtkIdType i,
const double * tuple);
00080
00082
00084
void InsertTuple(
const vtkIdType i,
const float * tuple);
00085
void InsertTuple(
const vtkIdType i,
const double * tuple);
00087
00089
00091
vtkIdType InsertNextTuple(
const float * tuple);
00092
vtkIdType InsertNextTuple(
const double * tuple);
00094
00096 long GetValue(
const vtkIdType id) {
return this->Array[
id];};
00097
00101
void SetNumberOfValues(
const vtkIdType number);
00102
00104
00106 void SetValue(
const vtkIdType id,
const long value)
00107 { this->Array[
id] = value;};
00109
00111
void InsertValue(
const vtkIdType id,
const long i);
00112
00115
vtkIdType InsertNextValue(
const long);
00116
00120
float GetComponent(
const vtkIdType i,
const int j);
00121
00126
void SetComponent(
const vtkIdType i,
const int j,
float c);
00127
00131
virtual void InsertComponent(
const vtkIdType i,
const int j,
float c);
00132
00134
00136 long *GetPointer(
const vtkIdType id) {
return this->Array +
id;}
00137 void *
GetVoidPointer(
const vtkIdType id)
00138 {
return (
void *)this->GetPointer(
id);};
00140
00144
long *WritePointer(
const vtkIdType id,
const vtkIdType number);
00145
00147
void DeepCopy(
vtkDataArray *da);
00148
00150
00156
void SetArray(
long* array,
vtkIdType size,
int save);
00157 void SetVoidArray(
void *array,
vtkIdType size,
int save)
00158 {this->SetArray((
long*)array, size, save);};
00160
00161
protected:
00162 vtkLongArray(
vtkIdType numComp=1);
00163 ~vtkLongArray();
00164
00165 long *Array;
00166
long *ResizeAndExtend(
const vtkIdType sz);
00167
00168 int TupleSize;
00169 float *Tuple;
00170
00171 int SaveUserArray;
00172
private:
00173 vtkLongArray(
const vtkLongArray&);
00174
void operator=(
const vtkLongArray&);
00175 };
00176
00177 inline void vtkLongArray::SetNumberOfValues(
const vtkIdType number)
00178 {
00179 this->
Allocate(number);
00180 this->MaxId = number - 1;
00181 }
00182
00183 inline long *
vtkLongArray::WritePointer(
const vtkIdType id,
00184
const vtkIdType number)
00185 {
00186
vtkIdType newSize=
id+number;
00187
if ( newSize > this->Size )
00188 {
00189 this->
ResizeAndExtend(newSize);
00190 }
00191
if ( (--newSize) > this->MaxId )
00192 {
00193 this->MaxId = newSize;
00194 }
00195
return this->
Array +
id;
00196 }
00197
00198 inline void vtkLongArray::InsertValue(
const vtkIdType id,
const long i)
00199 {
00200
if (
id >= this->Size )
00201 {
00202 this->
ResizeAndExtend(
id+1);
00203 }
00204 this->
Array[
id] = i;
00205
if (
id > this->MaxId )
00206 {
00207 this->MaxId =
id;
00208 }
00209 }
00210
00211 inline vtkIdType vtkLongArray::InsertNextValue(
const long i)
00212 {
00213 this->
InsertValue (++this->MaxId,i);
00214
return this->MaxId;
00215 }
00216
00217
00218
#endif