HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_ValArray< T > Class Template Reference

#include <GA_ArrayDataArray.h>

+ Inheritance diagram for UT_ValArray< T >:

Public Types

typedef int(* Comparator )(const T *, const T *)
 
- Public Types inherited from UT_Array< T >
typedef T value_type
 
typedef int(* Comparator )(const T *, const T *)
 
typedef base_iterator< T, true > iterator
 
typedef base_iterator< const T,
true > 
const_iterator
 
typedef base_iterator< T, false > reverse_iterator
 
typedef base_iterator< const T,
false > 
const_reverse_iterator
 
typedef const_iterator traverser
 

Public Member Functions

 UT_ValArray (const UT_ValArray< T > &src)
 
 UT_ValArray (const UT_Array< T > &src)
 
 UT_ValArray (UT_ValArray< T > &&src) SYS_NOEXCEPT
 
 UT_ValArray (UT_Array< T > &&src) SYS_NOEXCEPT
 
 UT_ValArray (exint capacity=0)
 
 UT_ValArray (exint capacity, exint entries)
 
 UT_ValArray (std::initializer_list< T > init)
 
UT_ValArrayoperator= (const UT_ValArray< T > &src)
 
UT_ValArrayoperator= (const UT_Array< T > &src)
 
UT_ValArrayoperator= (std::initializer_list< T > src)
 
UT_ValArrayoperator= (UT_ValArray< T > &&src)
 
UT_ValArrayoperator= (UT_Array< T > &&src)
 
exint sortAndRemoveDuplicates ()
 
void sort (Comparator compare)
 
template<typename ComparatorBool >
void stdsort (ComparatorBool is_less)
 
void sort ()
 
void sortAscending ()
 
template<typename ComparatorBool >
void stableSort (ComparatorBool is_less)
 
void stableSort ()
 
template<typename ComparatorBool >
T selectNthLargest (int idx, ComparatorBool is_less)
 
T selectNthLargest (int idx)
 
exint uniqueSortedFind (const T &item, Comparator compare) const
 
template<typename ComparatorBool >
exint uniqueSortedFind (const T &item, ComparatorBool is_less) const
 
exint uniqueSortedFind (const T &item) const
 
exint uniqueSortedFindAscending (const T &item) const
 
exint sortedInsert (const T &t, Comparator compare)
 
template<typename ComparatorBool >
exint sortedInsert (const T &t, ComparatorBool is_less)
 
exint sortedInsert (const T &t)
 
exint uniqueSortedInsert (const T &t, Comparator compare)
 
template<typename ComparatorBool >
exint uniqueSortedInsert (const T &t, ComparatorBool is_less)
 
exint uniqueSortedInsert (const T &t)
 
exint uniqueSortedInsertAscending (const T &t)
 
template<typename ComparatorBool >
void merge (const UT_Array< T > &other, int direction, bool allow_dups, ComparatorBool is_less)
 
void merge (const UT_ValArray< T > &other, int direction, bool allow_dups)
 
bool hasSortedSubset (const UT_ValArray< T > &other, Comparator compare=compareElements) const
 
void sortedUnion (const UT_ValArray< T > &other, Comparator compare=compareElements)
 
void sortedUnion (const UT_ValArray< T > &other, UT_ValArray< T > &result, Comparator compare=compareElements) const
 
void sortedIntersection (const UT_ValArray< T > &other, Comparator compare=compareElements)
 
void sortedIntersection (const UT_ValArray< T > &other, UT_ValArray< T > &result, Comparator compare=compareElements) const
 
void sortedSetDifference (const UT_ValArray< T > &other, Comparator compare=compareElements)
 
void sortedSetDifference (const UT_ValArray< T > &other, UT_ValArray< T > &result, Comparator compare=compareElements) const
 
exint heapPush (const T &t, Comparator compare)
 
T heapPop (Comparator compare)
 
int removeZeros ()
 
void collapse ()
 
