AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Types | Public Member Functions | List of all members
alexaClientSDK::propertiesInterfaces::PropertiesInterface Class Referenceabstract

This class provides an interface to a simple key/value container. More...

#include <PropertiesInterface.h>

Inheritance diagram for alexaClientSDK::propertiesInterfaces::PropertiesInterface:
Inheritance graph
[legend]

Public Types

typedef std::vector< unsigned char > Bytes
 Bytes data type. This data type represent a continuous byte array. More...
 

Public Member Functions

virtual ~PropertiesInterface () noexcept=default
 Destructor. More...
 
virtual bool getString (const std::string &key, std::string &value) noexcept=0
 Method to load string value from configuration. More...
 
virtual bool putString (const std::string &key, const std::string &value) noexcept=0
 Method to store string value into configuration. More...
 
virtual bool getBytes (const std::string &key, Bytes &value) noexcept=0
 Method to load binary value from configuration. More...
 
virtual bool putBytes (const std::string &key, const Bytes &value) noexcept=0
 Method to store binary value into configuration. More...
 
virtual bool getKeys (std::unordered_set< std::string > &keys) noexcept=0
 Method to inspect existing properties. More...
 
virtual bool remove (const std::string &key) noexcept=0
 Removes a property with a given name. More...
 
virtual bool clear () noexcept=0
 Removes all properties from a configuration container. More...
 

Detailed Description

This class provides an interface to a simple key/value container.

This interface is obtained through PropertiesFactoryInterface factory, which handles disambiguation of properties namespace.

The implementation must do best effort for data consistency when handling data update errors for each property. If it is possible, the value of property shall be either left intact, or deleted if the data corruption is unavoidable.

See also
PropertiesFactoryInterface

Member Typedef Documentation

◆ Bytes

Bytes data type. This data type represent a continuous byte array.

Constructor & Destructor Documentation

◆ ~PropertiesInterface()

virtual alexaClientSDK::propertiesInterfaces::PropertiesInterface::~PropertiesInterface ( )
virtualdefaultnoexcept

Destructor.

Member Function Documentation

◆ clear()

virtual bool alexaClientSDK::propertiesInterfaces::PropertiesInterface::clear ( )
pure virtualnoexcept

Removes all properties from a configuration container.

This method removes all properties from a configuration container.

Returns
True if the container has been cleared. In case of error, false is returned, and the contents of container is undefined.

Implemented in alexaClientSDK::propertiesInterfaces::test::StubProperties.

◆ getBytes()

virtual bool alexaClientSDK::propertiesInterfaces::PropertiesInterface::getBytes ( const std::string &  key,
Bytes value 
)
pure virtualnoexcept

Method to load binary value from configuration.

This method loads binary value from configuration. If the value in the storage is not binary data, the method behaviour is undefined.

Parameters
[in]keyConfiguration key.
[out]valueIf the method completes successfully, value will contain loaded value. Otherwise contents of value is unmodified.
Returns
True if value has been loaded, false otherwise.
See also
putBytes

Implemented in alexaClientSDK::propertiesInterfaces::test::StubProperties.

◆ getKeys()

virtual bool alexaClientSDK::propertiesInterfaces::PropertiesInterface::getKeys ( std::unordered_set< std::string > &  keys)
pure virtualnoexcept

Method to inspect existing properties.

This method provides a set of known property keys from a configuration container.

Parameters
[out]keysContainer for property keys. If method completes successfully, keys will contain all property names. On error, the contents of keys is undefined.
Returns
True if operation succeeds, false otherwise.

Implemented in alexaClientSDK::propertiesInterfaces::test::StubProperties.

◆ getString()

virtual bool alexaClientSDK::propertiesInterfaces::PropertiesInterface::getString ( const std::string &  key,
std::string &  value 
)
pure virtualnoexcept

Method to load string value from configuration.

This method loads string value from configuration. If the value in the storage is not a string, the method behaviour is undefined.

Parameters
[in]keyConfiguration key.
[out]valueResult container. If the method completes successfully, value will contain loaded value. Otherwise contents of value is unmodified.
Returns
True if value has been loaded, false otherwise.
See also
putString

Implemented in alexaClientSDK::propertiesInterfaces::test::StubProperties.

◆ putBytes()

virtual bool alexaClientSDK::propertiesInterfaces::PropertiesInterface::putBytes ( const std::string &  key,
const Bytes value 
)
pure virtualnoexcept

Method to store binary value into configuration.

This method stores binary value into configuration. If there is an existing value for the the same key, the value is overwritten.

If operation fails, the implementation shall make a best effort for either keeping value unmodified, or clear it to prevent data corruption. Other properties shall not be impacted in case of an error.

Parameters
[in]keyConfiguration key.
[in]valueValue to store.
Returns
True if value has been stored, false otherwise. If this method returns false, the value may stay unchanged, or lost.
See also
getBytes

Implemented in alexaClientSDK::propertiesInterfaces::test::StubProperties.

◆ putString()

virtual bool alexaClientSDK::propertiesInterfaces::PropertiesInterface::putString ( const std::string &  key,
const std::string &  value 
)
pure virtualnoexcept

Method to store string value into configuration.

This method stores string value into configuration. If there is an existing value for the the same key, the value is overwritten.

If operation fails, the implementation shall make a best effort for either keeping value unmodified, or clear it to prevent data corruption. Other properties shall not be impacted in case of an error.

Parameters
[in]keyConfiguration key.
[in]valueValue to store.
Returns
True if value has been stored, false otherwise. If this method returns false, the value may stay unchanged, or lost.
See also
getString

Implemented in alexaClientSDK::propertiesInterfaces::test::StubProperties.

◆ remove()

virtual bool alexaClientSDK::propertiesInterfaces::PropertiesInterface::remove ( const std::string &  key)
pure virtualnoexcept

Removes a property with a given name.

This method removes a property with a given name from a configuration container. If the property doesn't exist, the method succeeds.

Parameters
[in]keyConfiguration key to remove.
Returns
True if the key has been removed or didn't exist. In case of error, false is returned and the state of configuration container is undefined.

Implemented in alexaClientSDK::propertiesInterfaces::test::StubProperties.


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

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0