IDS peak AFL v2.0.0
Loading...
Searching...
No Matches
IArchive Class Referenceabstract

Interface for a hierarchical key-value archive system. More...

#include <peak_common/serialization/peak_common_iarchive.hpp>

Public Types

enum class  ValueType {
  Bool , BoolArray , Int , IntArray ,
  Double , DoubleArray , String , StringArray ,
  Archive , ArchiveArray
}
 Enumerates supported value types that can be stored or queried in the archive. More...

Public Member Functions

virtual std::shared_ptr< IArchive > CreateArchive () const =0
 Creates a new, empty archive instance.
virtual bool HasKey (const std::string &key) const =0
 Checks whether a given key exists in the archive.
virtual ValueType GetValueType (const std::string &key) const =0
 Retrieves the value type associated with a key.
virtual std::vector< std::string > GetKeys () const =0
 Returns a list of all keys currently stored in the archive.
virtual size_t GetArrayCount (const std::string &key) const =0
 Gets the number of elements in an array stored under the given key.
virtual void SetBool (const std::string &key, bool value)=0
 Stores a boolean value.
virtual void SetInt (const std::string &key, int64_t value)=0
 Stores a 64-bit signed integer.
virtual void SetDouble (const std::string &key, double value)=0
 Stores a double-precision floating point number.
virtual void SetString (const std::string &key, const std::string &value)=0
 Stores a UTF-8 string.
virtual void SetArchive (const std::string &key, const std::shared_ptr< IArchive > &value)=0
 Stores a nested archive object.
virtual void SetBoolArray (const std::string &key, const std::vector< bool > &value)=0
 Stores an array of boolean values.
virtual void SetIntArray (const std::string &key, const std::vector< int64_t > &value)=0
 Stores an array of 64-bit integers.
virtual void SetDoubleArray (const std::string &key, const std::vector< double > &value)=0
 Stores an array of doubles.
virtual void SetStringArray (const std::string &key, const std::vector< std::string > &value)=0
 Stores an array of strings.
virtual void SetArchiveArray (const std::string &key, const std::vector< std::shared_ptr< IArchive > > &value)=0
 Stores an array of nested archives.
virtual bool GetBool (const std::string &key) const =0
 Retrieves a boolean value by key.
virtual int64_t GetInt (const std::string &key) const =0
 Retrieves a 64-bit signed integer by key.
virtual double GetDouble (const std::string &key) const =0
 Retrieves a double-precision number by key.
virtual std::string GetString (const std::string &key) const =0
 Retrieves a string value by key.
virtual std::shared_ptr< IArchive > GetArchive (const std::string &key) const =0
 Retrieves a nested archive by key.
virtual std::vector< bool > GetBoolArray (const std::string &key) const =0
 Retrieves an array of booleans by key.
virtual std::vector< int64_t > GetIntArray (const std::string &key) const =0
 Retrieves an array of integers by key.
virtual std::vector< double > GetDoubleArray (const std::string &key) const =0
 Retrieves an array of doubles by key.
virtual std::vector< std::string > GetStringArray (const std::string &key) const =0
 Retrieves an array of strings by key.
virtual std::vector< std::shared_ptr< IArchive > > GetArchiveArray (const std::string &key) const =0
 Retrieves an array of nested archives by key.

Detailed Description

Interface for a hierarchical key-value archive system.

Provides methods for storing and retrieving structured data of various types, including primitive values, arrays, and nested archives.

This interface is suitable for serialization and deserialization purposes.

Since
ids_peak_common 1.0

Member Enumeration Documentation

◆ ValueType

enum class ValueType
strong

Enumerates supported value types that can be stored or queried in the archive.

Enumerator
Bool 

Single boolean value.

BoolArray 

Array of booleans.

Int 

64-bit signed integer

IntArray 

Array of integers.

Double 

Double-precision floating point.

DoubleArray 

Array of doubles.

String 

UTF-8 encoded string.

StringArray 

Array of strings.

Archive 

Nested archive object.

ArchiveArray 

Array of nested archives.

Member Function Documentation

◆ GetArrayCount()

virtual size_t GetArrayCount ( const std::string & key) const
pure virtual

Gets the number of elements in an array stored under the given key.

Parameters
keyThe key referencing the array.
Returns
Element count of the array.

◆ GetKeys()

virtual std::vector< std::string > GetKeys ( ) const
pure virtual

Returns a list of all keys currently stored in the archive.

Returns
Vector containing all stored keys.

◆ GetValueType()

virtual ValueType GetValueType ( const std::string & key) const
pure virtual

Retrieves the value type associated with a key.

Parameters
keyThe key whose value type to retrieve.
Returns
The ValueType of the stored data.

◆ HasKey()

virtual bool HasKey ( const std::string & key) const
pure virtual

Checks whether a given key exists in the archive.

Parameters
keyThe key to look for.
Returns
true if the key exists, false otherwise.

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