T sum () const
 Functions which are only specialized for int{32,64}, fpreal{32,64}. More...
 
void display () const
 Prints the constents of the array. More...
 
- Public Member Functions inherited from UT_Array< T >
 UT_Array (const UT_Array< T > &a)
 
 UT_Array (UT_Array< T > &&a) SYS_NOEXCEPT
 Move constructor. Steals the working data from the original. More...
 
 UT_Array (exint capacity, exint size)
 Construct based on given capacity and size. More...
 
 UT_Array (exint capacity=0)
 Construct based on given capacity with a size of 0. More...
 
 UT_Array (std::initializer_list< T > init)
 Construct with the contents of an initializer list. More...
 
 ~UT_Array ()
 
void swap (UT_Array< T > &other)
 
exint append (void)
 
exint append (const T &t)
 
exint append (T &&t)
 
exint append (const T &t, bool check_dup)
 
void append (const T *pt, exint count)
 
void appendMultiple (const T &t, exint count)
 
exint insert (exint index)
 
exint insert (const T &t, exint i)
 
exint insert (T &&t, exint i)
 
template<typename... S>
exint emplace_back (S &&...s)
 
exint uniqueSortedInsert (const T &t, Comparator compare)
 
template<typename ComparatorBool >
exint uniqueSortedInsert (const T &t, ComparatorBool is_less)
 
exint uniqueSortedFind (const T &item, Comparator compare) const
 
template<typename ComparatorBool >
exint uniqueSortedFind (const T &item, ComparatorBool is_less) const
 
template<typename ComparatorBool >
void merge (const UT_Array< T > &other, int direction, bool allow_dups, ComparatorBool is_less)
 
bool hasSortedSubset (const UT_Array< T > &other, Comparator compare) const
 
void sortedUnion (const UT_Array< T > &other, Comparator compare)
 
void sortedUnion (const UT_Array< T > &other, UT_Array< T > &result, Comparator compare) const
 
void sortedIntersection (const UT_Array< T > &other, Comparator compare)
 
void sortedIntersection (const UT_Array< T > &other, UT_Array< T > &result, Comparator compare) const
 
void sortedSetDifference (const UT_Array< T > &other, Comparator compare)
 
void sortedSetDifference (const UT_Array< T > &other, UT_Array< T > &result, Comparator compare) const
 
exint heapPush (const T &t, Comparator compare)
 
T heapPop (Comparator compare)
 
const TheapMax () const
 
exint concat (const UT_Array< T > &a)
 Takes another T array and concatenate it onto my end. More...
 
exint multipleInsert (exint index, exint count)
 Insert an element "count" times at the given index. Return the index. More...
 
exint insertAt (const T &t, exint index)
 
bool isValidIndex (exint index) const
 Return true if given index is valid. More...
 
exint findAndRemove (const T &t)
 
exint removeIndex (exint index)
 
SYS_FORCE_INLINE void removeLast ()
 
void removeRange (exint begin_i, exint end_i)
 Remove the range [begin_i,end_i) of elements from the array. More...
 
void extractRange (exint begin_i, exint end_i, UT_Array< T > &dest)
 
template<typename IsEqual >
exint removeIf (IsEqual is_equal)
 
template<typename IsEqual >
void collapseIf (IsEqual is_equal)
 Remove all matching elements. Also sets the capacity of the array. More...
 
void move (exint srcIdx, exint destIdx, exint howMany)
 
void cycle (exint howMany)
 Cyclically shifts the entire array by howMany. More...
 
void constant (const T &v)
 Quickly set the array to a single value. More...
 
void zero ()
 Zeros the array if a POD type, else trivial constructs if a class type. More...
 
exint find (const T &t, exint s=0) const
 
exint find (const T &t, Comparator compare) const
 
void reverse ()
 Reverses the array by swapping elements in mirrored locations. More...
 
exint index (const T &t) const
 
exint safeIndex (const T &t) const
 
