TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX > Class Template Reference

#include <ZeroCopySeq_T.h>

Collaboration diagram for TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >:
Collaboration graph
[legend]

List of all members.

Classes

class  PrivateMemberAccess
 Only used by the FooDataReaderImpl and tests. More...
class  ZeroCopyVector

Public Types

typedef Sample_T value_type

Public Member Functions

 ZeroCopyDataSeq (CORBA::ULong maximum=0, CORBA::ULong init_size=DEF_MAX, ACE_Allocator *alloc=0)
 ZeroCopyDataSeq (CORBA::ULong maximum, CORBA::ULong length, Sample_T *buffer, CORBA::Boolean release=false)
 ZeroCopyDataSeq (const ZeroCopyDataSeq &frm)
ZeroCopyDataSeqoperator= (const ZeroCopyDataSeq &frm)
void swap (ZeroCopyDataSeq &frm)
 ~ZeroCopyDataSeq ()
CORBA::ULong maximum () const
void length (CORBA::ULong length)
CORBA::ULong length () const
const Sample_T & operator[] (CORBA::ULong i) const
Sample_T & operator[] (CORBA::ULong i)
CORBA::Boolean release () const
void replace (CORBA::ULong max, CORBA::ULong length, Sample_T *buffer, CORBA::Boolean release=false)
Sample_T * get_buffer (CORBA::Boolean orphan=false)
const Sample_T * get_buffer () const
void increment_references (void)

Static Public Member Functions

static Sample_T * allocbuf (CORBA::ULong nelems)
static void freebuf (Sample_T *buffer)

Private Types

typedef ZeroCopyVector Ptr_Seq_Type

Private Member Functions

CORBA::ULong max_slots () const
void internal_set_length (CORBA::ULong len)
void set_loaner (OpenDDS::DCPS::DataReaderImpl *loaner)
void assign_ptr (CORBA::ULong ii, OpenDDS::DCPS::ReceivedDataElement *item)
OpenDDS::DCPS::ReceivedDataElementget_ptr (CORBA::ULong ii) const
void assign_sample (CORBA::ULong ii, const Sample_T &sample)
bool is_zero_copy () const
void make_single_copy (CORBA::ULong maximum)

Private Attributes

OpenDDS::DCPS::DataReaderImplloaner_
 The loaner that loaned its samples.
OpenDDS::DCPS::FirstTimeFastAllocator
< OpenDDS::DCPS::ReceivedDataElement
*, DEF_MAX > 
default_allocator_
 the default allocator
Ptr_Seq_Type ptrs_
 array of pointers if the sequence is supporting zero-copy reads
CORBA::ULong sc_maximum_
CORBA::ULong sc_length_
Sample_T * sc_buffer_
CORBA::Boolean sc_release_

Static Private Attributes

static Sample_T default_

Friends

class PrivateMemberAccess

Detailed Description

template<class Sample_T, size_t DEF_MAX = DCPS_ZERO_COPY_SEQ_DEFAULT_SIZE>
class TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >

Provides [] operators returning sample references but it is implemented as an "array" of pointers to the samples so they can be "loaned" to the application code.

Design Goals:

Definition at line 55 of file ZeroCopySeq_T.h.


Member Typedef Documentation

template<class Sample_T, size_t DEF_MAX = DCPS_ZERO_COPY_SEQ_DEFAULT_SIZE>
typedef ZeroCopyVector TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::Ptr_Seq_Type [private]

Definition at line 202 of file ZeroCopySeq_T.h.

template<class Sample_T, size_t DEF_MAX = DCPS_ZERO_COPY_SEQ_DEFAULT_SIZE>
typedef Sample_T TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::value_type

Definition at line 58 of file ZeroCopySeq_T.h.


Constructor & Destructor Documentation

template<class Sample_T , size_t DEF_MAX>
ACE_INLINE TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::ZeroCopyDataSeq ( CORBA::ULong  maximum = 0,
CORBA::ULong  init_size = DEF_MAX,
ACE_Allocator alloc = 0 
) [inline, explicit]

Construct a sequence of sample data values that supports zero-copy reads.

Parameters:
maximum Maximum number of samples to insert into the sequence. If == 0 then use zero-copy reading. Defaults to zero hence supporting zero-copy reads/takes.
init_size Initial size of the underlying array of pointers.
alloc The allocator used to allocate the array of pointers to samples. If zero then use the default allocator.

This constructor also serves as the "maximum" ctor and default ctor in the CORBA spec.

