TAO_PSDL_OctetSeq Class Reference

This class facilitates implementation of Persistent Service. Helps perform the bind and find to the hash_map and to make the data persistent. More...

#include <PSDL_OctetSeq.h>

Collaboration diagram for TAO_PSDL_OctetSeq:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_PSDL_OctetSeq (void)
 Constructor.

 TAO_PSDL_OctetSeq (ACE_Allocator *persistent_allocator)
 Constructor.

 TAO_PSDL_OctetSeq (const TAO_PSDL_OctetSeq &rhs)
 Copy constructor.

 ~TAO_PSDL_OctetSeq (void)
 Destructor.

void operator= (const TAO_PSDL_OctetSeq &rhs)
 Assignment operator.

void operator= (const CORBA::OctetSeq &rhs)
 operator CORBA::OctetSeq * () const
 operator CORBA::OctetSeq * ()

Public Attributes

ACE_Allocatorallocator_
CORBA::Octetbuffer_
CORBA::ULong length_

Detailed Description

This class facilitates implementation of Persistent Service. Helps perform the bind and find to the hash_map and to make the data persistent.

Definition at line 38 of file PSDL_OctetSeq.h.


Constructor & Destructor Documentation

TAO_PSDL_OctetSeq::TAO_PSDL_OctetSeq void   ) 
 

Constructor.

Definition at line 10 of file PSDL_OctetSeq.cpp.

00011   : allocator_ (0),
00012     buffer_ (0),
00013     length_ (0)
00014 {
00015 }

TAO_PSDL_OctetSeq::TAO_PSDL_OctetSeq ACE_Allocator persistent_allocator  ) 
 

Constructor.

Definition at line 18 of file PSDL_OctetSeq.cpp.

00019   : allocator_ (persistent_allocator),
00020     buffer_ (0),
00021     length_ (0)
00022 {
00023 }

TAO_PSDL_OctetSeq::TAO_PSDL_OctetSeq const TAO_PSDL_OctetSeq rhs  ) 
 

Copy constructor.

Definition at line 33 of file PSDL_OctetSeq.cpp.

00034 {
00035   *this = rhs;
00036 }

TAO_PSDL_OctetSeq::~TAO_PSDL_OctetSeq void   ) 
 

Destructor.

Definition at line 26 of file PSDL_OctetSeq.cpp.

References ACE_Allocator::free().

00027 {
00028   if (this->buffer_ != 0)
00029     this->allocator_->free (this->buffer_);
00030 }


Member Function Documentation

TAO_PSDL_OctetSeq::operator CORBA::OctetSeq *  ) 
 

Definition at line 109 of file PSDL_OctetSeq.cpp.

References ACE_NEW_RETURN, TAO::unbounded_value_sequence< T >::length(), and ACE_OS::memcpy().

00110 {
00111   CORBA::OctetSeq * tmp;
00112   ACE_NEW_RETURN (tmp,
00113                   CORBA::OctetSeq (this->length_),
00114                   0);
00115   CORBA::OctetSeq_var seq = tmp;
00116 
00117   seq->length (this->length_);
00118 
00119   CORBA::Octet * dest = seq->get_buffer ();
00120   const CORBA::Octet * src = this->buffer_;
00121   ACE_OS::memcpy (dest, src, this->length_);
00122 
00123   return seq._retn ();
00124 }

TAO_PSDL_OctetSeq::operator CORBA::OctetSeq *  )  const
 

Definition at line 92 of file PSDL_OctetSeq.cpp.

References ACE_NEW_RETURN, TAO::unbounded_value_sequence< T >::length(), and ACE_OS::memcpy().

00093 {
00094   CORBA::OctetSeq * tmp;
00095   ACE_NEW_RETURN (tmp,
00096                   CORBA::OctetSeq (this->length_),
00097                   0);
00098   CORBA::OctetSeq_var seq = tmp;
00099 
00100   seq->length (this->length_);
00101 
00102   CORBA::Octet * dest = seq->get_buffer ();
00103   const CORBA::Octet * src = this->buffer_;
00104   ACE_OS::memcpy (dest, src, this->length_);
00105 
00106   return seq._retn ();
00107 }

void TAO_PSDL_OctetSeq::operator= const CORBA::OctetSeq rhs  ) 
 

Definition at line 65 of file PSDL_OctetSeq.cpp.

References ACE_Allocator::free(), TAO::unbounded_value_sequence< T >::get_buffer(), TAO::unbounded_value_sequence< T >::length(), ACE_Allocator::malloc(), and ACE_OS::memcpy().

00066 {
00067   // Free the existing buffer before assigning octet
00068   // sequence.
00069   if (this->buffer_ != 0)
00070     this->allocator_->free (this->buffer_);
00071 
00072   const CORBA::ULong len = rhs.length ();
00073 
00074   void * buf = this->allocator_->malloc (len);
00075   this->buffer_ = static_cast<CORBA::Octet *> (buf);
00076   if (this->buffer_)
00077     {
00078       CORBA::Octet * dest = this->buffer_;
00079       const CORBA::Octet * src = rhs.get_buffer ();
00080 
00081       // Deep copy the buffer.
00082       ACE_OS::memcpy (dest, src, len);
00083 
00084       this->length_ = len;
00085     }
00086   else
00087     this->length_ = 0;
00088 }

void TAO_PSDL_OctetSeq::operator= const TAO_PSDL_OctetSeq rhs  ) 
 

Assignment operator.

Definition at line 40 of file PSDL_OctetSeq.cpp.

References allocator_, buffer_, ACE_Allocator::free(), length_, ACE_Allocator::malloc(), and ACE_OS::memcpy().

00041 {
00042   if (this == &rhs)  // Prevent self assignment
00043     return;
00044 
00045   // Free the existing buffer before assigning a new
00046   // allocator and buffer.
00047   if (this->buffer_ != 0)
00048     this->allocator_->free (this->buffer_);
00049 
00050   this->allocator_ = rhs.allocator_;
00051   void * buf = this->allocator_->malloc (rhs.length_);
00052   this->buffer_ = static_cast<CORBA::Octet *> (buf);
00053   if (this->buffer_)
00054     {
00055       // Deep copy the buffer.
00056       ACE_OS::memcpy (this->buffer_, rhs.buffer_, rhs.length_);
00057 
00058       this->length_ = rhs.length_;
00059     }
00060   else
00061     this->length_ = 0;
00062 }


Member Data Documentation

ACE_Allocator* TAO_PSDL_OctetSeq::allocator_
 

Definition at line 67 of file PSDL_OctetSeq.h.

Referenced by TAO_PSDL_Datastore::bind(), TAO_PSDL_Datastore::find(), and operator=().

CORBA::Octet* TAO_PSDL_OctetSeq::buffer_
 

Definition at line 70 of file PSDL_OctetSeq.h.

Referenced by TAO_PSDL_Datastore::find(), and operator=().

CORBA::ULong TAO_PSDL_OctetSeq::length_
 

Definition at line 73 of file PSDL_OctetSeq.h.

Referenced by TAO_PSDL_Datastore::find(), and operator=().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 14:09:33 2006 for TAO_PSS by doxygen 1.3.6