void sort (Comparator compare)
 
template<typename ComparatorBool >
void stdsort (ComparatorBool is_less)
 Sort using std::sort. The ComparatorBool uses the less-than semantics. More...
 
template<typename ComparatorBool >
void stableSort (ComparatorBool is_less)
 
template<typename I , typename ComparatorBool >
void stableSortIndices (UT_Array< I > &indices, ComparatorBool is_less) const
 
template<typename I , typename ComparatorBool >
void stableArgSort (UT_Array< I > &indices, ComparatorBool is_less) const
 
template<typename K , typename ComparatorBool >
void stableSortByKey (const UT_Array< K > &keys, ComparatorBool is_less)
 
exint sortedRemoveDuplicates ()
 
template<typename CompareEqual >
exint sortedRemoveDuplicatesIf (CompareEqual compare_equal)
 
template<typename ComparatorBool >
void sortAndRemoveDuplicates (ComparatorBool is_less)
 
template<typename ComparatorBool >
T selectNthLargest (exint idx, ComparatorBool is_less)
 
void setCapacity (exint newcapacity)
 
void setCapacityIfNeeded (exint mincapacity)
 
void bumpCapacity (exint mincapacity)
 
void bumpSize (exint newsize)
 
void bumpEntries (exint newsize)
 
exint capacity () const
 
exint size () const
 
exint entries () const
 Alias of size(). size() is preferred. More...
 
bool isEmpty () const
 Returns true iff there are no occupied elements in the array. More...
 
int64 getMemoryUsage (bool inclusive=false) const
 
void setSize (exint newsize)
 
void entries (exint newsize)
 Alias of setSize(). setSize() is preferred. More...
 
void setSizeNoInit (exint newsize)
 
void truncate (exint maxsize)
 Decreases, but never expands, to the given maxsize. More...
 
void clear ()
 Resets list to an empty list. More...
 
UT_Array< T > & operator= (const UT_Array< T > &a)
 
UT_Array< T > & operator= (std::initializer_list< T > ilist)
 Replace the contents with those from the initializer_list ilist. More...
 
UT_Array< T > & operator= (UT_Array< T > &&a)
 Move the contents of array a to this array. More...
 
bool operator== (const UT_Array< T > &a) const
 
bool operator!= (const UT_Array< T > &a) const
 
int isEqual (const UT_Array< T > &a, Comparator compare) const
 
Toperator() (exint i)
 
const Toperator() (exint i) const
 
Toperator[] (exint i)
 
const Toperator[] (exint i) const
 
TforcedRef (exint i)
 
T forcedGet (exint i) const
 
Tlast ()
 
const Tlast () const
 
exint apply (int(*applyFct)(T &t, void *d), void *d)
 
template<typename BinaryOp >
T accumulate (const T &init_value, BinaryOp add) const
 
TgetArray () const
 
const TgetRawArray () const
 
Tarray ()
 
const Tarray () const
 
Tdata ()
 
const Tdata () const
 
TaliasArray (T *newdata)
 
iterator begin ()
 
iterator end ()
 End iterator. More...
 
const_iterator begin () const
 
const_iterator end () const
 End const iterator. Consider using it.atEnd() instead. More...
 
reverse_iterator rbegin ()
 Begin iterating over the array in reverse. More...
 
reverse_iterator rend ()
 End reverse iterator. More...
 
const_reverse_iterator rbegin () const
 Begin iterating over the array in reverse. More...
 
const_reverse_iterator rend () const
 End reverse iterator. Consider using it.atEnd() instead. More...
 
UT_IteratorRange< iteratorrange ()
 
UT_IteratorRange< const_iteratorrange () const
 
UT_IteratorRange
< reverse_iterator
rrange ()
 
UT_IteratorRange
< const_reverse_iterator
rrange () const
 
void removeItem (const reverse_iterator &it)
 Remove item specified by the reverse_iterator. More...
 
