IDS peak ICV v1.6.0
Loading...
Searching...
No Matches
IArchive Class Referenceabstract

#include <peak_common/serialization/peak_common_iarchive.hpp>

Inheritance diagram for IArchive:

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 ~IArchive ()=default
 
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.

Constructor & Destructor Documentation

◆ ~IArchive()

virtual ~IArchive ( )
virtualdefault

Member Function Documentation

◆ CreateArchive()

virtual std::shared_ptr< IArchive > CreateArchive ( ) const
pure virtual

Creates a new, empty archive instance.

Implemented in Archive.

◆ GetArchive()

virtual std::shared_ptr< IArchive > GetArchive ( const std::string & key) const
pure virtual

Retrieves a nested archive by key.

Implemented in Archive.

◆ GetArchiveArray()

virtual std::vector< std::shared_ptr< IArchive > > GetArchiveArray ( const std::string & key) const
pure virtual

Retrieves an array of nested archives by key.

Implemented in Archive.

◆ 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.

Implemented in Archive.

◆ GetBool()

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

Retrieves a boolean value by key.

Implemented in Archive.

◆ GetBoolArray()

virtual std::vector< bool > GetBoolArray ( const std::string & key) const
pure virtual

Retrieves an array of booleans by key.

Implemented in Archive.

◆ GetDouble()

virtual double GetDouble ( const std::string & key) const
pure virtual

Retrieves a double-precision number by key.

Implemented in Archive.

◆ GetDoubleArray()

virtual std::vector< double > GetDoubleArray ( const std::string & key) const
pure virtual

Retrieves an array of doubles by key.

Implemented in Archive.

◆ GetInt()

virtual int64_t GetInt ( const std::string & key) const
pure virtual

Retrieves a 64-bit signed integer by key.

Implemented in Archive.

◆ GetIntArray()

virtual std::vector< int64_t > GetIntArray ( const std::string & key) const
pure virtual

Retrieves an array of integers by key.

Implemented in Archive.

◆ 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.

Implemented in Archive.

◆ GetString()

virtual std::string GetString ( const std::string & key) const
pure virtual

Retrieves a string value by key.

Implemented in Archive.

◆ GetStringArray()

virtual std::vector< std::string > GetStringArray ( const std::string & key) const
pure virtual

Retrieves an array of strings by key.

Implemented in Archive.

◆ 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.

Implemented in Archive.

◆ 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.

Implemented in Archive.

◆ SetArchive()

virtual void SetArchive ( const std::string & key,
const std::shared_ptr< IArchive > & value )
pure virtual

Stores a nested archive object.

◆ SetArchiveArray()

virtual void SetArchiveArray ( const std::string & key,
const std::vector< std::shared_ptr< IArchive > > & value )
pure virtual

Stores an array of nested archives.

◆ SetBool()

virtual void SetBool ( const std::string & key,
bool value )
pure virtual

Stores a boolean value.

Implemented in Archive.

◆ SetBoolArray()

virtual void SetBoolArray ( const std::string & key,
const std::vector< bool > & value )
pure virtual

Stores an array of boolean values.

Implemented in Archive.

◆ SetDouble()

virtual void SetDouble ( const std::string & key,
double value )
pure virtual

Stores a double-precision floating point number.

Implemented in Archive.

◆ SetDoubleArray()

virtual void SetDoubleArray ( const std::string & key,
const std::vector< double > & value )
pure virtual

Stores an array of doubles.

Implemented in Archive.

◆ SetInt()

virtual void SetInt ( const std::string & key,
int64_t value )
pure virtual

Stores a 64-bit signed integer.

Implemented in Archive.

◆ SetIntArray()

virtual void SetIntArray ( const std::string & key,
const std::vector< int64_t > & value )
pure virtual

Stores an array of 64-bit integers.

Implemented in Archive.

◆ SetString()

virtual void SetString ( const std::string & key,
const std::string & value )
pure virtual

Stores a UTF-8 string.

Implemented in Archive.

◆ SetStringArray()

virtual void SetStringArray ( const std::string & key,
const std::vector< std::string > & value )
pure virtual

Stores an array of strings.

Implemented in Archive.