Public Member Functions | Private Attributes | List of all members
hebi::Info::EnumField< T > Class Template Referencefinal

A message field representable by an enum of a given type. More...

#include <info.hpp>

Public Member Functions

 EnumField (HebiInfoPtr internal, HebiInfoEnumField field)
 
get () const
 If the field has a value, returns that value; otherwise, returns a default. More...
 
bool has () const
 True if (and only if) the field has a value. More...
 
 operator bool () const
 Allows casting to a bool to check if the field has a value without directly calling has(). More...
 

Private Attributes

HebiInfoEnumField const field_
 
HebiInfoPtr const internal_
 

Detailed Description

template<typename T>
class hebi::Info::EnumField< T >

A message field representable by an enum of a given type.

Definition at line 228 of file info.hpp.

Constructor & Destructor Documentation

template<typename T>
hebi::Info::EnumField< T >::EnumField ( HebiInfoPtr  internal,
HebiInfoEnumField< T >  field 
)
inline

Definition at line 232 of file info.hpp.

Member Function Documentation

template<typename T>
T hebi::Info::EnumField< T >::get ( ) const
inline

If the field has a value, returns that value; otherwise, returns a default.

Definition at line 252 of file info.hpp.

template<typename T>
bool hebi::Info::EnumField< T >::has ( ) const
inline

True if (and only if) the field has a value.

Definition at line 249 of file info.hpp.

template<typename T>
hebi::Info::EnumField< T >::operator bool ( ) const
inlineexplicit

Allows casting to a bool to check if the field has a value without directly calling has().

This can be used as in the following (assuming 'parent' is a parent message, and this field is called 'myField')

Info::EnumField& f = parent.myField();
if (f)
std::cout << "Field has value: " << f.get() << std::endl;
else
std::cout << "Field has no value!" << std::endl;

Definition at line 247 of file info.hpp.

Member Data Documentation

template<typename T>
HebiInfoEnumField const hebi::Info::EnumField< T >::field_
private

Definition at line 256 of file info.hpp.

template<typename T>
HebiInfoPtr const hebi::Info::EnumField< T >::internal_
private

Definition at line 255 of file info.hpp.


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


hebiros
Author(s): Xavier Artache , Matthew Tesch
autogenerated on Thu Sep 3 2020 04:11:00