Abstract Field containing an array of values. More...
#include <Inventor/fields/SoSFArray.h>
Public Types | |
enum | CopyPolicy { COPY = SoMemoryObject::COPY, NO_COPY = SoMemoryObject::NO_COPY, NO_COPY_AND_DELETE = SoMemoryObject::NO_COPY_AND_DELETE, NO_COPY_AND_FREE = SoMemoryObject::NO_COPY_AND_FREE } |
enum | DataType { UNSIGNED_BYTE = SbDataType::UNSIGNED_BYTE, UNSIGNED_SHORT = SbDataType::UNSIGNED_SHORT, UNSIGNED_INT32 = SbDataType::UNSIGNED_INT32, SIGNED_BYTE = SbDataType::SIGNED_BYTE, SIGNED_SHORT = SbDataType::SIGNED_SHORT, SIGNED_INT32 = SbDataType::SIGNED_INT32, FLOAT = SbDataType::FLOAT } |
Public Member Functions | |
virtual SoType | getTypeId () const |
const SoSFArray & | operator= (const SoSFArray &f) |
SoSFArray () | |
virtual | ~SoSFArray () |
void * | getValue () const |
DataType | getDataType () const |
void | finishEditing () |
virtual int | operator== (const SoSFArray &f) const |
virtual int | operator!= (const SoSFArray &f) const |
void | setNeverWrite (SbBool neverWrite) |
SbBool | isNeverWrite () |
const SbVec3i32 & | getSize () const |
void * | startEditing (SbVec3i32 &size, SbDataType &dataType) |
virtual size_t | getValueSize () const |
const void * | getValue (SbVec3i32 &size, SbDataType &dataType) const |
void | setValue (const SbVec3i32 &size, const SbDataType &dataType, const void *data, CopyPolicy copy=COPY) |
void | setValue (const SbVec3i32 &size, SoMemoryObject *memObj, CopyPolicy copy) |
SbBool | isEmpty () const |
Static Public Member Functions | |
static SoType | getClassTypeId () |
Abstract Field containing an array of values.
Subclasses of this field can contain a 2D or 3D array of values of a specified type.
SoField, SoSField, SoSFArray2D, SoSFArray3D
SoSFArray may be manipulating some large amounts of memory.
It is therefore convienent to be able to set the memory usage policy dynamically. By default, the memory policy is COPY, which is consistent with other OIV fields. The most likely to be efficient is NO_COPY. See also setNeverWrite.
COPY |
Open Inventor will make a copy of the data (default). |
NO_COPY |
Passed buffer used , user will delete. |
NO_COPY_AND_DELETE |
Passed buffer used, SoSFImage will delete. Use this if memory is allocated with "new". |
NO_COPY_AND_FREE |
Passed buffer used, SoSFImage will free. Use this if memory is allocated with "malloc". |
enum SoSFArray::DataType |
SoSFArray::SoSFArray | ( | ) |
Default constructor.
virtual SoSFArray::~SoSFArray | ( | ) | [virtual] |
Destructor.
void SoSFArray::finishEditing | ( | ) |
Indicates that batch edits have finished.
See startEditing().
static SoType SoSFArray::getClassTypeId | ( | ) | [static] |
Returns the type identifier for this class.
Reimplemented from SoSField.
Reimplemented in SoSFArray2D, and SoSFArray3D.
DataType SoSFArray::getDataType | ( | ) | const [inline] |
Returns the data type of the array.
const SbVec3i32 & SoSFArray::getSize | ( | ) | const [inline] |
Returns the dimensions of the array.
Reimplemented in SoSFArray2D.
virtual SoType SoSFArray::getTypeId | ( | ) | const [virtual] |
Returns the type identifier for this specific instance.
Implements SoTypedObject.
Reimplemented in SoSFArray2D, and SoSFArray3D.
const void* SoSFArray::getValue | ( | SbVec3i32 & | size, | |
SbDataType & | dataType | |||
) | const |
Returns a read-only pointer to the array's values and its dimensions and data type.
void * SoSFArray::getValue | ( | ) | const [inline] |
Returns a read-only pointer to the array's values.
size_t SoSFArray::getValueSize | ( | ) | const [inline, virtual] |
Returns the size in bytes of one data value, e.g.
returns 1 if the data type is UNSIGNED_BYTE.
Reimplemented from SoField.
SbBool SoSFArray::isEmpty | ( | ) | const |
Returns TRUE if the current array is empty.
SbBool SoSFArray::isNeverWrite | ( | ) | [inline] |
Returns the "neverWrite" flag.
virtual int SoSFArray::operator!= | ( | const SoSFArray & | f | ) | const [inline, virtual] |
Returns TRUE if all of the values of this field do not equal those of the given field f.
Reimplemented from SoField.
Copy from another field of same type.
Reimplemented in SoSFArray2D, and SoSFArray3D.
virtual int SoSFArray::operator== | ( | const SoSFArray & | f | ) | const [virtual] |
Returns TRUE if all of the values of this field equal those of the given field f.
If the fields are different types FALSE will always be returned.
Reimplemented from SoField.
Reimplemented in SoSFArray3D.
void SoSFArray::setNeverWrite | ( | SbBool | neverWrite | ) | [inline] |
Sets the "neverWrite" flag.
As this field may have to handle large amounts of data and its representation in an .iv file is not very efficient, it is often a good idea not to allow that data to be written out when required by a write action. By default, the "neverWrite" condition is FALSE.
void SoSFArray::setValue | ( | const SbVec3i32 & | size, | |
SoMemoryObject * | memObj, | |||
CopyPolicy | copy | |||
) |
Fill the array with the specified dimensions and data from an SoMemoryObject using the specified copy policy.
void SoSFArray::setValue | ( | const SbVec3i32 & | size, | |
const SbDataType & | dataType, | |||
const void * | data, | |||
CopyPolicy | copy = COPY | |||
) |
Fill the array with data of the specified dimensions and type using the specified copy policy.
void* SoSFArray::startEditing | ( | SbVec3i32 & | size, | |
SbDataType & | dataType | |||
) |
Returns a pointer to the internally maintained array that can be modified.
The values in the array may be changed, but values cannot be added or removed. It is illegal to call any other editing methods between startEditing() and finishEditing() (e.g. setValue(), etc.). Fields, engines or sensors connected to this field are not triggered until finishEditing() is called. Calling finishEditing() always sets the isDefault() flag to FALSE and informs engines and sensors that the field changed, even if none of the values actually were changed.