#include <vtkStringArray.h>
Points and cells may sometimes have associated data that are stored as strings, e.g. many information visualization projects. This class provides a reasonably clean way to store and access those.
If you'd like to look into modifying the wrappers to handle this properly, go right ahead...
Definition at line 54 of file vtkStringArray.h.
vtkStringArray::vtkStringArray | ( | vtkIdType | numComp = 1 |
) | [protected] |
vtkStringArray::~vtkStringArray | ( | ) | [protected] |
static vtkStringArray* vtkStringArray::New | ( | ) | [static] |
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
Reimplemented from vtkObject.
virtual const char* vtkStringArray::GetClassName | ( | ) | [virtual] |
Reimplemented from vtkAbstractArray.
static int vtkStringArray::IsTypeOf | ( | const char * | name | ) | [static] |
Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h.
Reimplemented from vtkAbstractArray.
virtual int vtkStringArray::IsA | ( | const char * | name | ) | [virtual] |
Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h.
Reimplemented from vtkAbstractArray.
static vtkStringArray* vtkStringArray::SafeDownCast | ( | vtkObject * | o | ) | [static] |
Reimplemented from vtkAbstractArray.
void vtkStringArray::PrintSelf | ( | ostream & | os, | |
vtkIndent | indent | |||
) | [virtual] |
Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.
Reimplemented from vtkAbstractArray.
int vtkStringArray::GetDataType | ( | ) | [inline, virtual] |
Get the data type.
Implements vtkAbstractArray.
Definition at line 69 of file vtkStringArray.h.
References VTK_STRING.
bool vtkStringArray::IsNumeric | ( | ) | [inline, virtual] |
Creates an array for dataType where dataType is one of VTK_BIT, VTK_CHAR, VTK_UNSIGNED_CHAR, VTK_SHORT, VTK_UNSIGNED_SHORT, VTK_INT, VTK_UNSIGNED_INT, VTK_LONG, VTK_UNSIGNED_LONG, VTK_DOUBLE, VTK_DOUBLE, VTK_ID_TYPE, VTK_STRING, VTK_CELL. Note that the data array returned has be deleted by the user.
This method is here to make backward compatibility easier. It must return true if and only if an array contains numeric data.
Implements vtkAbstractArray.
Definition at line 73 of file vtkStringArray.h.
void vtkStringArray::Initialize | ( | ) | [virtual] |
Release storage and reset array to initial state.
Implements vtkAbstractArray.
int vtkStringArray::GetDataTypeSize | ( | ) | [virtual] |
Return the size of the data type. WARNING: This may not mean what you expect with strings. It will return sizeof(vtkstd::string) and not take into account the data included in any particular string.
Implements vtkAbstractArray.
void vtkStringArray::Squeeze | ( | ) | [inline, virtual] |
Free any unnecessary memory. Resize object to just fit data requirement. Reclaims extra memory.
Implements vtkAbstractArray.
Definition at line 85 of file vtkStringArray.h.
int vtkStringArray::Resize | ( | vtkIdType | numTuples | ) | [virtual] |
Resize the array while conserving the data.
Implements vtkAbstractArray.
void vtkStringArray::GetValues | ( | vtkIdList * | ptIds, | |
vtkAbstractArray * | output | |||
) | [virtual] |
Given a list of indices, return an array of values. You must insure that the output array has been previously allocated with enough space to hold the data and that the types match sufficiently to allow conversion (if necessary).
Implements vtkAbstractArray.
void vtkStringArray::GetValues | ( | vtkIdType | p1, | |
vtkIdType | p2, | |||
vtkAbstractArray * | output | |||
) | [virtual] |
Get the values for the range of indices specified (i.e., p1->p2 inclusive). You must insure that the output array has been previously allocated with enough space to hold the data and that the type of the output array is compatible with the type of this array.
Implements vtkAbstractArray.
void vtkStringArray::CopyValue | ( | int | toIndex, | |
int | fromIndex, | |||
vtkAbstractArray * | sourceArray | |||
) | [virtual] |
Copy a value from a given source array into this array.
Implements vtkAbstractArray.
Allocate memory for this array. Delete old storage only if necessary. Note that ext is no longer used.
Implements vtkAbstractArray.
vtkStdString& vtkStringArray::GetValue | ( | vtkIdType | id | ) |
Get the data at a particular index.
void vtkStringArray::SetValue | ( | vtkIdType | id, | |
vtkStdString | value | |||
) | [inline] |
Set the data at a particular index. Does not do range checking. Make sure you use the method SetNumberOfValues() before inserting data. BTX
Definition at line 116 of file vtkStringArray.h.
void vtkStringArray::SetValue | ( | vtkIdType | id, | |
const char * | value | |||
) |
void vtkStringArray::SetNumberOfValues | ( | vtkIdType | number | ) |
Specify the number of values for this object to hold. Does an allocation as well as setting the MaxId ivar. Used in conjunction with SetValue() method for fast insertion.
int vtkStringArray::GetNumberOfValues | ( | ) | [inline] |
Definition at line 127 of file vtkStringArray.h.
int vtkStringArray::GetNumberOfElementComponents | ( | ) | [inline, virtual] |
Return the number of components in a single element of the array. For vtkDataArray and its subclasses, this is the number of components in a tuple. Arrays with variable-length elements (such as vtkStringArray and vtkCellArray) should return 0.
Implements vtkAbstractArray.
Definition at line 129 of file vtkStringArray.h.
int vtkStringArray::GetElementComponentSize | ( | ) | [inline, virtual] |
Return the size, in bytes, of the lowest-level element of an array. For vtkDataArray and subclasses this is the size of the data type. For vtkStringArray, this is sizeof(vtkStdString::value_type), which winds up being sizeof(char).
Implements vtkAbstractArray.
Definition at line 130 of file vtkStringArray.h.
void vtkStringArray::InsertValue | ( | vtkIdType | id, | |
vtkStdString | f | |||
) |
Insert data at a specified position in the array. BTX
void vtkStringArray::InsertValue | ( | vtkIdType | id, | |
const char * | val | |||
) |
vtkIdType vtkStringArray::InsertNextValue | ( | vtkStdString | f | ) |
Insert data at the end of the array. Return its location in the array. BTX
vtkIdType vtkStringArray::InsertNextValue | ( | const char * | f | ) |
vtkStdString* vtkStringArray::WritePointer | ( | vtkIdType | id, | |
vtkIdType | number | |||
) |
Get the address of a particular data index. Make sure data is allocated for the number of items requested. Set MaxId according to the number of data values requested.
vtkStdString* vtkStringArray::GetPointer | ( | vtkIdType | id | ) | [inline] |
Get the address of a particular data index. Performs no checks to verify that the memory has been allocated etc.
Definition at line 154 of file vtkStringArray.h.
void* vtkStringArray::GetVoidPointer | ( | vtkIdType | id | ) | [inline, virtual] |
Get the address of a particular data index. Performs no checks to verify that the memory has been allocated etc.
Implements vtkAbstractArray.
Definition at line 155 of file vtkStringArray.h.
void vtkStringArray::DeepCopy | ( | vtkAbstractArray * | aa | ) | [virtual] |
Deep copy of another string array. Will complain and change nothing if the array passed in is not a vtkStringArray.
Implements vtkAbstractArray.
void vtkStringArray::SetArray | ( | vtkStdString * | array, | |
vtkIdType | size, | |||
int | save | |||
) |
This method lets the user specify data to be held by the array. The array argument is a pointer to the data. size is the size of the array supplied by the user. Set save to 1 to keep the class from deleting the array when it cleans up or reallocates memory. The class uses the actual array provided; it does not copy the data from the suppled array.
void vtkStringArray::SetVoidArray | ( | void * | array, | |
vtkIdType | size, | |||
int | save | |||
) | [inline] |
This method lets the user specify data to be held by the array. The array argument is a pointer to the data. size is the size of the array supplied by the user. Set save to 1 to keep the class from deleting the array when it cleans up or reallocates memory. The class uses the actual array provided; it does not copy the data from the suppled array.
Definition at line 173 of file vtkStringArray.h.
unsigned long vtkStringArray::GetActualMemorySize | ( | ) | [virtual] |
Return the memory in kilobytes consumed by this data array. Used to support streaming and reading/writing data. The value returned is guaranteed to be greater than or equal to the memory required to actually represent the data represented by this object. The information returned is valid only after the pipeline has been updated. This function takes into account the size of the contents of the strings as well as the string containers themselves.
Implements vtkAbstractArray.
void vtkStringArray::ConvertToContiguous | ( | vtkDataArray ** | Data, | |
vtkIdTypeArray ** | Offsets | |||
) | [virtual] |
Flatten an arbitrary array into two separate numeric arrays. The first contains all the data in the source array; the second, the index of the end of each element. This function is meant to assist reading and writing arrays with variable-length elements such as vtkStringArray and vtkCellArray. The arrays will be created within the method body: the caller is responsible for deleting them when no longer needed.
For example, a string array with the elements "This" "Is" "A" "Test" would be converted into the following two arrays: Data: (unsigned char array) ThisIsATest Offsets: 3 5 6 10 vtkDataArray also implements this method, although in practice you shouldn't need it. It ignores the offsets array and takes its tuple-size information from the data array.
Implements vtkAbstractArray.
void vtkStringArray::ConvertFromContiguous | ( | vtkDataArray * | Data, | |
vtkIdTypeArray * | Offsets | |||
) | [virtual] |
This is the inverse of ConvertToContiguous(), above.
Implements vtkAbstractArray.
vtkStdString* vtkStringArray::ResizeAndExtend | ( | vtkIdType | sz | ) | [protected] |
vtkStdString* vtkStringArray::Array [protected] |
Definition at line 194 of file vtkStringArray.h.
int vtkStringArray::SaveUserArray [protected] |
Definition at line 197 of file vtkStringArray.h.