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

Binary data of known or unknown type. More...

#include <ubinary.hh>

Collaboration diagram for urbi::UBinary:

List of all members.

Public Member Functions

 UBinary ()
 UBinary (const UBinary &b, bool copy=true, bool temp=false)
 Deep copy constructor.
 UBinary (const UImage &, bool copy=true)
 UBinary (const USound &, bool copy=true)
UBinaryoperator= (const UBinary &b)
 Deep copy.
void buildMessage ()
 Store the result of getMessage() in member message.
std::string getMessage () const
 Get header.
void clear ()
 Clear all the buffers that were allocated by the system.
 ~UBinary ()
 Frees binary buffer.
bool parse (std::istringstream &is, const binaries_type &bins, binaries_type::const_iterator &binpos, bool copy=true)
 Return true on success.
int parse (const char *message, int pos, const binaries_type &bins, binaries_type::const_iterator &binpos, bool copy=true)
std::ostream & print (std::ostream &o, int kernelMajor=2) const
 Used by UValue::print for serialization.

Public Attributes

UBinaryType type
union {
   struct {
      void *   data
 binary data
      size_t   size
   }   common
   UImage   image
   USound   sound
}; 
std::string message
 Headers (everything after "BIN theSize" and before ';' or
).
bool allocated_
 Whether the memory (common.data) is managed by this object, or by the user.
bool temporary_
 If true, content is a temporary value that can be stolen when copied.

Detailed Description

Binary data of known or unknown type.

Handles its memory: the data field will be freed when the destructor is called.

Definition at line 63 of file ubinary.hh.


Constructor & Destructor Documentation

urbi::UBinary::UBinary ( )

Definition at line 28 of file ubinary.cc.

References common.

urbi::UBinary::UBinary ( const UBinary b,
bool  copy = true,
bool  temp = false 
)

Deep copy constructor.

Definition at line 37 of file ubinary.cc.

References common, image, message, sound, and type.

urbi::UBinary::UBinary ( const UImage i,
bool  copy = true 
) [explicit]

Definition at line 55 of file ubinary.cc.

References urbi::UImage::data, image, and urbi::UImage::size.

urbi::UBinary::UBinary ( const USound i,
bool  copy = true 
) [explicit]

Definition at line 68 of file ubinary.cc.

References urbi::USound::data, urbi::USound::size, and sound.

urbi::UBinary::~UBinary ( )

Frees binary buffer.

Definition at line 92 of file ubinary.cc.

References clear().


Member Function Documentation

void urbi::UBinary::buildMessage ( )

Store the result of getMessage() in member message.

Definition at line 264 of file ubinary.cc.

References getMessage(), and message.

Referenced by urbi::UAbstractClient::send().

void urbi::UBinary::clear ( )

Clear all the buffers that were allocated by the system.

Definition at line 82 of file ubinary.cc.

References allocated_, and common.

Referenced by operator=(), and ~UBinary().

UBinary & urbi::UBinary::operator= ( const UBinary b)
int urbi::UBinary::parse ( const char *  message,
int  pos,
const binaries_type bins,
binaries_type::const_iterator &  binpos,
bool  copy = true 
)

Definition at line 137 of file ubinary.cc.

References parse().

std::ostream & urbi::UBinary::print ( std::ostream &  o,
int  kernelMajor = 2 
) const

Used by UValue::print for serialization.

Definition at line 305 of file ubinary.cc.

References common, and getMessage().

Referenced by urbi::operator<<().


Member Data Documentation

union { ... }

Whether the memory (common.data) is managed by this object, or by the user.

Definition at line 112 of file ubinary.hh.

Referenced by clear(), urbi::loadUValue(), and parse().

binary data

Definition at line 101 of file ubinary.hh.

Headers (everything after "BIN theSize" and before ';' or
).

Definition at line 108 of file ubinary.hh.

Referenced by buildMessage(), getMessage(), urbi::operator,(), operator=(), parse(), urbi::UAbstractClient::send(), and UBinary().

Definition at line 102 of file ubinary.hh.

If true, content is a temporary value that can be stolen when copied.

Assigning from a temporary will mark the target as temporary too. So the temporary_ property must be reset to false manually at some point.

Definition at line 118 of file ubinary.hh.

Referenced by operator=().


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