/usr/include/vtk-6.3/vtkMappedDataArray.txx is in libvtk6-dev 6.3.0+dfsg1-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | /*==============================================================================
Program: Visualization Toolkit
Module: vtkMappedDataArray.txx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
==============================================================================*/
#ifndef vtkMappedDataArray_txx
#define vtkMappedDataArray_txx
#include "vtkMappedDataArray.h"
#include "vtkVariant.h" // for vtkVariant
//------------------------------------------------------------------------------
template<class Scalar>
vtkMappedDataArray<Scalar>::vtkMappedDataArray()
{
this->TemporaryScalarPointer = NULL;
this->TemporaryScalarPointerSize = 0;
}
//------------------------------------------------------------------------------
template<class Scalar>
vtkMappedDataArray<Scalar>::~vtkMappedDataArray()
{
delete [] this->TemporaryScalarPointer;
this->TemporaryScalarPointer = NULL;
this->TemporaryScalarPointerSize = 0;
}
//------------------------------------------------------------------------------
template<class Scalar>
void * vtkMappedDataArray<Scalar>::GetVoidPointer(vtkIdType id)
{
vtkWarningMacro(<<"GetVoidPointer called. This is very expensive for "
"vtkMappedDataArray subclasses, since the scalar array must "
"be generated for each call. Consider using "
"a vtkTypedDataArrayIterator instead.");
size_t numValues = this->NumberOfComponents * this->GetNumberOfTuples();
if (this->TemporaryScalarPointer &&
this->TemporaryScalarPointerSize != numValues)
{
delete [] this->TemporaryScalarPointer;
this->TemporaryScalarPointer = NULL;
this->TemporaryScalarPointerSize = 0;
}
if (!this->TemporaryScalarPointer)
{
this->TemporaryScalarPointer = new Scalar[numValues];
this->TemporaryScalarPointerSize = numValues;
}
this->ExportToVoidPointer(static_cast<void*>(this->TemporaryScalarPointer));
return static_cast<void*>(this->TemporaryScalarPointer + id);
}
//------------------------------------------------------------------------------
template<class Scalar>
void vtkMappedDataArray<Scalar>::ExportToVoidPointer(void *voidPtr)
{
vtkTypedDataArrayIterator<Scalar> begin(this, 0);
vtkTypedDataArrayIterator<Scalar> end =
begin + (this->NumberOfComponents * this->GetNumberOfTuples());
Scalar *ptr = static_cast<Scalar*>(voidPtr);
while (begin != end)
{
*ptr = *begin;
++begin;
++ptr;
}
}
//------------------------------------------------------------------------------
template<class Scalar>
void vtkMappedDataArray<Scalar>::SetVoidArray(void *, vtkIdType, int)
{
vtkErrorMacro(<<"SetVoidArray not supported for vtkMappedDataArray "
"subclasses.");
return;
}
//------------------------------------------------------------------------------
template<class Scalar>
void vtkMappedDataArray<Scalar>::DataChanged()
{
if (!this->TemporaryScalarPointer)
{
vtkWarningMacro(<<"DataChanged called, but no scalar pointer available.");
return;
}
vtkTypedDataArrayIterator<Scalar> begin(this, 0);
vtkTypedDataArrayIterator<Scalar> end =
begin + this->TemporaryScalarPointerSize;
Scalar *ptr = this->TemporaryScalarPointer;
while (begin != end)
{
*begin = *ptr;
++begin;
++ptr;
}
this->Modified();
}
//------------------------------------------------------------------------------
template<class Scalar> inline vtkMappedDataArray<Scalar>*
vtkMappedDataArray<Scalar>::FastDownCast(vtkAbstractArray *source)
{
switch (source->GetArrayType())
{
case vtkAbstractArray::MappedDataArray:
if (source->GetDataType() == vtkTypeTraits<Scalar>::VTK_TYPE_ID)
{
return static_cast<vtkMappedDataArray<Scalar>*>(source);
}
default:
return NULL;
}
}
//------------------------------------------------------------------------------
template<class Scalar>
void vtkMappedDataArray<Scalar>::PrintSelf(ostream &os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
os << indent << "TemporaryScalarPointer: "
<< this->TemporaryScalarPointer << "\n";
os << indent << "TemporaryScalarPointerSize: "
<< this->TemporaryScalarPointerSize << "\n";
}
//------------------------------------------------------------------------------
template<class Scalar>
void vtkMappedDataArray<Scalar>::Modified()
{
this->vtkTypedDataArray<Scalar>::Modified();
if (this->TemporaryScalarPointer == NULL)
{
return;
}
delete [] this->TemporaryScalarPointer;
this->TemporaryScalarPointer = NULL;
this->TemporaryScalarPointerSize = 0;
}
#endif //vtkMappedDataArray_txx
|