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

A read-only interface class to an underlying metadata value. More...

#include <repositoryIf.hpp>

Public Member Functions

 ConstValueProxy ()=delete
 
 ConstValueProxy (const ConstValueProxy &rhs)=default
 
 ConstValueProxy (ConstValueProxy &&rhs)=default
 
 ~ConstValueProxy ()=default
 
bool HasValue () const noexcept
 Check if a value was assigned to the metadata value.
 
const std::type_info & GetValueType () const noexcept
 Get the type of the metadata value stored.
 
 operator const std::any & () const
 Cast operator to return a read-only reference to the underling std::any value object.
 
template<typename T >
const T & Cast () const
 Cast the value to the given C++ type.
 

Detailed Description

A read-only interface class to an underlying metadata value.

This class enforces the type checks required by MetaData to make sure only the correct types are allowed in the underling metadata mapping.

Constructor & Destructor Documentation

◆ ConstValueProxy() [1/3]

◆ ConstValueProxy() [2/3]

◆ ConstValueProxy() [3/3]

◆ ~ConstValueProxy()

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

Member Function Documentation

◆ Cast()

template<typename T >
const T & rtctk::componentFramework::RepositoryIf::MetaData::ConstValueProxy::Cast ( ) const

Cast the value to the given C++ type.

Warning
This method should only be called if HasValue returns true.
Template Parameters
TThe type to cast the value to.
Returns
A read-only reference to the metadata value.
Exceptions
std::bad_any_castIf the metadata cannot be cast to the given type T.

◆ GetValueType()

const std::type_info & rtctk::componentFramework::RepositoryIf::MetaData::ConstValueProxy::GetValueType ( ) const
noexcept

Get the type of the metadata value stored.

Returns
The typeid of the C++ object type stored in the value.

◆ HasValue()

bool rtctk::componentFramework::RepositoryIf::MetaData::ConstValueProxy::HasValue ( ) const
inlinenoexcept

Check if a value was assigned to the metadata value.

Returns
true if the value referred to by this proxy object actually has a value assigned and false if it does not.

◆ operator const std::any &()

rtctk::componentFramework::RepositoryIf::MetaData::ConstValueProxy::operator const std::any & ( ) const
inline

Cast operator to return a read-only reference to the underling std::any value object.


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