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

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

#include <command.hpp>

Public Member Functions

void clear ()
 Removes any currently set value for this field. More...
 
 EnumField (HebiCommandPtr internal, HebiCommandEnumField 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...
 
void set (T _value)
 Sets the field to a given value. More...
 

Private Attributes

HebiCommandEnumField const field_
 
HebiCommandPtr const internal_
 

Detailed Description

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

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

Definition at line 287 of file command.hpp.

Constructor & Destructor Documentation

template<typename T>
hebi::Command::EnumField< T >::EnumField ( HebiCommandPtr  internal,
HebiCommandEnumField< T >  field 
)
inline

Definition at line 291 of file command.hpp.

Member Function Documentation

template<typename T>
void hebi::Command::EnumField< T >::clear ( )
inline

Removes any currently set value for this field.

Definition at line 315 of file command.hpp.

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

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

Definition at line 311 of file command.hpp.

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

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

Definition at line 308 of file command.hpp.

template<typename T>
hebi::Command::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')

Command::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 306 of file command.hpp.

template<typename T>
void hebi::Command::EnumField< T >::set ( _value)
inline

Sets the field to a given value.

Definition at line 313 of file command.hpp.

Member Data Documentation

template<typename T>
HebiCommandEnumField const hebi::Command::EnumField< T >::field_
private

Definition at line 319 of file command.hpp.

template<typename T>
HebiCommandPtr const hebi::Command::EnumField< T >::internal_
private

Definition at line 318 of file command.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:10:59