Definition at line 43 of file ZeroCopySeq_T.inl.

00047   : loaner_(0)
00048   , ptrs_((maximum == 0) ? init_size : 0
00049             , alloc ? alloc : &default_allocator_)
00050   , sc_maximum_(maximum)
00051   , sc_length_(0)
00052   , sc_buffer_(sc_maximum_ ? allocbuf(sc_maximum_) : 0)
00053   , sc_release_(sc_maximum_)
00054 {
00055 }

template<class Sample_T , size_t DEF_MAX>
ACE_INLINE TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::ZeroCopyDataSeq ( CORBA::ULong  maximum,
CORBA::ULong  length,
Sample_T *  buffer,
CORBA::Boolean  release = false 
) [inline]

Definition at line 58 of file ZeroCopySeq_T.inl.

00063   : loaner_(0)
00064   , ptrs_(0)
00065   , sc_maximum_(maximum)
00066   , sc_length_(length)
00067   , sc_buffer_(buffer)
00068   , sc_release_(release)
00069 {
00070 }

template<class Sample_T , size_t DEF_MAX>
TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::ZeroCopyDataSeq ( const ZeroCopyDataSeq< Sample_T, DEF_MAX > &  frm  )  [inline]

Definition at line 30 of file ZeroCopySeq_T.cpp.

References TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::is_zero_copy(), TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::ptrs_, TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::sc_buffer_, TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::sc_length_, ACE_Vector< T, DEFAULT_SIZE >::size(), and size.

00032   : loaner_(frm.loaner_)
00033   , ptrs_(frm.ptrs_.size(),
00034             (frm.ptrs_.allocator_ ==
00035              static_cast<const ACE_Allocator*>(&frm.default_allocator_))
00036             ? &default_allocator_
00037             : const_cast<ACE_Allocator*>(frm.ptrs_.allocator_))
00038     //The constructor of ptrs_ requires a non-const ptr to ACE_Alloc.
00039   , sc_maximum_(frm.sc_maximum_)
00040   , sc_length_(0) //initialized below
00041   , sc_buffer_(frm.sc_maximum_ ? allocbuf(frm.sc_maximum_) : 0)
00042   , sc_release_(frm.sc_maximum_)
00043 {
00044   if (frm.is_zero_copy()) {
00045     ptrs_ = frm.ptrs_;
00046 
00047     //ptrs_ doesn't manage the ref count for its elements
00048     for (size_t ii = 0; ii < frm.ptrs_.size(); ++ii) {
00049       ptrs_[ii]->inc_ref();
00050       ++ptrs_[ii]->zero_copy_cnt_;
00051     }
00052 
00053   } else {
00054     for (CORBA::ULong i = 0; i < frm.sc_length_; ++i) {
00055       sc_buffer_[i] = frm.sc_buffer_[i];
00056       ++sc_length_;
00057     }
00058   }
00059 }

Here is the call graph for this function:

template<class Sample_T , size_t DEF_MAX>
ACE_INLINE TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::~ZeroCopyDataSeq (  )  [inline]

Member Function Documentation

template<class Sample_T , size_t DEF_MAX>
ACE_INLINE Sample_T * TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::allocbuf ( CORBA::ULong  nelems  )  [inline, static]

Definition at line 236 of file ZeroCopySeq_T.inl.

Referenced by TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::get_buffer().

00237 {
00238   return new Sample_T[nelems];
00239 }

Here is the caller graph for this function:

template<class Sample_T , size_t DEF_MAX>
ACE_INLINE void TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::assign_ptr ( CORBA::ULong  ii,
OpenDDS::DCPS::ReceivedDataElement item 
) [inline, private]

Definition at line 274 of file ZeroCopySeq_T.inl.

References OpenDDS::DCPS::ReceivedDataElement::inc_ref(), TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::is_zero_copy(), TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::ptrs_, and OpenDDS::DCPS::ReceivedDataElement::zero_copy_cnt_.

Referenced by TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::PrivateMemberAccess::assign_ptr().

00277 {
00278   ACE_ASSERT(is_zero_copy());
00279   if (ptrs_[ii])
00280     ptrs_[ii]->dec_ref();
00281 
00282   item->inc_ref();
00283   ++item->zero_copy_cnt_;
00284   ptrs_[ii] = item;
00285 }

Here is the call graph for this function:

Here is the caller graph for this function:

