Tizen Native API
5.0
|
Base class to handle the memory of simple vector. More...
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. |
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.
Dali::VectorBase::VectorBase | ( | ) | [protected] |
Default constructor. Does not allocate space.
Dali::VectorBase::~VectorBase | ( | ) | [protected] |
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.
SizeType Dali::VectorBase::Capacity | ( | ) | const |
Gets the capacity of this vector.
void Dali::VectorBase::Copy | ( | const VectorBase & | vector, |
SizeType | elementSize | ||
) | [protected] |
Copy a vector.
[in] | vector | Vector to copy from |
[in] | elementSize | Size 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::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.
[in] | destination | Pointer to the destination address |
[in] | source | Pointer to the source address |
[in] | numberOfBytes | The number of bytes to be copied |
SizeType Dali::VectorBase::Count | ( | ) | const |
This method is inlined as it's needed frequently for Vector::End() iterator.
bool Dali::VectorBase::Empty | ( | ) | const |
@ return if the vector is empty.
void Dali::VectorBase::Erase | ( | char * | address, |
SizeType | elementSize | ||
) | [protected] |
Erases an element.
Does not change capacity.
[in] | address | Address to erase from |
[in] | elementSize | Size to erase |
char* Dali::VectorBase::Erase | ( | char * | first, |
char * | last, | ||
SizeType | elementSize | ||
) | [protected] |
Erases a range of elements.
Does not change capacity.
[in] | first | Address to the first element to be erased |
[in] | last | Address to the last element to be erased |
[in] | elementSize | Size of one of the elements to be erased |
void Dali::VectorBase::Release | ( | ) |
Releases the data.
Does not call destructors on objects held.
Reimplemented in Dali::Vector< T, IsTrivialType >, Dali::Vector< SlotConnection * >, Dali::Vector< SignalConnection * >, 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.
[in] | count | Count of elements to reserve |
[in] | elementSize | Size 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.
[in] | count | Number of elements in the vector |
SizeType Dali::VectorBase::Size | ( | ) | const |
Gets the count of elements in this vector.
void Dali::VectorBase::Swap | ( | VectorBase & | vector | ) | [protected] |
Swaps the contents of two vectors.
[in] | vector | Vector to swap with |