Tizen Native API  4.0
Dali::VectorBase Class Reference

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 Member Functions

SizeType Count () const
 This method is inlined as it's needed frequently for Vector::End() iterator.
SizeType Size () const
 Gets the count of elements in this vector.
bool Empty () const
 @ return if the vector is empty.
SizeType Capacity () const
 Gets the capacity of this vector.
void Release ()
 Releases 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)
 Reserves space in the vector.
void Copy (const VectorBase &vector, SizeType elementSize)
 Copy a vector.
void Swap (VectorBase &vector)
 Swaps the contents of two vectors.
void Erase (char *address, SizeType elementSize)
 Erases an element.
char * Erase (char *first, char *last, SizeType elementSize)
 Erases 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, DALi version 1.0.0

Constructor & Destructor Documentation

Default constructor. Does not allocate space.

Since:
2.4, DALi version 1.0.0

Destructor.

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

Since:
2.4, DALi version 1.0.0

Member Function Documentation

SizeType Dali::VectorBase::Capacity ( ) const

Gets the capacity of this vector.

Since:
2.4, DALi version 1.0.0
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, DALi version 1.0.0
Parameters:
[in]destinationPointer to the destination address
[in]sourcePointer to the source address
[in]numberOfBytesThe number of bytes to be copied
SizeType Dali::VectorBase::Count ( ) const

This method is inlined as it's needed frequently for Vector::End() iterator.

Since:
2.4, DALi version 1.0.0
Returns:
The count of elements in this vector
bool Dali::VectorBase::Empty ( ) const

@ return if the vector is empty.

Since:
2.4, DALi version 1.0.0
Returns:
True if the count of elements is empty
void Dali::VectorBase::Erase ( char *  address,
SizeType  elementSize 
) [protected]

Erases an element.

Does not change capacity.

Since:
2.4, DALi version 1.0.0
Parameters:
[in]addressAddress 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]

Erases a range of elements.

Does not change capacity.

Since:
2.4, DALi version 1.0.0
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]

Reserves space in the vector.

Since:
2.4, DALi version 1.0.0
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, DALi version 1.0.0
Parameters:
[in]countNumber of elements in the vector
SizeType Dali::VectorBase::Size ( ) const

Gets the count of elements in this vector.

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

Swaps the contents of two vectors.

Since:
2.4, DALi version 1.0.0
Parameters:
[in]vectorVector to swap with