template<class Sample_T , size_t DEF_MAX>
ACE_INLINE void TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::assign_sample ( CORBA::ULong  ii,
const Sample_T &  sample 
) [inline, private]

Definition at line 297 of file ZeroCopySeq_T.inl.

References TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::is_zero_copy(), and TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::sc_buffer_.

Referenced by TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::PrivateMemberAccess::assign_sample().

00299 {
00300   ACE_ASSERT(!is_zero_copy());
00301   sc_buffer_[ii] = sample;
00302 }

Here is the call graph for this function:

Here is the caller graph for this function:

template<class Sample_T , size_t DEF_MAX>
ACE_INLINE void TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::freebuf ( Sample_T *  buffer  )  [inline, static]

Definition at line 244 of file ZeroCopySeq_T.inl.

Referenced by TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::~ZeroCopyDataSeq().

00245 {
00246   delete[] buffer;
00247 }

Here is the caller graph for this function:

template<class Sample_T , size_t DEF_MAX>
ACE_INLINE const Sample_T * TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::get_buffer (  )  const [inline]

Definition at line 217 of file ZeroCopySeq_T.inl.

References TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::allocbuf(), TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::is_zero_copy(), TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::make_single_copy(), TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::max_slots(), TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::sc_buffer_, TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::sc_maximum_, and TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::sc_release_.

00218 {
00219   //If we're currently zero-copy we must become single copy in order to return
00220   //a contiguous buffer.  The only way to do this and meet the CORBA/C++ spec
00221   //interface is to cast-away the constness.
00222   if (is_zero_copy())
00223     const_cast<ZeroCopyDataSeq*>(this)->make_single_copy(max_slots());
00224 
00225   if (!sc_buffer_) {
00226     sc_buffer_ = allocbuf(sc_maximum_);
00227     sc_release_ = true;
00228   }
00229 
00230   return sc_buffer_;
00231 }

Here is the call graph for this function:

template<class Sample_T , size_t DEF_MAX>
Sample_T * TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::get_buffer ( CORBA::Boolean  orphan = false  )  [inline]

Definition at line 126 of file ZeroCopySeq_T.cpp.

References TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::allocbuf(), TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::is_zero_copy(), TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::make_single_copy(), TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::max_slots(), TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::sc_buffer_, TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::sc_maximum_, TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::sc_release_, and TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::swap().

00128 {
00129   //Case 1: I can't give away what's not mine
00130   //  (includes zero-copy since sc_release_ is always false for zero-copy
00131   if (orphan && !sc_release_) return 0;
00132 
00133   // (preparation for cases 2-3)
00134   if (is_zero_copy()) make_single_copy(max_slots());
00135 
00136   if (!sc_buffer_) {
00137     sc_buffer_ = allocbuf(sc_maximum_);
00138 
00139     if (!orphan) sc_release_ = true;
00140   }
00141 
00142   //Case 2: Keeping the buffer but letting client use it too
00143   if (!orphan) return sc_buffer_;
00144 
00145   //Case 3: Orphaning the buffer to the client, leaves "this" in the
00146   //  default-constructed state (which in our case is ZC-enabled)
00147   ZeroCopyDataSeq<Sample_T, DEF_MAX> yours;
00148   swap(yours);
00149   yours.sc_release_ = false; //don't freebuf in dtor
00150   return yours.sc_buffer_;
00151 }

Here is the call graph for this function:

template<class Sample_T , size_t DEF_MAX>
ACE_INLINE OpenDDS::DCPS::ReceivedDataElement * TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::get_ptr ( CORBA::ULong  ii  )  const [inline, private]

Definition at line 289 of file ZeroCopySeq_T.inl.

References TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::is_zero_copy(), and TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::ptrs_.

Referenced by TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::PrivateMemberAccess::get_ptr().

00290 {
00291   ACE_ASSERT(is_zero_copy());
00292   return ptrs_[ii];
00293 }

Here is the call graph for this function:

Here is the caller graph for this function:

template<class Sample_T , size_t DEF_MAX>
void TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::increment_references ( void   )  [inline]

Definition at line 159 of file ZeroCopySeq_T.cpp.

References TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::is_zero_copy(), TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::ptrs_, and ACE_Vector< T, DEFAULT_SIZE >::size().

00159                                                             {
00160   if (is_zero_copy()) {
00161     for (size_t ii = 0; ii < ptrs_.size(); ++ii) {
00162       ptrs_[ii]->inc_ref();
00163     }
00164   }
00165 }

Here is the call graph for this function:

template<class Sample_T , size_t DEF_MAX>
ACE_INLINE void TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::internal_set_length ( CORBA::ULong  len  )  [inline, private]

Definition at line 251 of file ZeroCopySeq_T.inl.

References TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::is_zero_copy(), TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::length(), TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::ptrs_, ACE_Vector< T, DEFAULT_SIZE >::resize(), and ACE_Vector< T, DEFAULT_SIZE >::size().

Referenced by TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::PrivateMemberAccess::internal_set_length().

00252 {
00253   if (!is_zero_copy() || len < ptrs_.size()) {
00254     length(len);
00255 
00256   } else if (len > ptrs_.size()) {
00257     //We need the vector to grow efficiently (not reallocate on each call)...
00258     ptrs_.resize((std::max)(len, CORBA::ULong(ptrs_.size()) * 2), 0);
00259     //...but maintain the invariant that the size of ptrs_ is our length
00260     ptrs_.resize(len, 0);
00261   }
00262 }

Here is the call graph for this function:

Here is the caller graph for this function:

template<class Sample_T , size_t DEF_MAX>
ACE_INLINE bool TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::is_zero_copy (  )  const [inline, private]
template<class Sample_T , size_t DEF_MAX>
ACE_INLINE CORBA::ULong TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::length ( void   )  const [inline]
template<class Sample_T , size_t DEF_MAX>
void TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::length ( CORBA::ULong  length  )  [inline]

Performance note: increasing the length of a zero-copy sequence past its current length may cause a copy (the sequence will no longer be zero-copy enabled).

Definition at line 66 of file ZeroCopySeq_T.cpp.

References copy(), TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::is_zero_copy(), TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::length(), TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::loaner_, TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::make_single_copy(), TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::ptrs_, ACE_Vector< T, DEFAULT_SIZE >::resize(), TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::sc_buffer_, TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::sc_length_, TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::sc_maximum_, TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::set_loaner(), ACE_Vector< T, DEFAULT_SIZE >::size(), and TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::swap().

Referenced by TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::make_single_copy().

00067 {
00068   using std::fill;
00069   using std::max;
00070   using std::copy;
00071 
00072   if (length == this->length()) {
00073     return;
00074   }
00075 
00076   if (is_zero_copy()) {
00077     if (length < ptrs_.size()) {
00078       if (!loaner_) {
00079         make_single_copy(length);
00080         this->length(length);
00081         return;
00082       }
00083 
00084       for (size_t i(length); i < ptrs_.size(); ++i) {
00085         --ptrs_[i]->zero_copy_cnt_;
00086         ptrs_[i]->dec_ref();
00087       }
00088 
00089       ptrs_.resize(length, 0);
00090       // At this point, there is no longer a loan
00091       this->set_loaner(0);
00092 
00093     } else {
00094       //There's no way we can expand the size (logical) of the zero-copy
00095       //array and have the user do any meaningful operations on the new
00096       //elements.  The fact that they're pointers to ReceivedDataElement
00097       //is hidden from the user.  Thus we need to make the sequence
00098       //single-copy at this point.
00099       make_single_copy(length);
00100       sc_length_ = length;
00101     }
00102 
00103   } else {
00104     if (length < sc_length_) { //shrink
00105       sc_length_ = length;
00106 
00107     } else if (length <= sc_maximum_) { //grow within buffer
00108       fill(&sc_buffer_[sc_length_], &sc_buffer_[length], Sample_T());
00109       sc_length_ = length;
00110 
00111     } else { //grow to larger buffer
00112       ZeroCopyDataSeq<Sample_T, DEF_MAX> grow(max(length, sc_maximum_*2));
00113       copy(sc_buffer_, &sc_buffer_[sc_length_], grow.sc_buffer_);
00114       fill(&grow.sc_buffer_[sc_length_], &grow.sc_buffer_[length],
00115            Sample_T());
00116       swap(grow);
00117     }
00118   }
00119 }

Here is the call graph for this function:

Here is the caller graph for this function:

template<class Sample_T , size_t DEF_MAX>
ACE_INLINE void TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::make_single_copy ( CORBA::ULong  maximum  )  [inline, private]

Definition at line 202 of file ZeroCopySeq_T.inl.

References TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::length(), TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::ptrs_, ACE_Vector< T, DEFAULT_SIZE >::size(), and TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::swap().

Referenced by TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::get_buffer(), and TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::length().

