Note: Goby version 1 (shown here) is now considered obsolete. Please use version 2 for new projects, and consider upgrading old projects.

Goby Underwater Autonomy Project  Series: 1.1, revision: 163, released on 2013-02-06 14:23:27 -0500
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
Public Types | Friends
goby::acomms::DCCLMessageVal Class Reference

defines a DCCL value More...

#include <acomms/libdccl/message_val.h>

List of all members.

Public Types

enum  { MAX_DBL_PRECISION = 15 }

Public Member Functions

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

Friends

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

Detailed Description

defines a DCCL value

Examples:
libdccl/test/test.cpp.

Definition at line 33 of file message_val.h.


Member Function Documentation

bool goby::acomms::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)
Examples:
libdccl/test/test.cpp.

Definition at line 124 of file message_val.cpp.

bool goby::acomms::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)

Definition at line 155 of file message_val.cpp.

bool goby::acomms::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)

Definition at line 187 of file message_val.cpp.

bool goby::acomms::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)

Definition at line 226 of file message_val.cpp.

goby::acomms::DCCLMessageVal::operator bool ( ) const

allows statements of the form

 bool b = DCCLMessageVal("1"); 

Definition at line 273 of file message_val.cpp.

goby::acomms::DCCLMessageVal::operator double ( ) const

allows statements of the form

 double d = DCCLMessageVal("3.23"); 

Definition at line 265 of file message_val.cpp.

goby::acomms::DCCLMessageVal::operator float ( ) const

allows statements of the form

 float f = DCCLMessageVal("3.5"); 

Definition at line 304 of file message_val.cpp.

goby::acomms::DCCLMessageVal::operator int ( ) const

allows statements of the form

 int i = DCCLMessageVal(2); 

Definition at line 294 of file message_val.cpp.

goby::acomms::DCCLMessageVal::operator long ( ) const

allows statements of the form

 long l = DCCLMessageVal(5); 

Definition at line 287 of file message_val.cpp.

goby::acomms::DCCLMessageVal::operator std::string ( ) const

allows statements of the form

 std::string s = DCCLMessageVal(3); 

Definition at line 280 of file message_val.cpp.

goby::acomms::DCCLMessageVal::operator unsigned ( ) const

allows statements of the form

 unsigned u = DCCLMessageVal(2); 

Definition at line 299 of file message_val.cpp.

void goby::acomms::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

Definition at line 116 of file message_val.cpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends