UT_Vector3Array Class Reference

#include <UT_Vector3Array.h>

List of all members.

Public Member Functions

 UT_Vector3Array (unsigned int sz=0)
 Trivial constructor and destructor:.
 UT_Vector3Array (unsigned int sz, unsigned int count)
virtual ~UT_Vector3Array (void)
 UT_Vector3Array (const UT_Vector3Array &a)
unsigned int append (void)
unsigned int append (const UT_Vector3 &t)
unsigned int insert (unsigned int idx)
unsigned int insert (const UT_Vector3 &t, unsigned int idx)
unsigned int concat (const UT_Vector3Array &a)
 Takes another pointer array and concatenate it onto my end.
unsigned int multipleInsert (unsigned int idx, unsigned int count)
 Insert an element "count" times at the given index. Return the index.
unsigned int append (const UT_Vector3 &t, int(*compare)(const UT_Vector3 *t1, const UT_Vector3 *t2))
unsigned int insert (const UT_Vector3 &t, unsigned int index, int(*compare)(const UT_Vector3 *t1, const UT_Vector3 *t2))
unsigned int insertAt (const UT_Vector3 &t, unsigned int idx)
int remove (const UT_Vector3 &t, int(*compare)(const UT_Vector3 *t1, const UT_Vector3 *t2))
int removeIndex (unsigned int aindex)
int shift (unsigned int srcIdx, unsigned int destIdx, unsigned int howMany)
void cycle (int howMany)
 Performs a cyclical shift of the entries by howMany.
void constant (fpreal v=0)
void constant (const UT_Vector3 &v)
int find (const UT_Vector3 &t, unsigned int s=0) const
int find (const UT_Vector3 &t, int(*compare)(const UT_Vector3 *t1, const UT_Vector3 *t2), unsigned int s=0) const
int find (const void *any, int(*compare)(const UT_Vector3 *t1, const UT_Vector3 *t2), unsigned int s=0) const
int index (const UT_Vector3 &t) const
int safeIndex (const UT_Vector3 &t) const
void sort (int(*compare)(const UT_Vector3 *t1, const UT_Vector3 *t2))
void resize (unsigned int sz, unsigned short copyFlag=1)
void resizeIfNeeded (uint sz, bool copyFlag=true)
uint capacity (void) const
int64 getMemoryUsage () const
uint entries (void) const
bool isEmpty (void) const
void entries (unsigned int ne)
 Set the number of entries. Normally, you should not have to use it.
UT_Vector3Arrayoperator= (const UT_Vector3Array &a)
int operator== (const UT_Vector3Array &a) const
int isEqual (const UT_Vector3Array &a, int(*compare)(const UT_Vector3 *t1, const UT_Vector3 *t2)) const
UT_Vector3operator() (unsigned int i)
const UT_Vector3operator() (unsigned int i) const
UT_Vector3operator[] (unsigned int i)
const UT_Vector3operator[] (unsigned int i) const
UT_Vector3last ()
UT_Vector3 last () const
unsigned int apply (int(*applyFct)(UT_Vector3 &t, void *d), void *d)
const UT_Vector3getRawArray (void) const
UT_Vector3array (void)
int remove (const UT_Vector3 &t)
int remove (unsigned int aindex)


Detailed Description

Definition at line 29 of file UT_Vector3Array.h.


Constructor & Destructor Documentation

UT_Vector3Array::UT_Vector3Array ( unsigned int  sz = 0  )  [inline, explicit]

Trivial constructor and destructor:.

Definition at line 32 of file UT_Vector3Array.h.

UT_Vector3Array::UT_Vector3Array ( unsigned int  sz,
unsigned int  count 
)

virtual UT_Vector3Array::~UT_Vector3Array ( void   )  [virtual]

UT_Vector3Array::UT_Vector3Array ( const UT_Vector3Array a  ) 

Copy constructor that uses operator '=' to assign each of a's UT_Vector3 to this array.


Member Function Documentation

unsigned int UT_Vector3Array::append ( const UT_Vector3 t,
int(*)(const UT_Vector3 *t1, const UT_Vector3 *t2)  compare 
)

Two more insert() methods that check for duplicates in the array, assuming that the array is sorted.

unsigned int UT_Vector3Array::append ( const UT_Vector3 t  ) 