void unsafeShareData (UT_Array< T > &src)
 
void unsafeShareData (T *src, exint srcsize)
 
void unsafeShareData (T *src, exint size, exint capacity)
 
void unsafeClearData ()
 
bool isHeapBuffer () const
 Returns true if the data used by the array was allocated on the heap. More...
 
bool isHeapBuffer (T *data) const
 
exint sortedInsert (const T &t, Comparator compare)
 
template<typename ComparatorBool >
exint sortedInsert (const T &t, ComparatorBool is_less)
 

Static Public Member Functions

static bool compareElementsBool (const T &a, const T &b)
 
static int compareElements (const T *a, const T *b)
 
static bool isElementZero (const T &a)
 

Additional Inherited Members

- Protected Member Functions inherited from UT_Array< T >
template<typename S >
exint appendImpl (S &&s)
 
template<typename S >
exint insertImpl (S &&s, exint index)
 Similar to appendImpl() but for insertion. More...
 
template<typename First , typename... Rest>
void validateEmplaceArgs (First &&first, Rest &&...rest) const
 
void validateEmplaceArgs () const
 Base case for validateEmplaceArgs(). More...
 
- Static Protected Member Functions inherited from UT_Array< T >
static constexpr
SYS_FORCE_INLINE bool 
isPOD ()
 
template<typename... S>
static void construct (T &dst, S &&...s)
 
static void copyConstruct (T &dst, const T &src)
 
static void copyConstructRange (T *dst, const T *src, exint n)
 
static void trivialConstruct (T &dst)
 Element Constructor. More...
 
static void trivialConstructRange (T *dst, exint n)
 
static SYS_FORCE_INLINE void trivialDestruct (T &dst)
 Element Destructor. More...
 
static void trivialDestructRange (T *dst, exint n)
 

Detailed Description

template<typename T>
class UT_ValArray< T >

Examples:
DM/DM_BackgroundHook.C, DM/DM_ObjectPathHook.C, euclid/EUC_Expression.C, euclid/EUC_Expression.h, and FS/FS_Background.C.

Definition at line 32 of file GA_ArrayDataArray.h.

Member Typedef Documentation

template<typename T>
typedef int(* UT_ValArray< T >::Comparator)(const T *, const T *)

Definition at line 43 of file UT_ValArray.h.

Constructor & Destructor Documentation

template<typename T>
UT_ValArray< T >::UT_ValArray ( const UT_ValArray< T > &  src)
inlineexplicit

Copy constructor Copy constructor. It duplicates the data. It's marked explicit so that it's not accidentally passed by value. You can always pass by reference and then copy it, if needed. If you have a line like: UT_ValArray<int> a = otherarray; and it really does need to copy instead of referencing, you can rewrite it as: UT_ValArray<int> a(otherarray);

Definition at line 54 of file UT_ValArray.h.

template<typename T>
UT_ValArray< T >::UT_ValArray ( const UT_Array< T > &  src)
inlineexplicit

Definition at line 57 of file UT_ValArray.h.

template<typename T>
UT_ValArray< T >::UT_ValArray ( UT_ValArray< T > &&  src)
inline

Definition at line 60 of file UT_ValArray.h.

template<typename T>
UT_ValArray< T >::UT_ValArray ( UT_Array< T > &&  src)
inline

Definition at line 63 of file UT_ValArray.h.

template<typename T>
UT_ValArray< T >::UT_ValArray ( exint  capacity = 0)
inlineexplicit

Definition at line 66 of file UT_ValArray.h.

template<typename T>
UT_ValArray< T >::UT_ValArray ( exint  capacity,
exint  entries 
)
inline

Definition at line 69 of file UT_ValArray.h.

template<typename T>
UT_ValArray< T >::UT_ValArray ( std::initializer_list< T init)
inlineexplicit

Definition at line 72 of file UT_ValArray.h.

Member Function Documentation

template<typename T>
void UT_ValArray< T >::collapse ( )
inline

