AbstractPartition
This type defines an abstract interface to a storage partition for allocating memory slots of equal size. The "partition" is not aware of the actual types stored in the partition memory, hence it provides no mechanism for deleting C++ objects when clear()'ed.
Inherited by: Partition< ListOfTypes, NUMBER_OF_ELEMENTS >
Public Functions
| template <typename T > void * | allocate() |
| Gets the address of the next available storage slot. | |
| virtual void * | allocate(uint16_t size) |
| Gets the address of the next available storage slot. | |
| template <typename T > void * | allocateAt(uint16_t index) |
| Gets the address of the specified storage slot. | |
| virtual void * | allocateAt(uint16_t index, uint16_t size) |
| Gets the address of the specified index. | |
| template <typename T > T & | at(const uint16_t index) |
| Gets the object at the specified index. | |
| template <typename T > const T & | at(const uint16_t index) const |
| const version of at(). | |
| virtual uint16_t | capacity() const =0 |
| Gets the capacity, i.e. | |
| virtual void | clear() |
| Prepares the Partition for new allocations. | |
| void | dec() |
| Decreases number of allocations. | |
| virtual uint32_t | element_size() =0 |
| Access to concrete element-size. | |
| template <class T > Pair< T *, uint16_t > | find(const void * pT) |
| Determines if the specified object could have been previously allocated in the partition. | |
| virtual uint16_t | getAllocationCount() const |
| Gets allocation count. | |
| virtual uint16_t | indexOf(const void * address) |
| Determines index of previously allocated location. | |
| virtual | ~AbstractPartition() |
| Finalizes an instance of the AbstractPartition class. | |
Protected Functions
| AbstractPartition() | |
| Initializes a new instance of the AbstractPartition class. | |
| virtual const void * | element(uint16_t index) const =0 |
| Access to stored element, const version. | |
| virtual void * | element(uint16_t index) =0 |
| Access to stored element. | |
Public Functions Documentation
allocate
| void * allocate | ( | ) |
Gets the address of the next available storage slot.
The slot size is determined from the size of type T.
| T | Generic type parameter. |
The address of an empty storage slot.
Note
Asserts if T is too large, or the storage is depleted.
allocate
| virtual void * allocate | ( | uint16_t | size | ) | |
Gets the address of the next available storage slot.
The slot size is compared with the specified size.
| size | The size. |
The address of an empty storage slot which contains minimum 'size' bytes.
Note
Asserts if 'size' is too large, or the storage is depleted.
allocateAt
| void * allocateAt | ( | uint16_t | index | ) | |
Gets the address of the specified storage slot.
The slot size is determined from the size of type T.
| T | Generic type parameter. |
| index | Zero-based index of the. |
The address of the appropriate storage slot.
Note
Asserts if T is too large.
allocateAt
| virtual void * allocateAt | ( | uint16_t | index , | ||
| uint16_t | size | ||||
| ) |
Gets the address of the specified index.
| index | Zero-based index of the. |
| size | The size. |
The address of the appropriate storage slot which contains minimum 'size' bytes.
Note
Asserts if 'size' is too large.
at
| T & at | ( | const uint16_t | index | ) | |
Gets the object at the specified index.
| T | Generic type parameter. |
| index | The index into the Partition storage where the returned object is located. |
A typed reference to the object at the specified index.
at
| const T & at | ( | const uint16_t | index | ) | |
const version of at().
| T | Generic type parameter. |
| index | Zero-based index of the. |
A T&
capacity
| virtual uint16_t capacity | ( | ) | const =0 |
Gets the capacity, i.e.
the maximum allocation count.
The maximum allocation count.
Reimplemented by: touchgfx::Partition::capacity
clear
| virtual void clear | ( | ) |
Prepares the Partition for new allocations.
Any objects present in the Partition shall not be used after invoking this method.
dec
| void dec | ( | ) |
Decreases number of allocations.
element_size
| virtual uint32_t element_size | ( | ) | =0 |
Access to concrete element-size.
Used internally.
An uint32_t.
Reimplemented by: touchgfx::Partition::element_size
find
| Pair< T *, uint16_t > find | ( | const void * | pT | ) | |
Determines if the specified object could have been previously allocated in the partition.
Since the Partition concept is loosely typed this method shall be used with care. The method does not guarantee that the found object at the returned index is a valid object. It only tests whether or not the object is within the bounds of the current partition allocations.
| T | Generic type parameter. |
| pT | Pointer to the object to look up. |
getAllocationCount
| virtual uint16_t getAllocationCount | ( | ) | const |
Gets allocation count.
The currently allocated storage slots.
indexOf
| virtual uint16_t indexOf | ( | const void * | address | ) | |
Determines index of previously allocated location.
Since the Partition concept is loosely typed this method shall be used with care. The method does not guarantee that the found object at the returned index is a valid object. It only tests whether or not the object is within the bounds of the current partition allocations.
| address | The location address to lookup. |
An uint16_t.
~AbstractPartition
| virtual ~AbstractPartition | ( | ) |
Finalizes an instance of the AbstractPartition class.
Protected Functions Documentation
AbstractPartition
Initializes a new instance of the AbstractPartition class.
element
| virtual const void * element | ( | uint16_t | index | ) | |
Access to stored element, const version.
| index | Zero-based index of the. |
null if it fails, else a void*.
Reimplemented by: touchgfx::Partition::element
element
| virtual void * element | ( | uint16_t | index | ) | |
Access to stored element.
Used internally.
| index | Zero-based index of the. |
null if it fails, else a void*.
Reimplemented by: touchgfx::Partition::element