unsigned int UT_Vector3Array::append ( void   )  [inline]

Append an element to the current entries and return its index in the array, or insert the element at a specified position; if necessary, insert() grows the array to accommodate the element. The insert methods use the assignment operator '=' to place the UT_Vector3 into the right spot; be aware that '=' works differently on objects and pointers. If UT_Vector3 is an object that uses the default '=' operator, the result of insert() will be a shallow copy of t, and not t itself. So, if what you really want to do is create a new object inside the array, first grow the array to a good size, then create your object as follows: UT_Vector3Array<GeoPoint> arr(3); GeoPoint *p = new (&arr[0]) GeoPoint(....); Use the subscript operators instead of insert() if you are appending to the array, or if you don't mind overwriting the element already inserted at the given index.

Definition at line 60 of file UT_Vector3Array.h.

unsigned int UT_Vector3Array::apply ( int(*)(UT_Vector3 &t, void *d)  applyFct,
void *  d 
)

Apply a user-defined function to each element of the array as int as the function returns zero. If applyFct returns 1, apply() stops traversing the list and returns the current index; otherwise, apply() returns the number of entries.

UT_Vector3* UT_Vector3Array::array ( void   )  [inline]

Definition at line 227 of file UT_Vector3Array.h.

uint UT_Vector3Array::capacity ( void   )  const [inline]

Query the allocated length of the array or the number of elements in the array: capacity() >= entries().

Definition at line 169 of file UT_Vector3Array.h.

unsigned int UT_Vector3Array::concat ( const UT_Vector3Array a  ) 

Takes another pointer array and concatenate it onto my end.

void UT_Vector3Array::constant ( const UT_Vector3 v  ) 

void UT_Vector3Array::constant ( fpreal  v = 0  ) 

void UT_Vector3Array::cycle ( int  howMany  ) 

Performs a cyclical shift of the entries by howMany.

void UT_Vector3Array::entries ( unsigned int  ne  )  [inline]

Set the number of entries. Normally, you should not have to use it.

Definition at line 175 of file UT_Vector3Array.h.

uint UT_Vector3Array::entries ( void   )  const [inline]

Definition at line 171 of file UT_Vector3Array.h.

int UT_Vector3Array::find ( const void *  any,
int(*)(const UT_Vector3 *t1, const UT_Vector3 *t2)  compare,
unsigned int  s = 0 
) const

Search for 'any' until compare() returns 0 and return the index; otherwise return -1. The array is assumed to be sorted.

int UT_Vector3Array::find ( const UT_Vector3 t,
int(*)(const UT_Vector3 *t1, const UT_Vector3 *t2)  compare,
unsigned int  s = 0 
) const

int UT_Vector3Array::find ( const UT_Vector3 t,
unsigned int  s = 0 
) const

Search for t in one of two ways: linearly using the '==' operator, or binary using the function specified in the parameter list respectively. find() returns the index of the matching element or (int)-1. Parameter s indicates the index to start the search at.

int64 UT_Vector3Array::getMemoryUsage ( void   )  const [inline]

Definition at line 170 of file UT_Vector3Array.h.

const UT_Vector3* UT_Vector3Array::getRawArray ( void   )  const [inline]

Definition at line 226 of file UT_Vector3Array.h.

int UT_Vector3Array::index ( const UT_Vector3 t  )  const [inline]

The fastest search possible, which does pointer arithmetic to find the index of the element. WARNING: index() does no out-of-bounds checking.

Definition at line 146 of file UT_Vector3Array.h.

unsigned int UT_Vector3Array::insert ( const UT_Vector3 t,
unsigned int  index,
int(*)(const UT_Vector3 *t1, const UT_Vector3 *t2)  compare 
)

unsigned int UT_Vector3Array::insert ( const UT_Vector3 t,
unsigned int  idx 
)

unsigned int UT_Vector3Array::insert ( unsigned int  idx  ) 

unsigned int UT_Vector3Array::insertAt ( const UT_Vector3 t,
unsigned int  idx 
)

An alias for unique element insertion at a certain index. Also used by the other insertion methods.

bool UT_Vector3Array::isEmpty ( void   )  const [inline]

Definition at line 172 of file UT_Vector3Array.h.

int UT_Vector3Array::isEqual ( const UT_Vector3Array a,
int(*)(const UT_Vector3 *t1, const UT_Vector3 *t2)  compare 
) const

