The Micro C++ Library
micxx::Datagram Class Reference

The Datagram class implements an unrelated network packet for any unreliable transmission protocol (e.g. UDP). More...

#include <micxx.hxx>

Inherits micxx::Buffer.

Inherited by micxx::InetDatagram.

List of all members.

Public Member Functions

 Datagram (std::size_t size=0)
 Create an empty Datagram with initial size and capacity size.
 Datagram (const Datagram &right)
 Create a copy of Datagram right.
virtual ~Datagram ()
 Deallocate the addresses and the inherited Buffer.
virtual SocketAddressgetDstAddress ()
 The optionally available destination address this datagram was addressed to.
virtual const SocketAddressgetDstAddress () const
 The const version of getDstAddress().
virtual SocketAddressgetSrcAddress ()
 The optionally available source address this datagram was sent from.
virtual const SocketAddressgetSrcAddress () const
 The const version of getSrcAddress().
virtual unsigned long long getTimestamp () const
 The timestamp in milli seconds set by setTimestamp(unsigned long long).
virtual Datagramoperator= (const Datagram &right)
 Make this a copy of Datagram right.
virtual void setDstAddress (const SocketAddress *adstAddress)
 (Re)set the destination address of this Datagram.
virtual void setSrcAddress (const SocketAddress *asrcAddress)
 (Re)set the source address of this Datagram.
virtual void setTimestamp (unsigned long long millis)
 (Re)set the timestamp for this Datagram.
virtual std::string toString () const
 A string representation describing this Datagram.

Detailed Description

The Datagram class implements an unrelated network packet for any unreliable transmission protocol (e.g. UDP).

A Datagram is a Buffer that optionally may have a source and destination address and a timestamp.

Author:
Norbert Klose
Date:
February, 2007

Constructor & Destructor Documentation

micxx::Datagram::Datagram ( std::size_t  size = 0)

Create an empty Datagram with initial size and capacity size.

Parameters:
sizeThe initial size and capacity.
micxx::Datagram::Datagram ( const Datagram right)

Create a copy of Datagram right.

Parameters:
rightThe Datagram from which to copy.
virtual micxx::Datagram::~Datagram ( ) [virtual]

Deallocate the addresses and the inherited Buffer.


Member Function Documentation

virtual SocketAddress* micxx::Datagram::getDstAddress ( ) [virtual]

The optionally available destination address this datagram was addressed to.

Returns:
The destination address, that was set by setDstAddress(const SocketAddress*), or
0 otherwise.
virtual const SocketAddress* micxx::Datagram::getDstAddress ( ) const [virtual]

The const version of getDstAddress().

virtual const SocketAddress* micxx::Datagram::getSrcAddress ( ) const [virtual]

The const version of getSrcAddress().

virtual SocketAddress* micxx::Datagram::getSrcAddress ( ) [virtual]

The optionally available source address this datagram was sent from.

Returns:
The source address, that was set by setSrcAddress(const SocketAddress*), or
0 otherwise.
virtual unsigned long long micxx::Datagram::getTimestamp ( ) const [virtual]

The timestamp in milli seconds set by setTimestamp(unsigned long long).

Returns:
The timestamp in milli seconds set by setTimestamp(unsigned long long), or
0 otherwise.
virtual Datagram& micxx::Datagram::operator= ( const Datagram right) [virtual]

Make this a copy of Datagram right.

Parameters:
rightThe Datagram from which to copy.
Returns:
*this
virtual void micxx::Datagram::setDstAddress ( const SocketAddress adstAddress) [virtual]

(Re)set the destination address of this Datagram.

Parameters:
adstAddressThe address to be stored (as a copy), or 0 to reset the destination address to 0.

Reimplemented in micxx::InetDatagram.

virtual void micxx::Datagram::setSrcAddress ( const SocketAddress asrcAddress) [virtual]

(Re)set the source address of this Datagram.

Parameters:
asrcAddressThe address to be stored (as a copy), or 0 to reset the source address to 0.

Reimplemented in micxx::InetDatagram.

virtual void micxx::Datagram::setTimestamp ( unsigned long long  millis) [virtual]

(Re)set the timestamp for this Datagram.

Parameters:
millisthe timestamp in milli seconds to be stored
virtual std::string micxx::Datagram::toString ( ) const [virtual]

A string representation describing this Datagram.

Reimplemented from micxx::Buffer.


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