Definition at line 302 of file UT_ValArray.h.

template<typename T>
static int UT_ValArray< T >::compareElements ( const T a,
const T b 
)
inlinestatic

Definition at line 115 of file UT_ValArray.h.

template<typename T>
static bool UT_ValArray< T >::compareElementsBool ( const T a,
const T b 
)
inlinestatic

Definition at line 102 of file UT_ValArray.h.

template<typename T>
void UT_ValArray< T >::display ( ) const
inline

Prints the constents of the array.

Definition at line 316 of file UT_ValArray.h.

template<typename T>
bool UT_ValArray< T >::hasSortedSubset ( const UT_ValArray< T > &  other,
Comparator  compare = compareElements 
) const
inline

Definition at line 236 of file UT_ValArray.h.

template<typename T>
T UT_ValArray< T >::heapPop ( Comparator  compare)
inline

Definition at line 286 of file UT_ValArray.h.

template<typename T>
exint UT_ValArray< T >::heapPush ( const T t,
Comparator  compare 
)
inline

Definition at line 282 of file UT_ValArray.h.

template<typename T>
static bool UT_ValArray< T >::isElementZero ( const T a)
inlinestatic

Definition at line 291 of file UT_ValArray.h.

template<typename T>
template<typename ComparatorBool >
void UT_ValArray< T >::merge ( const UT_Array< T > &  other,
int  direction,
bool  allow_dups,
ComparatorBool  is_less 
)
inline

Definition at line 219 of file UT_ValArray.h.

template<typename T>
void UT_ValArray< T >::merge ( const UT_ValArray< T > &  other,
int  direction,
bool  allow_dups 
)
inline

Definition at line 228 of file UT_ValArray.h.

template<typename T>
UT_ValArray& UT_ValArray< T >::operator= ( const UT_ValArray< T > &  src)
inline

Definition at line 76 of file UT_ValArray.h.

template<typename T>
UT_ValArray& UT_ValArray< T >::operator= ( const UT_Array< T > &  src)
inline

Definition at line 81 of file UT_ValArray.h.

template<typename T>
UT_ValArray& UT_ValArray< T >::operator= ( std::initializer_list< T src)
inline

Definition at line 86 of file UT_ValArray.h.

template<typename T>
UT_ValArray& UT_ValArray< T >::operator= ( UT_ValArray< T > &&  src)
inline

Definition at line 91 of file UT_ValArray.h.

template<typename T>
UT_ValArray& UT_ValArray< T >::operator= ( UT_Array< T > &&  src)
inline

Definition at line 96 of file UT_ValArray.h.

template<typename T>
int UT_ValArray< T >::removeZeros ( )
inline

Definition at line 296 of file UT_ValArray.h.

template<typename T>
template<typename ComparatorBool >
T UT_ValArray< T >::selectNthLargest ( int  idx,
ComparatorBool  is_less 
)
inline

Definition at line 153 of file UT_ValArray.h.

template<typename T>
T UT_ValArray< T >::selectNthLargest ( int  idx)
inline

Definition at line 157 of file UT_ValArray.h.

template<typename T>
void UT_ValArray< T >::sort ( Comparator  compare)
inline

Definition at line 124 of file UT_ValArray.h.

template<typename T>
void UT_ValArray< T >::sort ( void  )
inline

Definition at line 133 of file UT_ValArray.h.

template<typename T>
exint UT_ValArray< T >::sortAndRemoveDuplicates ( )
inline

Sort and then remove all duplicate entries. This returns the number of elements removed.

Definition at line 109 of file UT_ValArray.h.

template<typename T>
void UT_ValArray< T >::sortAscending ( )
inline

Definition at line 137 of file UT_ValArray.h.

template<typename T>
exint UT_ValArray< T >::sortedInsert ( const T t,
Comparator  compare 
)
inline

Definition at line 181 of file UT_ValArray.h.

