19#include <peak_common_c/detail/peak_common_defines.h>
22#include <peak_icv_c/serialization/peak_icv_archive.h>
134 PEAK_COMMON_NO_DISCARD std::shared_ptr<IArchive>
CreateArchive()
const override;
145 PEAK_COMMON_NO_DISCARD
bool HasKey(
const std::string& key)
const override;
165 PEAK_COMMON_NO_DISCARD std::vector<std::string>
GetKeys()
const override;
178 PEAK_COMMON_NO_DISCARD
size_t GetArrayCount(
const std::string& key)
const override;
188 void SetBool(
const std::string& key,
bool value)
override;
198 void SetInt(
const std::string& key, int64_t value)
override;
208 void SetDouble(
const std::string& key,
double value)
override;
218 void SetString(
const std::string& key,
const std::string& value)
override;
228 void SetArchive(
const std::string& key,
const std::shared_ptr<IArchive>& value)
override;
238 void SetBoolArray(
const std::string& key,
const std::vector<bool>& value)
override;
248 void SetIntArray(
const std::string& key,
const std::vector<int64_t>& value)
override;
258 void SetDoubleArray(
const std::string& key,
const std::vector<double>& value)
override;
268 void SetStringArray(
const std::string& key,
const std::vector<std::string>& value)
override;
278 void SetArchiveArray(
const std::string& key,
const std::vector<std::shared_ptr<IArchive>>& value)
override;
291 PEAK_COMMON_NO_DISCARD
bool GetBool(
const std::string& key)
const override;
302 PEAK_COMMON_NO_DISCARD int64_t
GetInt(
const std::string& key)
const override;
313 PEAK_COMMON_NO_DISCARD
double GetDouble(
const std::string& key)
const override;
324 PEAK_COMMON_NO_DISCARD std::string
GetString(
const std::string& key)
const override;
335 PEAK_COMMON_NO_DISCARD std::shared_ptr<IArchive>
GetArchive(
const std::string& key)
const override;
346 PEAK_COMMON_NO_DISCARD std::vector<bool>
GetBoolArray(
const std::string& key)
const override;
357 PEAK_COMMON_NO_DISCARD std::vector<int64_t>
GetIntArray(
const std::string& key)
const override;
368 PEAK_COMMON_NO_DISCARD std::vector<double>
GetDoubleArray(
const std::string& key)
const override;
379 PEAK_COMMON_NO_DISCARD std::vector<std::string>
GetStringArray(
const std::string& key)
const override;
390 PEAK_COMMON_NO_DISCARD std::vector<std::shared_ptr<IArchive>>
GetArchiveArray(
const std::string& key)
const override;
393 friend peak::common::detail::BackendAccessor<Archive>;
395 explicit Archive(peak_icv_archive_handle handle);
397 PEAK_COMMON_NO_DISCARD peak_icv_archive_handle GetHandle()
const override
402 peak_icv_archive_handle m_handle{};
Interface for a hierarchical key-value archive system.
ValueType
Enumerates supported value types that can be stored or queried in the archive.
A key-value store that implements the IArchive interface.
std::vector< int64_t > GetIntArray(const std::string &key) const override
Returns the array of integer values.
std::vector< std::shared_ptr< IArchive > > GetArchiveArray(const std::string &key) const override
Returns the array of nested archives.
void SetBoolArray(const std::string &key, const std::vector< bool > &value) override
Sets an array of boolean values.
double GetDouble(const std::string &key) const override
Returns the double precision floating point value.
void SetDouble(const std::string &key, double value) override
Sets a double precision floating point value.
Archive(const Archive &)=delete
Archive instances cannot be copied.
std::string GetString(const std::string &key) const override
Returns the string value.
void SetInt(const std::string &key, int64_t value) override
Sets an integer value.
std::shared_ptr< IArchive > GetArchive(const std::string &key) const override
Returns the nested archive.
std::vector< std::string > GetStringArray(const std::string &key) const override
Returns the array of string values.
std::vector< double > GetDoubleArray(const std::string &key) const override
Returns the array of double precision floating point values.
void SetString(const std::string &key, const std::string &value) override
Sets a string value.
void SetIntArray(const std::string &key, const std::vector< int64_t > &value) override
Sets an array of integer values.
Archive & operator=(const Archive &)=delete
Archive instances cannot be copy-assigned.
void SetArchive(const std::string &key, const std::shared_ptr< IArchive > &value) override
Sets a nested archive.
int64_t GetInt(const std::string &key) const override
Returns the integer value.
bool GetBool(const std::string &key) const override
Returns the boolean value.
size_t GetArrayCount(const std::string &key) const override
Retruns the number of elements in an array value.
ValueType GetValueType(const std::string &key) const override
Returns the type of value stored under a key.
void SetStringArray(const std::string &key, const std::vector< std::string > &value) override
Sets an array of string values.
~Archive() override
Virtual destructor.
std::shared_ptr< IArchive > CreateArchive() const override
Creates a new archive instance.
std::vector< std::string > GetKeys() const override
Returns all keys stored in the archive.
std::vector< bool > GetBoolArray(const std::string &key) const override
Returns the array of boolean values.
Archive()
Constructs an empty Archive instance.
bool HasKey(const std::string &key) const override
Checks whether a key exists in the archive.
void SetBool(const std::string &key, bool value) override
Sets a boolean value.
void SetDoubleArray(const std::string &key, const std::vector< double > &value) override
Sets an array of double precision floating point values.
void SetArchiveArray(const std::string &key, const std::vector< std::shared_ptr< IArchive > > &value) override
Sets an array of nested archives.