Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

KVMap Class Reference

KVMap class. More...

#include <KVMap.h>

Inherits NonCopyable< KVMap >.

Public Member Functions

int init ()
 Initializes KVMap.
int attach (const char *partition_name, kvstore_config_t *kv_config)
 Attach a KVStore partition configuration, and add it to the KVMap array.
int detach (const char *partition_name)
 Detach a KVStore partition configuration from the KVMap array, and deinitialize its components.
int deinit ()
 Deinitialize the KVMap array, and deinitialize all the attached partitions.
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.
KVStoreget_internal_kv_instance (const char *name)
 Getter for the internal KVStore instance.
KVStoreget_external_kv_instance (const char *name)
 Getter for the external KVStore instance.
KVStoreget_main_kv_instance (const char *name)
 Getter for the main KVStore instance.
BlockDeviceget_internal_blockdevice_instance (const char *name)
 Getter for the internal BlockDevice instance.
BlockDeviceget_external_blockdevice_instance (const char *name)
 Getter for the external BlockDevice instance.
FileSystemget_external_filesystem_instance (const char *name)
 Getter for the external FileSystem instance.

Static Public Member Functions

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

Private Member Functions

 MBED_DEPRECATED ("Invalid copy construction of a NonCopyable resource.") NonCopyable(const NonCopyable &)
 NonCopyable copy constructor.
 MBED_DEPRECATED ("Invalid copy assignment of a NonCopyable resource.") NonCopyable &operator
 NonCopyable copy assignment operator.

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

Definition at line 51 of file KVMap.cpp.

int deinit (  )

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

Returns:
0 on success, negative error code on failure

Definition at line 141 of file KVMap.cpp.

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

Definition at line 108 of file KVMap.cpp.

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

Definition at line 305 of file KVMap.cpp.

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

Definition at line 320 of file KVMap.cpp.

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

Definition at line 260 of file KVMap.cpp.

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

Definition at line 290 of file KVMap.cpp.

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

Definition at line 245 of file KVMap.cpp.

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

Definition at line 275 of file KVMap.cpp.

int init (  )

Initializes KVMap.

Returns:
0 on success, negative error code on failure

Definition at line 31 of file KVMap.cpp.

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

Definition at line 168 of file KVMap.cpp.