00203 {
00204   CORBA::ULong currentSize(static_cast<CORBA::ULong>(ptrs_.size()));
00205   ZeroCopyDataSeq<Sample_T, DEF_MAX> sc((std::max)(maximum, currentSize));
00206   sc.length(currentSize);
00207 
00208   for (CORBA::ULong i(0); i < ptrs_.size(); ++i) {
00209     sc[i] = (*this)[i];
00210   }
00211 
00212   swap(sc);
00213 }

Here is the call graph for this function:

Here is the caller graph for this function:

template<class Sample_T , size_t DEF_MAX>
ACE_INLINE CORBA::ULong TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::max_slots (  )  const [inline, private]

Current allocated number of sample slots.

Note:
The DDS specification's use of maximum=0 to designate zero-copy read request requires some way of knowing the internally allocated slots for sample pointers that is not "maximum".

Definition at line 138 of file ZeroCopySeq_T.inl.

References TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::is_zero_copy(), ACE_Array_Base< T >::max_size(), TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::ptrs_, and TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::sc_maximum_.

Referenced by TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::get_buffer(), and TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::PrivateMemberAccess::max_slots().

00139 {
00140   return is_zero_copy() ? static_cast<CORBA::ULong>(ptrs_.max_size())
00141     : sc_maximum_;
00142 }

Here is the call graph for this function:

Here is the caller graph for this function:

template<class Sample_T , size_t DEF_MAX>
ACE_INLINE CORBA::ULong TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::maximum (  )  const [inline]

Definition at line 131 of file ZeroCopySeq_T.inl.

References TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::sc_maximum_.

00132 {
00133   return sc_maximum_;
00134 }

template<class Sample_T , size_t DEF_MAX>
ACE_INLINE ZeroCopyDataSeq< Sample_T, DEF_MAX > & TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::operator= ( const ZeroCopyDataSeq< Sample_T, DEF_MAX > &  frm  )  [inline]

Definition at line 74 of file ZeroCopySeq_T.inl.

References TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::swap().

00076 {
00077   if (this != &frm) {
00078     ZeroCopyDataSeq<Sample_T, DEF_MAX> temp(frm);
00079     swap(temp);
00080   }
00081 
00082   return *this;
00083 }

Here is the call graph for this function:

template<class Sample_T , size_t DEF_MAX>
ACE_INLINE Sample_T & TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::operator[] ( CORBA::ULong  i  )  [inline]

Definition at line 168 of file ZeroCopySeq_T.inl.

References TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::default_, TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::is_zero_copy(), TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::ptrs_, and TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::sc_buffer_.

00169 {
00170   if (is_zero_copy()) {
00171     if (ptrs_[i]->registered_data_) {
00172       return *static_cast<Sample_T*>(ptrs_[i]->registered_data_);
00173     }
00174     return default_;
00175 
00176   } else {
00177     return sc_buffer_[i];
00178   }
00179 }

Here is the call graph for this function:

template<class Sample_T , size_t DEF_MAX>
ACE_INLINE const Sample_T & TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::operator[] ( CORBA::ULong  i  )  const [inline]

Definition at line 153 of file ZeroCopySeq_T.inl.

References TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::default_, TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::is_zero_copy(), TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::ptrs_, and TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::sc_buffer_.

00154 {
00155   if (is_zero_copy()) {
00156     if (ptrs_[i]->registered_data_) {
00157       return *static_cast<const Sample_T*>(ptrs_[i]->registered_data_);
00158     }
00159     return default_;
00160 
00161   } else {
00162     return sc_buffer_[i];
00163   }
00164 }

Here is the call graph for this function:

template<class Sample_T , size_t DEF_MAX>
ACE_INLINE CORBA::Boolean TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::release ( void   )  const [inline]

Definition at line 183 of file ZeroCopySeq_T.inl.

References TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::sc_release_.

Referenced by TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::~ZeroCopyDataSeq().

00184 {
00185   return sc_release_; //will always be false in zero-copy mode
00186 }

Here is the caller graph for this function:

template<class Sample_T , size_t DEF_MAX>
ACE_INLINE void TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::replace ( CORBA::ULong  max,
CORBA::ULong  length,
Sample_T *  buffer,
CORBA::Boolean  release = false 
) [inline]

Definition at line 190 of file ZeroCopySeq_T.inl.

References TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::swap().

00195 {
00196   ZeroCopyDataSeq<Sample_T, DEF_MAX> newOne(maximum, length, buffer, release);
00197   swap(newOne);
00198 }

