Public Member Functions | Public Attributes

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.

  : allocator_ (0),
    buffer_ (0),
    length_ (0)
{
}

TAO_PSDL_OctetSeq::TAO_PSDL_OctetSeq ( ACE_Allocator persistent_allocator  ) 

Constructor.

Definition at line 18 of file PSDL_OctetSeq.cpp.

  : allocator_ (persistent_allocator),
    buffer_ (0),
    length_ (0)
{
}

TAO_PSDL_OctetSeq::TAO_PSDL_OctetSeq ( const TAO_PSDL_OctetSeq rhs  ) 

Copy constructor.

Definition at line 33 of file PSDL_OctetSeq.cpp.

{
  *this = rhs;
}

TAO_PSDL_OctetSeq::~TAO_PSDL_OctetSeq ( void   ) 

Destructor.

Definition at line 26 of file PSDL_OctetSeq.cpp.

{
  if (this->buffer_ != 0)
    this->allocator_->free (this->buffer_);
}


Member Function Documentation

TAO_PSDL_OctetSeq::operator CORBA::OctetSeq * (  )  const

Definition at line 92 of file PSDL_OctetSeq.cpp.

{
  CORBA::OctetSeq * tmp;
  ACE_NEW_RETURN (tmp,
                  CORBA::OctetSeq (this->length_),
                  0);
  CORBA::OctetSeq_var seq = tmp;

  seq->length (this->length_);

  CORBA::Octet * dest = seq->get_buffer ();
  const CORBA::Octet * src = this->buffer_;
  ACE_OS::memcpy (dest, src, this->length_);

  return seq._retn ();
}

TAO_PSDL_OctetSeq::operator CORBA::OctetSeq * (  ) 

Definition at line 109 of file PSDL_OctetSeq.cpp.

{
  CORBA::OctetSeq * tmp;
  ACE_NEW_RETURN (tmp,
                  CORBA::OctetSeq (this->length_),
                  0);
  CORBA::OctetSeq_var seq = tmp;

  seq->length (this->length_);

  CORBA::Octet * dest = seq->get_buffer ();
  const CORBA::Octet * src = this->buffer_;
  ACE_OS::memcpy (dest, src, this->length_);

  return seq._retn ();
}

void TAO_PSDL_OctetSeq::operator= ( const TAO_PSDL_OctetSeq rhs  ) 

Assignment operator.

Definition at line 40 of file PSDL_OctetSeq.cpp.

{
  if (this == &rhs)  // Prevent self assignment
    return;

  // Free the existing buffer before assigning a new
  // allocator and buffer.
  if (this->buffer_ != 0)
    this->allocator_->free (this->buffer_);

  this->allocator_ = rhs.allocator_;
  void * buf = this->allocator_->malloc (rhs.length_);
  this->buffer_ = static_cast<CORBA::Octet *> (buf);
  if (this->buffer_)
    {
      // Deep copy the buffer.
      ACE_OS::memcpy (this->buffer_, rhs.buffer_, rhs.length_);

      this->length_ = rhs.length_;
    }
  else
    this->length_ = 0;
}

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

Definition at line 65 of file PSDL_OctetSeq.cpp.

{
  // Free the existing buffer before assigning octet
  // sequence.
  if (this->buffer_ != 0)
    this->allocator_->free (this->buffer_);

  const CORBA::ULong len = rhs.length ();

  void * buf = this->allocator_->malloc (len);
  this->buffer_ = static_cast<CORBA::Octet *> (buf);
  if (this->buffer_)
    {
      CORBA::Octet * dest = this->buffer_;
      const CORBA::Octet * src = rhs.get_buffer ();

      // Deep copy the buffer.
      ACE_OS::memcpy (dest, src, len);

      this->length_ = len;
    }
  else
    this->length_ = 0;
}


Member Data Documentation

Definition at line 67 of file PSDL_OctetSeq.h.

Definition at line 70 of file PSDL_OctetSeq.h.

Definition at line 73 of file PSDL_OctetSeq.h.


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