Goby3  3.1.5a
2024.05.23
goby::moos::transitional::DCCLMessageVal Class Reference

defines a DCCL value More...

#include <goby/moos/transitional/message_val.h>

Public Types

enum  { MAX_DBL_PRECISION = 15 }
 

Public Member Functions

Constructors/Destructor
 DCCLMessageVal ()
 empty More...
 
 DCCLMessageVal (const std::string &s)
 construct with string value More...
 
 DCCLMessageVal (const char *s)
 construct with char* value More...
 
 DCCLMessageVal (double d, int p=MAX_DBL_PRECISION)
 construct with double value, optionally givig the precision of the double (number of decimal places) which is used if a cast to std::string is required in the future. More...
 
 DCCLMessageVal (long l)
 construct with long value More...
 
 DCCLMessageVal (int i)
 construct with int value More...
 
 DCCLMessageVal (float f)
 construct with float value More...
 
 DCCLMessageVal (bool b)
 construct with bool value More...
 
 DCCLMessageVal (const std::vector< DCCLMessageVal > &vm)
 construct with vector More...
 
Setters
void set (std::string sval)
 set the value with a string (overwrites previous value regardless of type) More...
 
void set (double dval, int precision=MAX_DBL_PRECISION)
 set the value with a double (overwrites previous value regardless of type) More...
 
void set (long lval)
 set the value with a long (overwrites previous value regardless of type) More...
 
void set (bool bval)
 set the value with a bool (overwrites previous value regardless of type) More...
 
Getters
bool get (std::string &s) const
 extract as std::string (all reasonable casts are done) More...
 
bool get (bool &b) const
 extract as bool (all reasonable casts are done) More...
 
bool get (long &t) const
 extract as long (all reasonable casts are done) More...
 
bool get (double &d) const
 extract as double (all reasonable casts are done) More...
 
 operator double () const
 allows statements of the form More...
 
 operator bool () const
 allows statements of the form More...
 
 operator std::string () const
 allows statements of the form More...
 
 operator long () const
 allows statements of the form More...
 
 operator int () const
 allows statements of the form More...
 
 operator unsigned () const
 allows statements of the form More...
 
 operator float () const
 allows statements of the form More...
 
 operator std::vector< DCCLMessageVal > () const
 
DCCLCppType type () const
 what type is the original type of this DCCLMessageVal? More...
 
bool empty () const
 was this just constructed with DCCLMessageVal() ? More...
 
unsigned precision () const
 

Comparison

bool operator== (const DCCLMessageVal &mv) const
 
bool operator== (const std::string &s) const
 
bool operator== (double d) const
 
bool operator== (long l) const
 
bool operator== (bool b) const
 
std::ostream & operator<< (std::ostream &os, const DCCLMessageVal &mv)
 

Detailed Description

defines a DCCL value

Definition at line 41 of file message_val.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
MAX_DBL_PRECISION 

Definition at line 44 of file message_val.h.

Constructor & Destructor Documentation

◆ DCCLMessageVal() [1/9]

goby::moos::transitional::DCCLMessageVal::DCCLMessageVal ( )

empty

◆ DCCLMessageVal() [2/9]

goby::moos::transitional::DCCLMessageVal::DCCLMessageVal ( const std::string &  s)

construct with string value

◆ DCCLMessageVal() [3/9]

goby::moos::transitional::DCCLMessageVal::DCCLMessageVal ( const char s)

construct with char* value

◆ DCCLMessageVal() [4/9]

goby::moos::transitional::DCCLMessageVal::DCCLMessageVal ( double  d,
int  p = MAX_DBL_PRECISION 
)

construct with double value, optionally givig the precision of the double (number of decimal places) which is used if a cast to std::string is required in the future.

◆ DCCLMessageVal() [5/9]

goby::moos::transitional::DCCLMessageVal::DCCLMessageVal ( long  l)

construct with long value

◆ DCCLMessageVal() [6/9]

goby::moos::transitional::DCCLMessageVal::DCCLMessageVal ( int  i)

construct with int value

◆ DCCLMessageVal() [7/9]

goby::moos::transitional::DCCLMessageVal::DCCLMessageVal ( float  f)

construct with float value

◆ DCCLMessageVal() [8/9]

goby::moos::transitional::DCCLMessageVal::DCCLMessageVal ( bool  b)

construct with bool value

◆ DCCLMessageVal() [9/9]

goby::moos::transitional::DCCLMessageVal::DCCLMessageVal ( const std::vector< DCCLMessageVal > &  vm)

