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
|
/*=========================================================================
Program: Visualization Toolkit
Module: vtkCharArray.h
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.
=========================================================================*/
/**
* @class vtkCharArray
* @brief dynamic, self-adjusting array of char
*
* vtkCharArray is an array of values of type char. It provides
* methods for insertion and retrieval of values and will
* automatically resize itself to hold new data.
*
* @warning
* This class should be avoided in favor of either
* vtkSignedCharArray or vtkUnsignedCharArray. On some systems
* the underlying data will be stored as unsigned chars and others
* it will be stored as signed chars. Additionally, saving this
* array out and then reading it back in it could be transformed to
* a vtkSignedCharArray or vtkUnsignedCharArray and if that happens
* the result of a vtkCharArray::SafeDownCast() of that pointer will be
* a null pointer.
*
* @sa
* vtkSignedCharArray vtkUnsignedCharArray
*/
#ifndef vtkCharArray_h
#define vtkCharArray_h
#include "vtkAOSDataArrayTemplate.h" // Real Superclass
#include "vtkCommonCoreModule.h" // For export macro
#include "vtkDataArray.h"
// Fake the superclass for the wrappers.
#ifndef __VTK_WRAP__
#define vtkDataArray vtkAOSDataArrayTemplate<char>
#endif
VTK_ABI_NAMESPACE_BEGIN
class VTKCOMMONCORE_EXPORT vtkCharArray : public vtkDataArray
{
public:
vtkTypeMacro(vtkCharArray, vtkDataArray);
#ifndef __VTK_WRAP__
#undef vtkDataArray
#endif
static vtkCharArray* New();
static vtkCharArray* ExtendedNew();
void PrintSelf(ostream& os, vtkIndent indent) override;
// This macro expands to the set of method declarations that
// make up the interface of vtkAOSDataArrayTemplate, which is ignored
// by the wrappers.
#if defined(__VTK_WRAP__) || defined(__WRAP_GCCXML__)
vtkCreateWrappedArrayInterface(char);
#endif
/**
* A faster alternative to SafeDownCast for downcasting vtkAbstractArrays.
*/
static vtkCharArray* FastDownCast(vtkAbstractArray* source)
{
return static_cast<vtkCharArray*>(Superclass::FastDownCast(source));
}
/**
* Get the minimum data value in its native type.
*/
static char GetDataTypeValueMin() { return VTK_CHAR_MIN; }
/**
* Get the maximum data value in its native type.
*/
static char GetDataTypeValueMax() { return VTK_CHAR_MAX; }
protected:
vtkCharArray();
~vtkCharArray() override;
private:
typedef vtkAOSDataArrayTemplate<char> RealSuperclass;
vtkCharArray(const vtkCharArray&) = delete;
void operator=(const vtkCharArray&) = delete;
};
// Define vtkArrayDownCast implementation:
vtkArrayDownCast_FastCastMacro(vtkCharArray);
VTK_ABI_NAMESPACE_END
#endif
|