RTC Toolkit 5.1.0
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
rtctk::componentFramework::RepositoryIf::MetaData Class Referencefinal

Class for passing/receiving metadata to/from the repository. More...

#include <repositoryIf.hpp>

Classes

class  ConstIterator
 Constant version of the bidirectional forward iterator returned by the cbegin/cend methods. More...
 
class  ConstReverseIterator
 Constant version of the bidirectional reverse iterator returned by the crbegin/crend methods. More...
 
class  ConstValueProxy
 A read-only interface class to an underlying metadata value. More...
 
class  Iterator
 Bidirectional forward iterator returned by the begin/end methods. More...
 
class  KeyAlreadyExists
 Exception indicating that the metadata already contains the given key. More...
 
class  KeyDoesNotExist
 Exception indicating that the given key does not exist in the metadata. More...
 
class  ReverseIterator
 Bidirectional reverse iterator returned by the rbegin/rend methods. More...
 
class  TypeMismatch
 Exception indicating that a value with the wrong type was being assigned to a reserved key. More...
 
class  UnsupportedType
 Exception indicating that an unsupported type was used for the metadata value. More...
 
class  ValueProxy
 Interface class to an underlying metadata value. More...
 

Public Member Functions

 MetaData ()=default
 
 MetaData (const MetaData &rhs)=default
 
 MetaData (MetaData &&rhs)=default
 
 MetaData (std::initializer_list< std::pair< std::string, std::any > > init_list)
 
 ~MetaData ()=default
 
MetaDataoperator= (const MetaData &rhs)=default
 
MetaDataoperator= (MetaData &&rhs)=default
 
bool Empty () const
 Check if the metadata contains any values.
 
size_t GetSize () const noexcept
 Get the number of entries in the metadata.
 
bool Contains (const std::string &key) const
 Check if the metadata contains a specific key.
 
ValueProxy Insert (const std::string &key)
 Add a new metadata key.
 
ValueProxy Insert (std::string &&key)
 Add a new metadata key.
 
template<typename T >
autoInsert (const std::string &key, T &&value)
 Add a new metadata key with the given value.
 
template<typename T >
autoInsert (std::string &&key, T &&value)
 Add a new metadata key with the given value.
 
bool Remove (const std::string &key)
 Remove a metadata key.
 
ValueProxy operator[] (const std::string &key)
 Return a value for the specified key.
 
ValueProxy operator[] (std::string &&key)
 Return a value for the specified key.
 
ConstValueProxy operator[] (const std::string &key) const
 Return a value for the specified key.
 
void Merge (const MetaData &source)
 Merge entries from the source metadata object into this one.
 
void Merge (MetaData &&source)
 Merge entries from the source metadata object into this one.
 
Iterator begin ()
 Return a forward iterator to the beginning of the metadata entries.
 
ConstIterator begin () const
 Return a read-only forward iterator to the beginning of the metadata entries.
 
ConstIterator cbegin () const noexcept
 Return a read-only forward iterator to the beginning of the metadata entries.
 
Iterator end ()
 Return a forward iterator to the end of the metadata entries.
 
ConstIterator end () const
 Return a read-only forward iterator to the end of the metadata entries.
 
ConstIterator cend () const noexcept
 Return a read-only forward iterator to the end of the metadata entries.
 
ReverseIterator rbegin ()
 Return a reverse iterator to the beginning of the metadata entries.
 
ConstReverseIterator rbegin () const
 Return a read-only reverse iterator to the beginning of the metadata entries.
 
ConstReverseIterator crbegin () const noexcept
 Return a read-only reverse iterator to the beginning of the metadata entries.
 
ReverseIterator rend ()
 Return a reverse iterator to the end of the metadata entries.
 
ConstReverseIterator rend () const
 Return a read-only reverse iterator to the end of the metadata entries.
 
ConstReverseIterator crend () const noexcept
 Return a read-only reverse iterator to the end of the metadata entries.
 

Detailed Description

Class for passing/receiving metadata to/from the repository.

This class behaves like a std::map in most regards, but checks that only supported metadata types can be stored. Specifically, the reserved keys are checked to make sure that only the correct type can be assigned to them.

The following is a list of reserved metadata keys and their corresponding types:

The indicated types should be used when casting the metadata value for the corresponding reserved key. For example:

auto type = metadata["type"].Cast<const std::type_info&>();
auto shape = metadata["shape"].Cast<RtcVectorUInt64>();
RtcVector< RtcUInt64 > RtcVectorUInt64
Definition repositoryIf.hpp:74
Note
The "sequence_id" key is not applicable to all adapter implementations. It is typically only applicable to the Runtime Configuration Repository.

Constructor & Destructor Documentation

◆ MetaData() [1/4]

rtctk::componentFramework::RepositoryIf::MetaData::MetaData ( )
default

◆ MetaData() [2/4]

rtctk::componentFramework::RepositoryIf::MetaData::MetaData ( const MetaData & rhs)
default

◆ MetaData() [3/4]

rtctk::componentFramework::RepositoryIf::MetaData::MetaData ( MetaData && rhs)
default

◆ MetaData() [4/4]

rtctk::componentFramework::RepositoryIf::MetaData::MetaData ( std::initializer_list< std::pair< std::string, std::any > > init_list)

◆ ~MetaData()

rtctk::componentFramework::RepositoryIf::MetaData::~MetaData ( )
default

Member Function Documentation

◆ begin() [1/2]

RepositoryIf::MetaData::Iterator rtctk::componentFramework::RepositoryIf::MetaData::begin ( )
inline

Return a forward iterator to the beginning of the metadata entries.

◆ begin() [2/2]

RepositoryIf::MetaData::ConstIterator rtctk::componentFramework::RepositoryIf::MetaData::begin ( ) const
inline

Return a read-only forward iterator to the beginning of the metadata entries.

◆ cbegin()

RepositoryIf::MetaData::ConstIterator rtctk::componentFramework::RepositoryIf::MetaData::cbegin ( ) const
inlinenoexcept

Return a read-only forward iterator to the beginning of the metadata entries.

◆ cend()

RepositoryIf::MetaData::ConstIterator rtctk::componentFramework::RepositoryIf::MetaData::cend ( ) const
inlinenoexcept

Return a read-only forward iterator to the end of the metadata entries.

◆ Contains()

bool rtctk::componentFramework::RepositoryIf::MetaData::Contains ( const std::string & key) const
inline

Check if the metadata contains a specific key.

Parameters
[in]keyThe name of the metadata entry to look for.
Returns
true if the metadata object contains the given key and false otherwise.

◆ crbegin()

RepositoryIf::MetaData::ConstReverseIterator rtctk::componentFramework::RepositoryIf::MetaData::crbegin ( ) const
inlinenoexcept

Return a read-only reverse iterator to the beginning of the metadata entries.

◆ crend()

RepositoryIf::MetaData::ConstReverseIterator rtctk::componentFramework::RepositoryIf::MetaData::crend ( ) const
inlinenoexcept

Return a read-only reverse iterator to the end of the metadata entries.

◆ Empty()

bool rtctk::componentFramework::RepositoryIf::MetaData::Empty ( ) const
inline

Check if the metadata contains any values.

Returns
true if there is at least one key in the metadata and false otherwise.

◆ end() [1/2]

RepositoryIf::MetaData::Iterator rtctk::componentFramework::RepositoryIf::MetaData::end ( )
inline

Return a forward iterator to the end of the metadata entries.

◆ end() [2/2]

RepositoryIf::MetaData::ConstIterator rtctk::componentFramework::RepositoryIf::MetaData::end ( ) const
inline

Return a read-only forward iterator to the end of the metadata entries.

◆ GetSize()

size_t rtctk::componentFramework::RepositoryIf::MetaData::GetSize ( ) const
inlinenoexcept

Get the number of entries in the metadata.

Returns
The total number of entries in the metadata.

◆ Insert() [1/4]

RepositoryIf::MetaData::ValueProxy rtctk::componentFramework::RepositoryIf::MetaData::Insert ( const std::string & key)

Add a new metadata key.

Parameters
[in]keyThe new key to add.
Returns
Reference to the newly created entry.
Exceptions
KeyAlreadyExistsIf the metadata already contains key.

◆ Insert() [2/4]

template<typename T >
auto & rtctk::componentFramework::RepositoryIf::MetaData::Insert ( const std::string & key,
T && value )

