ACE_RMCast::Data Struct Reference

#include <Protocol.h>

Inheritance diagram for ACE_RMCast::Data:

Inheritance graph
[legend]
Collaboration diagram for ACE_RMCast::Data:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual ~Data ()
 Data (Header const &h, istream &is)
 Data (void const *buf, size_t s, size_t capacity=0)
Data_ptr clone ()
char const * buf () const
char * buf ()
size_t size () const
void size (size_t s)
size_t capacity () const
virtual void serialize_body (ostream &os) const
virtual void serialize_body (sstream &ss) const

Static Public Attributes

static u16 const id = 0x0003

Protected Member Functions

virtual Profile_ptr clone_ ()
 Data (Data const &d)

Private Attributes

char * buf_
size_t size_
size_t capacity_

Detailed Description

Definition at line 551 of file Protocol.h.


Constructor & Destructor Documentation

virtual ACE_RMCast::Data::~Data (  )  [inline, virtual]

Definition at line 557 of file Protocol.h.

References buf_.

00558     {
00559       if (buf_)
00560         operator delete (buf_);
00561     }

ACE_RMCast::Data::Data ( Header const &  h,
istream is 
) [inline]

Definition at line 563 of file Protocol.h.

References buf_, capacity_, ACE_InputCDR::read_char_array(), and size_.

00564         : Profile (h),
00565           buf_ (0),
00566           size_ (h.size ()),
00567           capacity_ (size_)
00568     {
00569       if (size_)
00570       {
00571         buf_ = reinterpret_cast<char*> (operator new (capacity_));
00572         is.read_char_array (buf_, size_);
00573       }
00574     }

ACE_RMCast::Data::Data ( void const *  buf,
size_t  s,
size_t  capacity = 0 
) [inline]

Definition at line 576 of file Protocol.h.

References buf_, ACE_RMCast::Profile::calculate_size(), capacity_, ACE_OS::memcpy(), ACE_RMCast::Profile::size(), and size_.

00577         : Profile (id),
00578           buf_ (0),
00579           size_ (s),
00580           capacity_ (capacity < size_ ? size_ : capacity)
00581     {
00582       if (size_)
00583       {
00584         buf_ = reinterpret_cast<char*> (operator new (capacity_));
00585         ACE_OS::memcpy (buf_, buf, size_);
00586       }
00587 
00588       Profile::size (calculate_size ());
00589     }

ACE_RMCast::Data::Data ( Data const &  d  )  [inline, protected]

Definition at line 605 of file Protocol.h.

References buf_, ACE_RMCast::Profile::calculate_size(), capacity_, ACE_OS::memcpy(), ACE_RMCast::Profile::size(), and size_.

00606         : Profile (d),
00607           buf_ (0),
00608           size_ (d.size_),
00609           capacity_ (d.capacity_)
00610     {
00611       if (size_)
00612       {
00613         buf_ = reinterpret_cast<char*> (operator new (capacity_));
00614         ACE_OS::memcpy (buf_, d.buf_, size_);
00615       }
00616 
00617       Profile::size (calculate_size ());
00618     }


Member Function Documentation

char* ACE_RMCast::Data::buf ( void   )  [inline]

Definition at line 628 of file Protocol.h.

References buf_.

00629     {
00630       return buf_;
00631     }

char const* ACE_RMCast::Data::buf ( void   )  const [inline]

Definition at line 622 of file Protocol.h.

References buf_.

Referenced by ACE_RMCast::Reassemble::recv(), and ACE_RMCast::Socket_Impl::recv_().

00623     {
00624       return buf_;
00625     }

size_t ACE_RMCast::Data::capacity ( void   )  const [inline]

Definition at line 651 of file Protocol.h.

References capacity_.

00652     {
00653       return capacity_;
00654     }

Data_ptr ACE_RMCast::Data::clone ( void   )  [inline]

Reimplemented from ACE_RMCast::Profile.

Definition at line 592 of file Protocol.h.

References clone_().

00593     {
00594       return Data_ptr (clone_ ());
00595     }

virtual Profile_ptr ACE_RMCast::Data::clone_ (  )  [inline, protected, virtual]

Implements ACE_RMCast::Profile.

Definition at line 599 of file Protocol.h.

Referenced by clone().

00600     {
00601       Profile_ptr p (new Data (*this));
00602       return p;
00603     }

virtual void ACE_RMCast::Data::serialize_body ( sstream ss  )  const [inline, virtual]

Implements ACE_RMCast::Profile.

Definition at line 664 of file Protocol.h.

References buf_, size_, and ACE_SizeCDR::write_char_array().

00665     {
00666       ss.write_char_array (buf_, size_);
00667     }

virtual void ACE_RMCast::Data::serialize_body ( ostream os  )  const [inline, virtual]

Implements ACE_RMCast::Profile.

Definition at line 658 of file Protocol.h.

References buf_, size_, and ACE_OutputCDR::write_char_array().

00659     {
00660       os.write_char_array (buf_, size_);
00661     }

void ACE_RMCast::Data::size ( size_t  s  )  [inline]

Definition at line 640 of file Protocol.h.

References ACE_OS::abort(), ACE_RMCast::Profile::calculate_size(), capacity_, ACE_RMCast::Profile::size(), and size_.

00641     {
00642       if (s > capacity_)
00643         ACE_OS::abort ();
00644 
00645       size_ = s;
00646 
00647       Profile::size (calculate_size ());
00648     }

size_t ACE_RMCast::Data::size ( void   )  const [inline]

Reimplemented from ACE_RMCast::Profile.

Definition at line 634 of file Protocol.h.

References size_.

Referenced by ACE_RMCast::Reassemble::recv(), ACE_RMCast::Socket_Impl::recv_(), and ACE_RMCast::Socket_Impl::size_().

00635     {
00636       return size_;
00637     }


Member Data Documentation

char* ACE_RMCast::Data::buf_ [private]

Definition at line 670 of file Protocol.h.

Referenced by buf(), Data(), serialize_body(), and ~Data().

size_t ACE_RMCast::Data::capacity_ [private]

Definition at line 672 of file Protocol.h.

Referenced by capacity(), Data(), and size().

u16 const ACE_RMCast::Data::id = 0x0003 [static]

Definition at line 553 of file Protocol.h.

size_t ACE_RMCast::Data::size_ [private]

Definition at line 671 of file Protocol.h.

Referenced by Data(), serialize_body(), and size().


The documentation for this struct was generated from the following files:
Generated on Tue Feb 2 17:36:30 2010 for ACE_RMCast by  doxygen 1.4.7