GClasses

GClasses::GIndexVec Class Reference

Useful functions for operating on vectors of indexes. More...

#include <GVec.h>

List of all members.

Static Public Member Functions

static void makeIndexVec (size_t *pVec, size_t size)
 Makes a vector of ints where each element contains its index (starting with zero, of course)
static void shuffle (size_t *pVec, size_t size, GRand *pRand)
 Shuffles the vector of ints.
static void setAll (size_t *pVec, size_t value, size_t size)
 Sets all elements to the specified value.
static void copy (size_t *pDest, const size_t *pSource, size_t nDims)
 This just wraps memcpy.
static size_t maxValue (size_t *pVec, size_t size)
 Returns the max value.
static size_t indexOfMax (size_t *pVec, size_t size)
 Returns the index of the max value. In the event of a tie, the smallest index of one of the max values is returned.
static GDomNodeserialize (GDom *pDoc, const size_t *pVec, size_t dims)
 Write the vector to a text format.
static void deserialize (size_t *pVec, GDomListIterator &it)
 Load the vector from a text format. pVec must be large enough to contain all of the elements that remain in "it".

Detailed Description

Useful functions for operating on vectors of indexes.


Member Function Documentation

static void GClasses::GIndexVec::copy ( size_t *  pDest,
const size_t *  pSource,
size_t  nDims 
) [static]

This just wraps memcpy.

static void GClasses::GIndexVec::deserialize ( size_t *  pVec,
GDomListIterator it 
) [static]

Load the vector from a text format. pVec must be large enough to contain all of the elements that remain in "it".

static size_t GClasses::GIndexVec::indexOfMax ( size_t *  pVec,
size_t  size 
) [static]

Returns the index of the max value. In the event of a tie, the smallest index of one of the max values is returned.

static void GClasses::GIndexVec::makeIndexVec ( size_t *  pVec,
size_t  size 
) [static]

Makes a vector of ints where each element contains its index (starting with zero, of course)

static size_t GClasses::GIndexVec::maxValue ( size_t *  pVec,
size_t  size 
) [static]

Returns the max value.

static GDomNode* GClasses::GIndexVec::serialize ( GDom pDoc,
const size_t *  pVec,
size_t  dims 
) [static]

Write the vector to a text format.

static void GClasses::GIndexVec::setAll ( size_t *  pVec,
size_t  value,
size_t  size 
) [static]

Sets all elements to the specified value.

static void GClasses::GIndexVec::shuffle ( size_t *  pVec,
size_t  size,
GRand pRand 
) [static]

Shuffles the vector of ints.