Here is the call graph for this function:

template<class Sample_T , size_t DEF_MAX>
ACE_INLINE void TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::set_loaner ( OpenDDS::DCPS::DataReaderImpl loaner  )  [inline, private]
template<class Sample_T , size_t DEF_MAX>
ACE_INLINE void TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::swap ( ZeroCopyDataSeq< Sample_T, DEF_MAX > &  frm  )  [inline]

Definition at line 87 of file ZeroCopySeq_T.inl.

References ACE_Array_Base< T >::allocator_, ACE_Array_Base< T >::array_, TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::default_allocator_, TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::loaner_, OpenDDS::DCPS::FirstTimeFastAllocator< T, N >::pool(), TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::ptrs_, TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::sc_buffer_, TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::sc_length_, TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::sc_maximum_, TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::sc_release_, and TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::ZeroCopyVector::swap().

Referenced by TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::get_buffer(), TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::length(), TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::make_single_copy(), TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::operator=(), and TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::replace().

00088 {
00089   bool thisUsedDefAlloc = ptrs_.allocator_ == &default_allocator_;
00090   bool thisUsedLocalBuffer = ptrs_.array_ == default_allocator_.pool();
00091   bool frmUsedDefAlloc = frm.ptrs_.allocator_ == &frm.default_allocator_;
00092   bool frmUsedLocalBuffer = frm.ptrs_.array_ == frm.default_allocator_.pool();
00093 
00094   std::swap(loaner_, frm.loaner_);
00095   std::swap(default_allocator_, frm.default_allocator_);
00096   ptrs_.swap(frm.ptrs_);
00097   std::swap(sc_maximum_, frm.sc_maximum_);
00098   std::swap(sc_length_, frm.sc_length_);
00099   std::swap(sc_buffer_, frm.sc_buffer_);
00100   std::swap(sc_release_, frm.sc_release_);
00101 
00102   if (thisUsedDefAlloc) frm.ptrs_.allocator_ = &frm.default_allocator_;
00103 
00104   if (thisUsedLocalBuffer) frm.ptrs_.array_ = frm.default_allocator_.pool();
00105 
00106   if (frmUsedDefAlloc) ptrs_.allocator_ = &default_allocator_;
00107 
00108   if (frmUsedLocalBuffer) ptrs_.array_ = default_allocator_.pool();
00109 }

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

template<class Sample_T, size_t DEF_MAX = DCPS_ZERO_COPY_SEQ_DEFAULT_SIZE>
friend class PrivateMemberAccess [friend]

Definition at line 148 of file ZeroCopySeq_T.h.


Member Data Documentation

template<class Sample_T, size_t DEF_MAX = DCPS_ZERO_COPY_SEQ_DEFAULT_SIZE>
Sample_T TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::default_ [inline, static, private]
template<class Sample_T, size_t DEF_MAX = DCPS_ZERO_COPY_SEQ_DEFAULT_SIZE>
OpenDDS::DCPS::FirstTimeFastAllocator<OpenDDS::DCPS::ReceivedDataElement*, DEF_MAX> TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::default_allocator_ [private]

the default allocator

Definition at line 200 of file ZeroCopySeq_T.h.

Referenced by TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::swap().

template<class Sample_T, size_t DEF_MAX = DCPS_ZERO_COPY_SEQ_DEFAULT_SIZE>
OpenDDS::DCPS::DataReaderImpl* TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::loaner_ [private]
template<class Sample_T, size_t DEF_MAX = DCPS_ZERO_COPY_SEQ_DEFAULT_SIZE>
Ptr_Seq_Type TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::ptrs_ [private]
template<class Sample_T, size_t DEF_MAX = DCPS_ZERO_COPY_SEQ_DEFAULT_SIZE>
Sample_T* TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::sc_buffer_ [mutable, private]
template<class Sample_T, size_t DEF_MAX = DCPS_ZERO_COPY_SEQ_DEFAULT_SIZE>
CORBA::ULong TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::sc_length_ [private]
template<class Sample_T, size_t DEF_MAX = DCPS_ZERO_COPY_SEQ_DEFAULT_SIZE>
CORBA::ULong TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::sc_maximum_ [private]
template<class Sample_T, size_t DEF_MAX = DCPS_ZERO_COPY_SEQ_DEFAULT_SIZE>
CORBA::Boolean TAO::DCPS::ZeroCopyDataSeq< Sample_T, DEF_MAX >::sc_release_ [mutable, private]

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

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1