Urbi SDK Remote for C++  2.7.5
urbi::UValue Class Reference

Container for a value that handles all types known to URBI. More...

#include <uvalue.hh>

Inheritance diagram for urbi::UValue:
Collaboration diagram for urbi::UValue:

List of all members.

Public Member Functions

 UValue ()
 Class UValue implementation.
 UValue (const UValue &)
 ~UValue ()
UValueoperator= (const UValue &)
UValueset (const UValue &, bool copy=true)
 Setter.
void clear ()
 Delete content and reset type to void.
UValueoperator, (const UValue &b)
 We use an operator , that behaves like an assignment.
const char * format_string () const
 Return a legible definition of UDataType.
 operator ufloat () const
 operator std::string () const
 operator bool () const
 operator const UBinary & () const
 Accessor. Gives us an implicit operator UBinary() const.
 operator UList () const
 Deep copy.
 operator UDictionary () const
 Deep copy.
 operator UImage () const
 Shallow copy.
 operator USound () const
 Shallow copy.
UValueoperator() ()
 This operator does nothing, but helps with the previous operator,.
int parse (const char *message, int pos, const binaries_type &bins, binaries_type::const_iterator &binpos)
 Parse an uvalue in current message+pos, returns pos of end of match -pos of error if error.
std::ostream & print (std::ostream &s) const
 Print itself on s, and return it.

Static Public Member Functions

static UValueerror ()
 A specific UValue used when we want to return an error.

Public Attributes

UDataType type
ufloat val
 value if of type DATA_DOUBLE
union {
   std::string *   stringValue
 value if of type DATA_STRING
   UBinary *   binary
 value if of type DATA_BINARY
   UList *   list
 value if of type DATA_LIST
   UDictionary *   dictionary
 value if of type DATA_DICTIONARY
   void *   storage
 internal
}; 

Static Public Attributes

static const bool copy = true

Detailed Description

Container for a value that handles all types known to URBI.

Definition at line 175 of file uvalue.hh.


Constructor & Destructor Documentation

urbi::UValue::UValue ( )

Class UValue implementation.

Definition at line 344 of file uvalue-common.cc.

Referenced by parse().

urbi::UValue::UValue ( const UValue v)

Definition at line 594 of file uvalue-common.cc.

urbi::UValue::~UValue ( )

Definition at line 438 of file uvalue-common.cc.

References clear().


Member Function Documentation

void urbi::UValue::clear ( )
UValue & urbi::UValue::error ( ) [static]

A specific UValue used when we want to return an error.

For instance, out-of-bound access returns this object.

Definition at line 88 of file uvalue-common.cc.

const char * urbi::UValue::format_string ( ) const

Return a legible definition of UDataType.

Definition at line 105 of file uvalue-common.cc.

References urbi::DATA_VOID, urbi::formats, and type.

urbi::UValue::operator bool ( ) const [inline]

Definition at line 194 of file uvalue.hxx.

urbi::UValue::operator const UBinary & ( ) const

Accessor. Gives us an implicit operator UBinary() const.

Definition at line 486 of file uvalue-common.cc.

References binary, urbi::DATA_BINARY, and type.

urbi::UValue::operator std::string ( ) const
urbi::UValue::operator UDictionary ( ) const

Deep copy.

Definition at line 516 of file uvalue-common.cc.

References urbi::DATA_DICTIONARY, dictionary, and type.

urbi::UValue::operator ufloat ( ) const
urbi::UValue::operator UImage ( ) const
urbi::UValue::operator UList ( ) const

Deep copy.

Definition at line 509 of file uvalue-common.cc.

References urbi::DATA_LIST, list, and type.

urbi::UValue::operator USound ( ) const
UValue & urbi::UValue::operator() ( ) [inline]

This operator does nothing, but helps with the previous operator,.

Indeed, when writing "uval, void_expr", the compiler complains about uval being evaluated for nothing. Let's have it believe we're doing something...

Definition at line 202 of file uvalue.hxx.

UValue & urbi::UValue::operator, ( const UValue b) [inline]

We use an operator , that behaves like an assignment.

The only difference is when the rhs is void, in which case it is the regular comma which is used. This allows to write "uval, expr" to mean "compute expr and assign its result to uval, unless expr is void".

Definition at line 137 of file uvalue.hxx.

UValue & urbi::UValue::operator= ( const UValue v)

Definition at line 523 of file uvalue-common.cc.

int urbi::UValue::parse ( const char *  message,
int  pos,
const binaries_type bins,
binaries_type::const_iterator &  binpos 
)

Parse an uvalue in current message+pos, returns pos of end of match -pos of error if error.

Definition at line 150 of file uvalue-common.cc.

References urbi::UList::array, binary, CHECK_NEOF, urbi::DATA_BINARY, urbi::DATA_DICTIONARY, urbi::DATA_DOUBLE, urbi::DATA_LIST, urbi::DATA_STRING, urbi::DATA_VOID, dictionary, EXPECT, list, urbi::UBinary::parse(), parse(), SKIP_SPACES, stringValue, type, UValue(), and val.

Referenced by urbi::UMessage::init_(), and parse().

std::ostream & urbi::UValue::print ( std::ostream &  s) const
UValue & urbi::UValue::set ( const UValue v,
bool  copy = true 
)

Setter.

If copy is false, binary data if present is not copied. This is dangerous, as the user must ensure that the source UValue lives longer than this one.

Definition at line 528 of file uvalue-common.cc.

References urbi::UList::array, binary, clear(), urbi::DATA_BINARY, urbi::DATA_DICTIONARY, urbi::DATA_DOUBLE, urbi::DATA_LIST, urbi::DATA_SLOTNAME, urbi::DATA_STRING, urbi::DATA_VOID, dictionary, list, urbi::UList::offset, storage, stringValue, type, and val.

Referenced by urbi::impl::RemoteUContextImpl::assignMessage(), and urbi::impl::RemoteUVarImpl::sync().


Member Data Documentation

union { ... }
const bool urbi::UValue::copy = true [static]

Definition at line 323 of file uvalue.hh.

internal

Definition at line 187 of file uvalue.hh.

Referenced by urbi::uvalue_caster< UVar >::operator()(), set(), and urbi::uvar_uvalue_cast().

value if of type DATA_DOUBLE

Definition at line 180 of file uvalue.hh.

Referenced by urbi::impl::RemoteUContextImpl::onRTPListenMessage(), operator ufloat(), parse(), print(), urbi::saveUValue(), and set().


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