Clarisse 5.0 SP8 SDK  5.0.5.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Friends | List of all members
CoreArrayView< T > Class Template Reference
Inheritance diagram for CoreArrayView< T >:
CoreBaseType

Public Member Functions

 CoreArrayView (const T *array, unsigned int count, unsigned int stride=sizeof(T))
 Default constructor.
 
template<class U >
 CoreArrayView (const CoreBasicArray< U > &array)
 Implicit constructor from a CoreBasicArray.
 
const unsigned int & get_count () const
 Return the size of the array.
 
const unsigned int & get_stride () const
 Return the byte offset between consecutive items.
 
const T & get_item (unsigned int index) const
 Return the item at the specified index.
 
const T & front () const
 Return first item. Array must not be empty.
 
const T & back () const
 Return last item. Array must not be empty.
 
bool exists (const T &item) const
 returns true if incoming item exists in vector.
 
unsigned int get_index (const T &item) const
 returns item index if found in vector, or CORE_INVALID_INDEX otherwise
 
CoreArrayView< T > sub (unsigned int index, unsigned int count) const
 Get a sub array.
 
const T & operator[] (unsigned int index) const
 
template<class U >
CoreArrayView< T > & operator= (const CoreBasicArray< U > &src)
 assignment operator
 
CoreArrayViewIterator< T > begin (void) const
 Get an iterator on the first item.
 
CoreArrayViewIterator< T > end (void) const
 Get an iterator on the container's end (1 item past the last one)
 
- Public Member Functions inherited from CoreBaseType
bool is_kindof (const CoreClassInfo &cinfo) const
 

Friends

class CoreArrayViewIterator< T >
 

Additional Inherited Members

- Static Public Member Functions inherited from CoreBaseType
static const CoreClassInfoclass_info ()
 Get the type descriptor of this instance.
 

Detailed Description

template<class T>
class CoreArrayView< T >

Class allowing to view the data from an array without modifying it. It optionaly supports padding.

Constructor & Destructor Documentation

template<class T>
CoreArrayView< T >::CoreArrayView ( const T *  array,
unsigned int  count,
unsigned int  stride = sizeof(T) 
)
inline

Default constructor.

Parameters
[in]array,C++array pointer
[in]count,sizeof the array (number of items)
[in]stride,byteoffset between consecutive elements
Note
the given pointer is not freed after destruction
template<class T>
template<class U >
CoreArrayView< T >::CoreArrayView ( const CoreBasicArray< U > &  array)
inline

Implicit constructor from a CoreBasicArray.

Parameters
[in]array,inputbasic array
Note
the given pointer is not freed after destruction and the stride is computed automatically according to the type of the input array

Member Function Documentation

template<class T>
CoreArrayView<T> CoreArrayView< T >::sub ( unsigned int  index,
unsigned int  count 
) const
inline

Get a sub array.

Parameters
[in]indexfirst index from which the sub array must start
[in]countnumber of elements in the sub arrray
Returns
the sub array