Tizen Native API
6.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. |
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:
- 3.0, DALi version 1.0.0
Constructor & Destructor Documentation
Dali::VectorBase::VectorBase | ( | ) | [protected] |
Default constructor. Does not allocate space.
- Since:
- 3.0, DALi version 1.0.0
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.
- Since:
- 3.0, DALi version 1.0.0
Member Function Documentation
SizeType Dali::VectorBase::Capacity | ( | ) | const |
Gets the capacity of this vector.
- Since:
- 3.0, DALi version 1.0.0
- Returns:
- The capacity of this vector
void Dali::VectorBase::Copy | ( | const VectorBase & | vector, |
SizeType | elementSize | ||
) | [protected] |
Copy a vector.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] vector Vector to copy from [in] elementSize Size of a single element
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:
- 3.0, DALi version 1.0.0
- Parameters:
-
[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.
- Since:
- 3.0, 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:
- 3.0, 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:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] address Address to erase from [in] elementSize Size to erase
- Precondition:
- Last element cannot be erased as there is nothing to move.
char* Dali::VectorBase::Erase | ( | char * | first, |
char * | last, | ||
SizeType | elementSize | ||
) | [protected] |
Erases a range of elements.
Does not change capacity.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[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
- Returns:
- Address pointing to the next element of the last one
void Dali::VectorBase::Release | ( | ) |
Releases the data.
Does not call destructors on objects held.
- Since:
- 3.0, DALi version 1.0.0
void Dali::VectorBase::Reserve | ( | SizeType | count, |
SizeType | elementSize | ||
) | [protected] |
Reserves space in the vector.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] count Count of elements to reserve [in] elementSize Size of a single element
void Dali::VectorBase::SetCount | ( | SizeType | count | ) | [protected] |
Helper to set the count.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] count Number of elements in the vector
SizeType Dali::VectorBase::Size | ( | ) | const |
Gets the count of elements in this vector.
- Since:
- 3.0, 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:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] vector Vector to swap with