construct with vector

Member Function Documentation

◆ empty()

bool goby::moos::transitional::DCCLMessageVal::empty ( ) const
inline

was this just constructed with DCCLMessageVal() ?

Definition at line 148 of file message_val.h.

◆ get() [1/4]

bool goby::moos::transitional::DCCLMessageVal::get ( bool b) const

extract as bool (all reasonable casts are done)

Parameters
bbool to store value in
Returns
successfully extracted (and if necessary successfully cast to this type)

◆ get() [2/4]

bool goby::moos::transitional::DCCLMessageVal::get ( double d) const

extract as double (all reasonable casts are done)

Parameters
ddouble to store value in
Returns
successfully extracted (and if necessary successfully cast to this type)

◆ get() [3/4]

bool goby::moos::transitional::DCCLMessageVal::get ( long &  t) const

extract as long (all reasonable casts are done)

Parameters
tlong to store value in
Returns
successfully extracted (and if necessary successfully cast to this type)

◆ get() [4/4]

bool goby::moos::transitional::DCCLMessageVal::get ( std::string &  s) const

extract as std::string (all reasonable casts are done)

Parameters
sstd::string to store value in
Returns
successfully extracted (and if necessary successfully cast to this type)

◆ operator bool()

goby::moos::transitional::DCCLMessageVal::operator bool ( ) const

allows statements of the form

bool b = DCCLMessageVal("1");

◆ operator double()

goby::moos::transitional::DCCLMessageVal::operator double ( ) const

allows statements of the form

double d = DCCLMessageVal("3.23");

◆ operator float()

goby::moos::transitional::DCCLMessageVal::operator float ( ) const

allows statements of the form

float f = DCCLMessageVal("3.5");

◆ operator int()

goby::moos::transitional::DCCLMessageVal::operator int ( ) const

allows statements of the form

int i = DCCLMessageVal(2);

◆ operator long()

goby::moos::transitional::DCCLMessageVal::operator long ( ) const

allows statements of the form

long l = DCCLMessageVal(5);

◆ operator std::string()

goby::moos::transitional::DCCLMessageVal::operator std::string ( ) const

allows statements of the form

std::string s = DCCLMessageVal(3);

◆ operator std::vector< DCCLMessageVal >()

goby::moos::transitional::DCCLMessageVal::operator std::vector< DCCLMessageVal > ( ) const

◆ operator unsigned()

goby::moos::transitional::DCCLMessageVal::operator unsigned ( ) const

allows statements of the form

unsigned u = DCCLMessageVal(2);

◆ operator==() [1/5]

bool goby::moos::transitional::DCCLMessageVal::operator== ( bool  b) const

◆ operator==() [2/5]

bool goby::moos::transitional::DCCLMessageVal::operator== ( const DCCLMessageVal mv) const

◆ operator==() [3/5]

bool goby::moos::transitional::DCCLMessageVal::operator== ( const std::string &  s) const

◆ operator==() [4/5]

bool goby::moos::transitional::DCCLMessageVal::operator== ( double  d) const

◆ operator==() [5/5]

bool goby::moos::transitional::DCCLMessageVal::operator== ( long  l) const

◆ precision()

unsigned goby::moos::transitional::DCCLMessageVal::precision ( ) const
inline

Definition at line 150 of file message_val.h.

◆ set() [1/4]

void goby::moos::transitional::DCCLMessageVal::set ( bool  bval)

set the value with a bool (overwrites previous value regardless of type)

◆ set() [2/4]

void goby::moos::transitional::DCCLMessageVal::set ( double  dval,
int  precision = MAX_DBL_PRECISION 
)

set the value with a double (overwrites previous value regardless of type)

Parameters
dvalvalues to set
precisiondecimal places of precision to preserve if this is cast to a string

◆ set() [3/4]

void goby::moos::transitional::DCCLMessageVal::set ( long  lval)

set the value with a long (overwrites previous value regardless of type)

◆ set() [4/4]

void goby::moos::transitional::DCCLMessageVal::set ( std::string  sval)

set the value with a string (overwrites previous value regardless of type)

◆ type()

DCCLCppType goby::moos::transitional::DCCLMessageVal::type ( ) const
inline

what type is the original type of this DCCLMessageVal?

Definition at line 145 of file message_val.h.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const DCCLMessageVal mv 
)
friend

The documentation for this class was generated from the following file:
goby::moos::transitional::DCCLMessageVal::DCCLMessageVal
DCCLMessageVal()
empty