template<typename T>
template<typename ComparatorBool >
exint UT_ValArray< T >::sortedInsert ( const T t,
ComparatorBool  is_less 
)
inline

Definition at line 187 of file UT_ValArray.h.

template<typename T>
exint UT_ValArray< T >::sortedInsert ( const T t)
inline

Definition at line 192 of file UT_ValArray.h.

template<typename T>
void UT_ValArray< T >::sortedIntersection ( const UT_ValArray< T > &  other,
Comparator  compare = compareElements 
)
inline

Definition at line 255 of file UT_ValArray.h.

template<typename T>
void UT_ValArray< T >::sortedIntersection ( const UT_ValArray< T > &  other,
UT_ValArray< T > &  result,
Comparator  compare = compareElements 
) const
inline

Definition at line 261 of file UT_ValArray.h.

template<typename T>
void UT_ValArray< T >::sortedSetDifference ( const UT_ValArray< T > &  other,
Comparator  compare = compareElements 
)
inline

Definition at line 268 of file UT_ValArray.h.

template<typename T>
void UT_ValArray< T >::sortedSetDifference ( const UT_ValArray< T > &  other,
UT_ValArray< T > &  result,
Comparator  compare = compareElements 
) const
inline

Definition at line 274 of file UT_ValArray.h.

template<typename T>
void UT_ValArray< T >::sortedUnion ( const UT_ValArray< T > &  other,
Comparator  compare = compareElements 
)
inline

Definition at line 242 of file UT_ValArray.h.

template<typename T>
void UT_ValArray< T >::sortedUnion ( const UT_ValArray< T > &  other,
UT_ValArray< T > &  result,
Comparator  compare = compareElements 
) const
inline

Definition at line 248 of file UT_ValArray.h.

template<typename T>
template<typename ComparatorBool >
void UT_ValArray< T >::stableSort ( ComparatorBool  is_less)
inline

Definition at line 143 of file UT_ValArray.h.

template<typename T>
void UT_ValArray< T >::stableSort ( )
inline

Definition at line 147 of file UT_ValArray.h.

template<typename T>
template<typename ComparatorBool >
void UT_ValArray< T >::stdsort ( ComparatorBool  is_less)
inline

Definition at line 129 of file UT_ValArray.h.

template<typename T>
T UT_ValArray< T >::sum ( ) const
inline

Functions which are only specialized for int{32,64}, fpreal{32,64}.

Returns the sum of the entries in the array.

Definition at line 310 of file UT_ValArray.h.

template<typename T>
exint UT_ValArray< T >::uniqueSortedFind ( const T item,
Comparator  compare 
) const
inline

Definition at line 162 of file UT_ValArray.h.

template<typename T>
template<typename ComparatorBool >
exint UT_ValArray< T >::uniqueSortedFind ( const T item,
ComparatorBool  is_less 
) const
inline

Definition at line 167 of file UT_ValArray.h.

template<typename T>
exint UT_ValArray< T >::uniqueSortedFind ( const T item) const
inline

Definition at line 171 of file UT_ValArray.h.

template<typename T>
exint UT_ValArray< T >::uniqueSortedFindAscending ( const T item) const
inline

Definition at line 175 of file UT_ValArray.h.

template<typename T>
exint UT_ValArray< T >::uniqueSortedInsert ( const T t,
Comparator  compare 
)
inline

Definition at line 198 of file UT_ValArray.h.

template<typename T>
template<typename ComparatorBool >
exint UT_ValArray< T >::uniqueSortedInsert ( const T t,
ComparatorBool  is_less 
)
inline

Definition at line 204 of file UT_ValArray.h.

template<typename T>
exint UT_ValArray< T >::uniqueSortedInsert ( const T t)
inline

Definition at line 209 of file UT_ValArray.h.

template<typename T>
exint UT_ValArray< T >::uniqueSortedInsertAscending ( const T t)
inline

Definition at line 213 of file UT_ValArray.h.


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