Ersa Wearable Platform
Embedded smartwatch firmware and application framework
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
ersa::services::MemoryStorageService Class Reference
Inheritance diagram for ersa::services::MemoryStorageService:
Inheritance graph
[legend]
Collaboration diagram for ersa::services::MemoryStorageService:
Collaboration graph
[legend]

Public Member Functions

Result< void > init () override
 
bool setString (std::string_view key, std::string_view value) override
 
std::string getString (std::string_view key, std::string_view defaultValue) override
 
bool setInt (std::string_view key, int32_t value) override
 
int32_t getInt (std::string_view key, int32_t defaultValue) override
 
bool setBool (std::string_view key, bool value) override
 
bool getBool (std::string_view key, bool defaultValue) override
 
bool setBytes (std::string_view key, const void *data, size_t size) override
 
size_t getBytesLength (std::string_view key) override
 
size_t getBytes (std::string_view key, void *data, size_t size) override
 
bool remove (std::string_view key) override
 
void clear () override
 
- Public Member Functions inherited from ersa::services::StorageService
virtual ~StorageService ()=default
 

Private Attributes

std::unordered_map< std::string, std::string > map_
 

Additional Inherited Members

- Static Public Member Functions inherited from ersa::services::StorageService
static StorageService & instance ()
 Return the installed process-wide storage service.
 
static void setInstance (StorageService *instance)
 Install the process-wide storage backend.
 

Member Function Documentation

◆ clear()

void ersa::services::MemoryStorageService::clear ( )
inlineoverridevirtual

Clear this service's namespace; use carefully because it removes all keys.

Implements ersa::services::StorageService.

◆ getBool()

bool ersa::services::MemoryStorageService::getBool ( std::string_view  key,
bool  defaultValue 
)
inlineoverridevirtual

Read a boolean setting or return defaultValue when the key is absent.

Implements ersa::services::StorageService.

◆ getBytes()

size_t ersa::services::MemoryStorageService::getBytes ( std::string_view  key,
void *  data,
size_t  size 
)
inlineoverridevirtual

Copy a stored record when its size matches; return bytes copied or zero.

Implements ersa::services::StorageService.

◆ getBytesLength()

size_t ersa::services::MemoryStorageService::getBytesLength ( std::string_view  key)
inlineoverridevirtual

Return the exact stored record size, or zero when the key is absent.

Implements ersa::services::StorageService.

◆ getInt()

int32_t ersa::services::MemoryStorageService::getInt ( std::string_view  key,
int32_t  defaultValue 
)
inlineoverridevirtual

Read a signed integer or return defaultValue for an absent key.

Implements ersa::services::StorageService.

◆ getString()

std::string ersa::services::MemoryStorageService::getString ( std::string_view  key,
std::string_view  defaultValue 
)
inlineoverridevirtual

Return the stored value or a copy of defaultValue when key is absent.

Implements ersa::services::StorageService.

◆ init()

Result< void > ersa::services::MemoryStorageService::init ( )
inlineoverridevirtual

Mount/open the backend and prepare its namespace for reads and writes.

Implements ersa::services::StorageService.

◆ remove()

bool ersa::services::MemoryStorageService::remove ( std::string_view  key)
inlineoverridevirtual

Remove one key; false means no removal was made or the backend failed.

Implements ersa::services::StorageService.

◆ setBool()

bool ersa::services::MemoryStorageService::setBool ( std::string_view  key,
bool  value 
)
inlineoverridevirtual

Store a boolean setting; false indicates that persistence failed.

Implements ersa::services::StorageService.

◆ setBytes()

bool ersa::services::MemoryStorageService::setBytes ( std::string_view  key,
const void *  data,
size_t  size 
)
inlineoverridevirtual

Store an opaque byte record for bounded caches and versioned snapshots.

Implements ersa::services::StorageService.

◆ setInt()

bool ersa::services::MemoryStorageService::setInt ( std::string_view  key,
int32_t  value 
)
inlineoverridevirtual

Store a signed integer using the backend's typed representation.

Implements ersa::services::StorageService.

◆ setString()

bool ersa::services::MemoryStorageService::setString ( std::string_view  key,
std::string_view  value 
)
inlineoverridevirtual

Store a string; false reports backend failure or exhausted storage.

Implements ersa::services::StorageService.

Member Data Documentation

◆ map_

std::unordered_map<std::string, std::string> ersa::services::MemoryStorageService::map_
private

The documentation for this class was generated from the following file: