跳转到主要内容

Partition

common/Partition.hpp

This type provides a concrete Partition of memory-slots capable of holding any of the specified list of types. The Partition is not aware of the types stored in the Partition memory, hence it provides no mechanism for deleting C++ objects when the Partition is clear()'ed.

This class implements AbstractPartition.

Template Parameters:

  • ListOfTypes Type of the list of types.
  • NUMBER_OF_ELEMENTS Type of the number of elements.

See: AbstractPartition

Inherits from: AbstractPartition

Public Types

enum@0 { INTS_PR_ELEMENT = (sizeof(typename meta::select_type_maxsize<SupportedTypesList>::type) + sizeof(int) - 1) / sizeof(int), SIZE_OF_ELEMENT = INTS_PR_ELEMENT * sizeof(int) }
Compile-time generated constants specifying the "element" or "slot" size used by this partition.
typedef ListOfTypesSupportedTypesList
Provides a generic public type containing the list of supported types.

Public Functions

virtual uint16_tcapacity() const
Gets the capacity, i.e.
virtual uint32_telement_size()
Access to concrete element-size.

Protected Functions

virtual void *element(uint16_t index)
Access to stored element.
virtual const void *element(uint16_t index) const
Access to stored element, const version.

Additional inherited members

Public Functions inherited from AbstractPartition

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.
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.
T &at(const uint16_t index)
Gets the object at the specified index.
const T &at(const uint16_t index) const
const version of at().
virtual voidclear()
Prepares the Partition for new allocations.
voiddec()
Decreases number of allocations.
Pair< T *, uint16_t >find(const void * pT)
Determines if the specified object could have been previously allocated in the partition.
virtual uint16_tgetAllocationCount() const
Gets allocation count.
virtual uint16_tindexOf(const void * address)
Determines index of previously allocated location.
virtual ~AbstractPartition()
Finalizes an instance of the AbstractPartition class.

Protected Functions inherited from AbstractPartition

AbstractPartition()
Initializes a new instance of the AbstractPartition class.

Public Types Documentation

@0

enum @0

Compile-time generated constants specifying the "element" or "slot" size used by this partition.

INTS_PR_ELEMENT
SIZE_OF_ELEMENT

SupportedTypesList

typedef ListOfTypes SupportedTypesList

Provides a generic public type containing the list of supported types.

Public Functions Documentation

capacity

virtual uint16_t capacity()const

Gets the capacity, i.e.

the maximum allocation count.

Returns:

The maximum allocation count.

Reimplements: touchgfx::AbstractPartition::capacity

element_size

virtual uint32_t element_size()

Access to concrete element-size.

Used internally.

Returns:

An uint32_t.

Reimplements: touchgfx::AbstractPartition::element_size

Protected Functions Documentation

element

virtual void * element(uint16_tindex)

Access to stored element.

Used internally.

Parameters:
indexZero-based index of the.
Returns:

null if it fails, else a void*.

Reimplements: touchgfx::AbstractPartition::element

element

virtual const void * element(uint16_tindex)

Access to stored element, const version.

Parameters:
indexZero-based index of the.
Returns:

null if it fails, else a void*.

Reimplements: touchgfx::AbstractPartition::element