Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends

dbArray< T > Class Template Reference

#include <array.h>

Inheritance diagram for dbArray< T >:
dbAnyArray

List of all members.

Public Member Functions

dbFieldDescriptordbDescribeComponents (dbFieldDescriptor *fd)
 dbArray ()
 dbArray (size_t size)
 dbArray (T const *ptr, size_t size, size_t allocate=0)
 dbArray (dbArray< T > const &arr)
 ~dbArray ()
dbArray< T > & operator= (dbArray< T > const &arr)
T const & last ()
void assign (T const *ptr, size_t size, bool copy=true)
T const & operator[] (size_t index) const
void putat (size_t index, T const &value)
T const & getat (size_t index) const
void clear ()
void resize (size_t size)
void append (T const &value)
bool contains (T const &value)
bool appendUnique (T const &value)
void insert (T const &value, size_t index=0)
void remove (size_t index)
T const * get () const
T * update ()
size_t length () const
void const * base () const

Protected Member Functions

void memcpy (T *dst, T const *src, size_t len)
void memmove (T *dst, T const *src, size_t len)

Static Protected Member Functions

static void arrayAllocator (dbAnyArray *aArray, void *data, size_t length)

Protected Attributes

T * data
size_t allocated
size_t len

Friends

class dbTableDescriptor

Detailed Description

template<class T>
class dbArray< T >

Template for arrays


Constructor & Destructor Documentation

template<class T>
dbArray< T >::dbArray (  )  [inline]

Default constructor

template<class T>
dbArray< T >::dbArray ( size_t  size  )  [inline]

Construct array with specified length

Parameters:
size array length
template<class T>
dbArray< T >::dbArray ( T const *  ptr,
size_t  size,
size_t  allocate = 0 
) [inline]

Construct array with specified content

Parameters:
ptr pointer to the elements
size size of array
allocate if 0, then array will just points to specified location of elements, otherwise elements will be copied to the created buffer
template<class T>
dbArray< T >::dbArray ( dbArray< T > const &  arr  )  [inline]

Copy constructor

Parameters:
arr source array
template<class T>
dbArray< T >::~dbArray (  )  [inline]

Destructor


Member Function Documentation

template<class T>
void dbArray< T >::append ( T const &  value  )  [inline]

Append value to the array

Parameters:
value appended element
template<class T>
bool dbArray< T >::appendUnique ( T const &  value  )  [inline]

Append value to the array, only if the value isn't already there

Parameters:
value appended element
template<class T>
void dbArray< T >::assign ( T const *  ptr,
size_t  size,
bool  copy = true 
) [inline]

Assign content to the array

Parameters:
ptr pointer to the assigned elements
size number of elements
copy if 0, then array will just points to specified location of elements, otherwise elements will be copied to the created buffer
void const* dbAnyArray::base (  )  const [inline, inherited]

Get pointer to array elements. You should not update them directly.

Returns:
pointer to array element
template<class T>
void dbArray< T >::clear (  )  [inline]

Make array empty

template<class T>
bool dbArray< T >::contains ( T const &  value  )  [inline]

Return true if the array contains the given item

Parameters:
value element

Referenced by dbArray< dbReference< Manager > >::appendUnique().

template<class T>
T const* dbArray< T >::get (  )  const [inline]

Get pointer to array elements. You should not directly change them.

Returns:
array elements
template<class T>
T const& dbArray< T >::getat ( size_t  index  )  const [inline]

Get array element with specified index.

Parameters:
index element index
Returns:
element with specified index
template<class T>
void dbArray< T >::insert ( T const &  value,
size_t  index = 0 
) [inline]

Insert element in the array at specified position

Parameters:
value inserted value
index insert position

Referenced by dbArray< dbReference< Manager > >::append(), and dbArray< dbReference< Manager > >::appendUnique().

template<class T>
T const& dbArray< T >::last (  )  [inline]

Get last element of the array

Returns:
last element of the array
size_t dbAnyArray::length (  )  const [inline, inherited]

Get number of elements

Returns:
array length
template<class T>
dbArray<T>& dbArray< T >::operator= ( dbArray< T > const &  arr  )  [inline]

Assignment operator

Returns:
this
template<class T>
T const& dbArray< T >::operator[] ( size_t  index  )  const [inline]

Get array element with specified index.

Parameters:
index element index
Returns:
element with specified index
template<class T>
void dbArray< T >::putat ( size_t  index,
T const &  value 
) [inline]

Store element at the specified position

Parameters:
index element index
value stored element value
template<class T>
void dbArray< T >::remove ( size_t  index  )  [inline]

Remove element a specified position.

Parameters:
index position of the deleted element
template<class T>
void dbArray< T >::resize ( size_t  size  )  [inline]

Resize array

Parameters:
size new array size
template<class T>
T* dbArray< T >::update (  )  [inline]

Get pointer to array elements to perform update.

Returns:
array elements

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