Mistake on this page?
Report an issue in GitHub or email us
Public Member Functions | Static Public Member Functions
KVMap Class Reference

KVMap class. More...

#include <KVMap.h>

Inheritance diagram for KVMap:
NonCopyable< KVMap >

Public Member Functions

int init ()
 Initializes KVMap. More...
 
int attach (const char *partition_name, kvstore_config_t *kv_config)
 Attach a KVStore partition configuration, and add it to the KVMap array. More...
 
int detach (const char *partition_name)
 Detach a KVStore partition configuration from the KVMap array, and deinitialize its components. More...
 
int deinit ()
 Deinitialize the KVMap array, and deinitialize all the attached partitions. More...
 
int lookup (const char *full_name, mbed::KVStore **kv_instance, size_t *key_index, uint32_t *flags_mask=NULL)
 Full name lookup, and then break it into KVStore instance and key. More...
 
KVStoreget_internal_kv_instance (const char *name)
 Getter for the internal KVStore instance. More...
 
KVStoreget_external_kv_instance (const char *name)
 Getter for the external KVStore instance. More...
 
KVStoreget_main_kv_instance (const char *name)
 Getter for the main KVStore instance. More...
 
BlockDeviceget_internal_blockdevice_instance (const char *name)
 Getter for the internal BlockDevice instance. More...
 
BlockDeviceget_external_blockdevice_instance (const char *name)
 Getter for the external BlockDevice instance. More...
 
FileSystemget_external_filesystem_instance (const char *name)
 Getter for the external FileSystem instance. More...
 

Static Public Member Functions

static KVMapget_instance ()
 As a singleton, return the single instance of the class. More...
 

Detailed Description

KVMap class.

Singleton class to manage the mapping of KVStore partition and its naming.

Definition at line 90 of file KVMap.h.

Member Function Documentation

int attach ( const char *  partition_name,
kvstore_config_t kv_config 
)

Attach a KVStore partition configuration, and add it to the KVMap array.

Parameters
partition_nameString parameter contains the partition name.
kv_configA configuration struct created by the kv_config or by the user.
Returns
0 on success, negative error code on failure
int deinit ( )

Deinitialize the KVMap array, and deinitialize all the attached partitions.

Returns
0 on success, negative error code on failure
int detach ( const char *  partition_name)

Detach a KVStore partition configuration from the KVMap array, and deinitialize its components.

Parameters
partition_nameString parameter contains the partition name.
Returns
0 on success, negative error code on failure
BlockDevice* get_external_blockdevice_instance ( const char *  name)

Getter for the external BlockDevice instance.

Parameters
nameString parameter contains the /partition name/.
Returns
Pointer to the external BlockDevice on success, NULL on failure or if not exist
FileSystem* get_external_filesystem_instance ( const char *  name)

Getter for the external FileSystem instance.

Parameters
nameString parameter contains the /partition name/.
Returns
Pointer to the external FileSystem on success, NULL on failure or if not exist
KVStore* get_external_kv_instance ( const char *  name)

Getter for the external KVStore instance.

Parameters
nameString parameter contains the /partition name/.
Returns
Pointer to the external kvstore on success, NULL on failure or if not exist
static KVMap& get_instance ( )
static

As a singleton, return the single instance of the class.

This class is a singleton for the following reasons:

  • Ease of use, so you don't have to coordinate instantiations.
  • Lazy instantiation of internal data, (which we can't achieve with simple static classes).
Returns
Singleton instance reference.

Definition at line 101 of file KVMap.h.

BlockDevice* get_internal_blockdevice_instance ( const char *  name)

Getter for the internal BlockDevice instance.

Parameters
nameString parameter contains the /partition name/.
Returns
Pointer to the internal BlockDevice on success, NULL on failure or if not exist
KVStore* get_internal_kv_instance ( const char *  name)

Getter for the internal KVStore instance.

Parameters
nameString parameter contains the /partition name/.
Returns
Pointer to the internal kvstore on success, NULL on failure or if not exist
KVStore* get_main_kv_instance ( const char *  name)

Getter for the main KVStore instance.

Parameters
nameString parameter contains the /partition name/.
Returns
Pointer to the main kvstore on success, NULL on failure or if not exist
int init ( )

Initializes KVMap.

Returns
0 on success, negative error code on failure
int lookup ( const char *  full_name,
mbed::KVStore **  kv_instance,
size_t *  key_index,
uint32_t *  flags_mask = NULL 
)

Full name lookup, and then break it into KVStore instance and key.

Parameters
[in]full_nameString parameter contains the partition name to look for. The String should be formated as follow "/partition name/key". The key is optional.
[out]kv_instanceReturns the main KVStore instance associated with the required partition name.
[out]key_indexReturns an index to the first character of the key.
[out]flags_maskReturn the flag masking for the current configuration
Returns
0 on success, negative error code on failure
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.