UT_Vector3 UT_Vector3Array::last (  )  const [inline]

Definition at line 214 of file UT_Vector3Array.h.

UT_Vector3& UT_Vector3Array::last (  )  [inline]

Definition at line 209 of file UT_Vector3Array.h.

unsigned int UT_Vector3Array::multipleInsert ( unsigned int  idx,
unsigned int  count 
)

Insert an element "count" times at the given index. Return the index.

const UT_Vector3& UT_Vector3Array::operator() ( unsigned int  i  )  const [inline]

Definition at line 198 of file UT_Vector3Array.h.

UT_Vector3& UT_Vector3Array::operator() ( unsigned int  i  )  [inline]

Subscript operators. operator() does NOT do any bound checking, while the non-const operator[] grows the array to accommodate the given index

Definition at line 193 of file UT_Vector3Array.h.

UT_Vector3Array& UT_Vector3Array::operator= ( const UT_Vector3Array a  ) 

Assign array a to this array by copying each of a's UT_Vector3 with the '=' operator.

int UT_Vector3Array::operator== ( const UT_Vector3Array a  )  const

Compare two array and return 1 if they are equal and 0 otherwise. Two UT_Vector3 are checked against each other using operator '==' or compare() respectively. Arrays of different size but equal number of entries are checked for member-wise equality. t1 and t2 must point to UT_Vector3.

const UT_Vector3& UT_Vector3Array::operator[] ( unsigned int  i  )  const [inline]

Definition at line 204 of file UT_Vector3Array.h.

UT_Vector3& UT_Vector3Array::operator[] ( unsigned int  i  ) 

int UT_Vector3Array::remove ( const UT_Vector3 t,
int(*)(const UT_Vector3 *t1, const UT_Vector3 *t2)  compare 
)

More remove() methods that search for the object to be removed with a user-defined comparison function. These methods assume the array is sorted. t1 and t2 must be pointers to UT_Vector3. The methods return the last (removed) object index.

int UT_Vector3Array::remove ( unsigned int  aindex  )  [inline]

Remove one element from the array given the element itself or its position in the list, and fill the gap by shifting the elements down by one position. Both methods return the index if successful, and (int)-1 if the element is not found. The method that takes an index argument does not return a reference to the object for safety purposes: if UT_Vector3 is an object, then when the array is shrunk the memory previously used by UT_Vector3 will be overwritten by the next element.

Definition at line 97 of file UT_Vector3Array.h.

int UT_Vector3Array::remove ( const UT_Vector3 t  ) 

Remove one element from the array given the element itself or its position in the list, and fill the gap by shifting the elements down by one position. Both methods return the index if successful, and (int)-1 if the element is not found. The method that takes an index argument does not return a reference to the object for safety purposes: if UT_Vector3 is an object, then when the array is shrunk the memory previously used by UT_Vector3 will be overwritten by the next element.

int UT_Vector3Array::removeIndex ( unsigned int  aindex  )  [inline]

Alias for remove (unsigned int index), to be consistent with rest of the UT_xxxArray classes

Definition at line 113 of file UT_Vector3Array.h.

void UT_Vector3Array::resize ( unsigned int  sz,
unsigned short  copyFlag = 1 
)

Resize the array, ie. grow it or shrink it. If copyFlag is 1, the function copies the data after reallocating space for the array.

void UT_Vector3Array::resizeIfNeeded ( uint  sz,
bool  copyFlag = true 
) [inline]

Definition at line 161 of file UT_Vector3Array.h.

int UT_Vector3Array::safeIndex ( const UT_Vector3 t  )  const [inline]

Definition at line 147 of file UT_Vector3Array.h.

int UT_Vector3Array::shift ( unsigned int  srcIdx,
unsigned int  destIdx,
unsigned int  howMany 
)

Move howMany objects starting at index srcIndex to destIndex; Method returns 0 if OK, -1 if overflow.

void UT_Vector3Array::sort ( int(*)(const UT_Vector3 *t1, const UT_Vector3 *t2)  compare  ) 

Sort the array using a comparison function that you must provide. t1 and t2 are pointers to UT_Vector3.


The documentation for this class was generated from the following file:

Generated on Fri May 25 00:10:55 2012 for HDK by  doxygen 1.5.9