ReceivedDataSample.inl

Go to the documentation of this file.
00001 /*
00002  *
00003  *
00004  * Distributed under the OpenDDS License.
00005  * See: http://www.opendds.org/license.html
00006  */
00007 
00008 #include "ace/Message_Block.h"
00009 #include "EntryExit.h"
00010 
00011 namespace OpenDDS {
00012 namespace DCPS {
00013 
00014 ACE_INLINE
00015 ReceivedDataSample::ReceivedDataSample(ACE_Message_Block* payload)
00016   : sample_(payload)
00017 {
00018   DBG_ENTRY_LVL("ReceivedDataSample", "ReceivedDataSample",6);
00019 }
00020 
00021 ACE_INLINE
00022 ReceivedDataSample::ReceivedDataSample(const ReceivedDataSample& other)
00023   : header_(other.header_)
00024   , sample_(ACE_Message_Block::duplicate(other.sample_))
00025 {
00026   DBG_ENTRY_LVL("ReceivedDataSample", "ReceivedDataSample(copy)", 6);
00027 }
00028 
00029 ACE_INLINE ReceivedDataSample&
00030 ReceivedDataSample::operator=(const ReceivedDataSample& other)
00031 {
00032   DBG_ENTRY_LVL("ReceivedDataSample", "operator=", 6);
00033   ReceivedDataSample cpy(other);
00034   swap(*this, cpy);
00035   return *this;
00036 }
00037 
00038 ACE_INLINE
00039 ReceivedDataSample::~ReceivedDataSample()
00040 {
00041   DBG_ENTRY_LVL("ReceivedDataSample", "~ReceivedDataSample", 6);
00042 
00043   // Release the sample_ (ACE_Message_Block chain) back to its allocator.
00044   if (this->sample_ != 0) {
00045     this->sample_->release();
00046   }
00047 }
00048 
00049 ACE_INLINE void
00050 swap(ReceivedDataSample& a, ReceivedDataSample& b)
00051 {
00052   std::swap(a.header_, b.header_);
00053   std::swap(a.sample_, b.sample_);
00054 }
00055 
00056 }
00057 }

Generated on Fri Feb 12 20:05:25 2016 for OpenDDS by  doxygen 1.4.7