Tizen Native API

Base class to handle the memory of simple vector. More...

Inheritance diagram for Dali::VectorBase:
Dali::VectorAlgorithms< IsTrivial > Dali::VectorAlgorithms< false > Dali::VectorAlgorithms< IsTrivialType > Dali::Vector< T, IsTrivialType >

Public Types

typedef std::size_t SizeType
 Size type.

Public Member Functions

SizeType Count () const
 This method is inlined as its needed frequently for Vector::End() iterator.
SizeType Size () const
 Gets the count of elements in this vector.
SizeType Capacity () const
 Gets the capacity of this vector.
void Release ()
 Release the data.

Protected Member Functions

 VectorBase ()
 Default constructor. Does not allocate space.
 ~VectorBase ()
 Destructor.
void SetCount (SizeType count)
 Helper to set the count.
void Reserve (SizeType count, SizeType elementSize)
 Reserve space in the vector.
void Copy (const VectorBase &vector, SizeType elementSize)
 Copy a vector.
void Swap (VectorBase &vector)
 Swap the contents of two vectors.
void Erase (char *address, SizeType elementSize)
 Erase an element.
char * Erase (char *first, char *last, SizeType elementSize)
 Erase a range of elements.
void CopyMemory (char *destination, const char *source, size_t numberOfBytes)
 Copies a number of bytes from source to destination.

Protected Attributes

void * mData
 Pointer to the data.

Detailed Description

Base class to handle the memory of simple vector.

Memory layout is such that it has two std::size_t to hold the count and capacity of the vector. VectorBase::mData is adjusted so that it points to the beginning of the first real item so that iterating the items is quick.

Since :
2.4

Member Typedef Documentation


Constructor & Destructor Documentation

Default constructor. Does not allocate space.

Since :
2.4

Destructor.

Does not release the space. Derived class needs to call Release. Not virtual as should not be called directly and we do not want a vtable for this class as it would unnecessarily increase size.

Since :
2.4

Member Function Documentation

Gets the capacity of this vector.

Since :
2.4
Returns:
The capacity of this vector.
void Dali::VectorBase::Copy ( const VectorBase vector,
SizeType  elementSize 
) [protected]
void Dali::VectorBase::CopyMemory ( char *  destination,
const char *  source,
size_t  numberOfBytes 
) [protected]

Copies a number of bytes from source to destination.

source and destination must not overlap.

Since :
2.4
Parameters:
[in]destinationPointer to the destination address.
[in]sourcePointer to the source address.
[in]numberOfBytesThe number of bytes to be copied.

This method is inlined as its needed frequently for Vector::End() iterator.

Since :
2.4
Returns:
The count of elements in this vector.
void Dali::VectorBase::Erase ( char *  address,
SizeType  elementSize 
) [protected]

Erase an element.

Does not change capacity.

Since :
2.4
Parameters:
[in]addressAdress to erase from.
[in]elementSizeSize to erase.
Precondition:
Last element cannot be erased as there is nothing to move.

Reimplemented in Dali::VectorAlgorithms< IsTrivial >, Dali::VectorAlgorithms< TypeTraits< SlotConnection * >::IS_TRIVIAL_TYPE==true >, Dali::VectorAlgorithms< IsTrivialType >, and Dali::VectorAlgorithms< TypeTraits< SignalConnection * >::IS_TRIVIAL_TYPE==true >.

char* Dali::VectorBase::Erase ( char *  first,
char *  last,
SizeType  elementSize 
) [protected]

Erase a range of elements.

Does not change capacity.

Since :
2.4
Parameters:
[in]firstAddress to the first element to be erased.
[in]lastAddress to the last element to be erased.
[in]elementSizeSize of one of the elements to be erased.
Returns:
Address pointing to the next element of the last one.

Reimplemented in Dali::VectorAlgorithms< IsTrivial >, Dali::VectorAlgorithms< TypeTraits< SlotConnection * >::IS_TRIVIAL_TYPE==true >, Dali::VectorAlgorithms< IsTrivialType >, and Dali::VectorAlgorithms< TypeTraits< SignalConnection * >::IS_TRIVIAL_TYPE==true >.

void Dali::VectorBase::Reserve ( SizeType  count,
SizeType  elementSize 
) [protected]

Reserve space in the vector.

Since :
2.4
Parameters:
[in]countCount of elements to reserve.
[in]elementSizeSize of a single element.

Reimplemented in Dali::VectorAlgorithms< IsTrivial >, Dali::VectorAlgorithms< TypeTraits< SlotConnection * >::IS_TRIVIAL_TYPE==true >, Dali::VectorAlgorithms< IsTrivialType >, and Dali::VectorAlgorithms< TypeTraits< SignalConnection * >::IS_TRIVIAL_TYPE==true >.

void Dali::VectorBase::SetCount ( SizeType  count) [protected]

Helper to set the count.

Since :
2.4
Parameters:
[in]countNumber of elements in the vector.

Gets the count of elements in this vector.

Since :
2.4
Returns:
The count of elements in this vector.
void Dali::VectorBase::Swap ( VectorBase vector) [protected]

Swap the contents of two vectors.

Since :
2.4
Parameters:
[in]vectorVector to swap with.