Public Member Functions | Private Attributes | List of all members
hebi::Command::FloatField Class Referencefinal

A message field representable by a single-precision floating point value. More...

#include <command.hpp>

Public Member Functions

void clear ()
 Removes any currently set value for this field. More...
 
 FloatField (HebiCommandRef &internal, HebiCommandFloatField field)
 
float 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 (float value)
 Sets the field to a given value. More...
 

Private Attributes

HebiCommandFloatField const field_
 
HebiCommandRefinternal_
 

Detailed Description

A message field representable by a single-precision floating point value.

Definition at line 73 of file command.hpp.

Constructor & Destructor Documentation

hebi::Command::FloatField::FloatField ( HebiCommandRef internal,
HebiCommandFloatField  field 
)

Definition at line 12 of file command.cpp.

Member Function Documentation

void hebi::Command::FloatField::clear ( )

Removes any currently set value for this field.

Definition at line 27 of file command.cpp.

float hebi::Command::FloatField::get ( ) const

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

Definition at line 17 of file command.cpp.

bool hebi::Command::FloatField::has ( ) const

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

Definition at line 15 of file command.cpp.

hebi::Command::FloatField::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::FloatField& 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 90 of file command.hpp.

void hebi::Command::FloatField::set ( float  value)

Sets the field to a given value.

Definition at line 25 of file command.cpp.

Member Data Documentation

HebiCommandFloatField const hebi::Command::FloatField::field_
private

Definition at line 104 of file command.hpp.

HebiCommandRef& hebi::Command::FloatField::internal_
private

Definition at line 103 of file command.hpp.


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


hebi_cpp_api_ros
Author(s): Chris Bollinger , Matthew Tesch
autogenerated on Thu May 28 2020 03:14:45