eLooM for STM32 application
v3.3.0
|
This class implements a map between a managed task Instance and it's parameters. More...
#include "services/AManagedTask.h"
Go to the source code of this file.
Data Structures | |
struct | _MTMapValue |
struct | _MTMapElement |
struct | _MTMap |
Macros | |
#define | MTM_NULL_KEY (0U) |
#define | MTME_IS_EMPTY(p_element) (((p_element)->value.p_mtask_obj == NULL) && ((p_element)->key == MTM_NULL_KEY)) |
Typedefs | |
typedef struct _MTMapValue | MTMapValue_t |
typedef struct _MTMapElement | MTMapElement_t |
typedef struct _MTMap | MTMap_t |
Functions | |
static sys_error_code_t | MTMap_Init (MTMap_t *_this, MTMapElement_t *p_elements, uint16_t size) |
static MTMapValue_t * | MTMap_FindByKey (MTMap_t *_this, uint32_t key) |
static MTMapElement_t * | MTMap_AddElement (MTMap_t *_this, uint32_t key, AManagedTask *p_instance) |
static bool | MTMap_RemoveElement (MTMap_t *_this, uint32_t key) |
static bool | MTMap_IsInitialized (MTMap_t *_this) |
static bool | MTMap_GetElementCount (const MTMap_t *const _this) |
This class implements a map between a managed task Instance and it's parameters.
The map is a collection of pairs (key, value) named element, where:
Copyright (c) 2023 STMicroelectronics. All rights reserved.
This software is licensed under terms that can be found in the LICENSE file in the root directory of this software component. If no LICENSE file comes with this software, it is provided AS-IS.
#define MTM_NULL_KEY (0U) |
reserved key value to specify an invalid key.
#define MTME_IS_EMPTY | ( | p_element | ) | (((p_element)->value.p_mtask_obj == NULL) && ((p_element)->key == MTM_NULL_KEY)) |
Check if an MTMapElement_t is empty. The element in the map are not allocated and released dynamically, but rather the element are marked as empty.
typedef struct _MTMapElement MTMapElement_t |
Specifies the element of the map. It is the pair (key, value)
typedef struct _MTMapValue MTMapValue_t |
Specifies the value of the elements stored in the map.
|
inlinestatic |
Add a new pair (key, IDriver) to the map. The pair (key, IDriver) is namebd element. If the key is already present to the map then the element is not added and the method return NULL. If the element is already present in the map then the method return the element.
_this | [IN] pointer to a valid MTMap_t object. |
key | [IN] unique ID for the element. |
[IN] | p_instance specifies the IDriver instance of the element's value. |
|
inlinestatic |
Searches the map for an element with a the corresponding key
_this | [IN] pointer to a valid MTMap_t object. |
key | [IN] key to be searched. |
|
inlinestatic |
Get the number of element (key, value) present in the map.
_this | [IN] pointer to a valid MTMap_t object. |
|
inlinestatic |
Initialize the Driver map.
_this | [IN] pointer to a valid MTMap_t object. |
p_elements | [IN] pointer to a valid MTMapElement_t array. |
size | [IN] number of elements in the array |
|
inlinestatic |
Check if the map has been initialized. If a map is not initialized, any call to the map API has unknown effect. To initialize a map use the method MTMap_Init().
_this | [IN] pointer to a valid MTMap_t object. |
|
inlinestatic |
Remove the element with the specific key from the map. The element is marked as removed, and no memory de-allocation is done.
_this | [IN] pointer to a valid MTMap_t object. |
key | [IN] unique ID for the element. |