Add a new metadata key with the given value.

Template Parameters
TThe type of the new value being added.
Parameters
[in]keyThe new key to add.
[in]valueThe value of the new key.
Returns
Reference to the newly created entry.
Exceptions
KeyAlreadyExistsIf the metadata already contains key.

◆ Insert() [3/4]

RepositoryIf::MetaData::ValueProxy rtctk::componentFramework::RepositoryIf::MetaData::Insert ( std::string && key)

Add a new metadata key.

Parameters
[in]keyThe new key to add.
Returns
Reference to the newly created entry.
Exceptions
KeyAlreadyExistsIf the metadata already contains key.

◆ Insert() [4/4]

template<typename T >
auto & rtctk::componentFramework::RepositoryIf::MetaData::Insert ( std::string && key,
T && value )

Add a new metadata key with the given value.

Template Parameters
TThe type of the new value being added.
Parameters
[in]keyThe new key to add.
[in]valueThe value of the new key.
Returns
Reference to the newly created entry.
Exceptions
KeyAlreadyExistsIf the metadata already contains key.

◆ Merge() [1/2]

void rtctk::componentFramework::RepositoryIf::MetaData::Merge ( const MetaData & source)

Merge entries from the source metadata object into this one.

Parameters
[in]sourceThe metadata object to merge from.

◆ Merge() [2/2]

void rtctk::componentFramework::RepositoryIf::MetaData::Merge ( MetaData && source)

Merge entries from the source metadata object into this one.

Warning
The entries in source metadata object are moved into this one. Therefore the moved keys will no longer exist in source. This behavior is similar to std::map::merge.
Parameters
[in,out]sourceThe metadata object to merge from.

◆ operator=() [1/2]

MetaData & rtctk::componentFramework::RepositoryIf::MetaData::operator= ( const MetaData & rhs)
default

◆ operator=() [2/2]

MetaData & rtctk::componentFramework::RepositoryIf::MetaData::operator= ( MetaData && rhs)
default

◆ operator[]() [1/3]

RepositoryIf::MetaData::ValueProxy rtctk::componentFramework::RepositoryIf::MetaData::operator[] ( const std::string & key)

Return a value for the specified key.

Insert a new key if necessary.

Parameters
[in]keyThe key to search for.
Returns
Reference to the metadata key's value.

◆ operator[]() [2/3]

RepositoryIf::MetaData::ConstValueProxy rtctk::componentFramework::RepositoryIf::MetaData::operator[] ( const std::string & key) const

Return a value for the specified key.

Parameters
[in]keyThe key to search for.
Returns
Read-only reference to the metadata key's value.
Exceptions
KeyDoesNotExistIf the metadata does not contain key.

◆ operator[]() [3/3]

RepositoryIf::MetaData::ValueProxy rtctk::componentFramework::RepositoryIf::MetaData::operator[] ( std::string && key)

Return a value for the specified key.

Insert a new key if necessary.

Parameters
[in]keyThe key to search for.
Returns
Reference to the metadata key's value.

◆ rbegin() [1/2]

RepositoryIf::MetaData::ReverseIterator rtctk::componentFramework::RepositoryIf::MetaData::rbegin ( )
inline

Return a reverse iterator to the beginning of the metadata entries.

◆ rbegin() [2/2]

RepositoryIf::MetaData::ConstReverseIterator rtctk::componentFramework::RepositoryIf::MetaData::rbegin ( ) const
inline

Return a read-only reverse iterator to the beginning of the metadata entries.

◆ Remove()

bool rtctk::componentFramework::RepositoryIf::MetaData::Remove ( const std::string & key)

Remove a metadata key.

Parameters
[in]keyThe new key to add.
Returns
true if the metadata actually contained the key and false otherwise.

◆ rend() [1/2]

RepositoryIf::MetaData::ReverseIterator rtctk::componentFramework::RepositoryIf::MetaData::rend ( )
inline

Return a reverse iterator to the end of the metadata entries.

◆ rend() [2/2]

RepositoryIf::MetaData::ConstReverseIterator rtctk::componentFramework::RepositoryIf::MetaData::rend ( ) const
inline

Return a read-only reverse iterator to the end of the metadata entries.


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