Wrapper for the ACE_CString to facilitate saving the string persistently. More...
#include <PSDL_String.h>
Public Member Functions | |
TAO_PSDL_String (void) | |
Constructor. | |
TAO_PSDL_String (ACE_Allocator *persistent_allocator) | |
Constructor. | |
TAO_PSDL_String (const TAO_PSDL_String &rhs) | |
Copy constructor. | |
~TAO_PSDL_String (void) | |
Destructor. | |
void | operator= (const TAO_PSDL_String &rhs) |
Assignment operator. | |
void | operator= (const ACE_CString &rhs) |
bool | operator== (const TAO_PSDL_String &rhs) const |
Equality comparison operator. | |
bool | operator!= (const TAO_PSDL_String &rhs) const |
Inequality comparison operator. | |
u_long | hash (void) const |
Returns a hash value for this string. | |
operator ACE_CString * () const | |
operator ACE_CString * () | |
Public Attributes | |
ACE_Allocator * | allocator_ |
const char * | buffer_ |
CORBA::ULong | length_ |
Wrapper for the ACE_CString to facilitate saving the string persistently.
Definition at line 36 of file PSDL_String.h.
TAO_PSDL_String::TAO_PSDL_String | ( | void | ) |
Constructor.
Definition at line 11 of file PSDL_String.cpp.
: allocator_ (0), buffer_ (0), length_ (0) { }
TAO_PSDL_String::TAO_PSDL_String | ( | ACE_Allocator * | persistent_allocator | ) |
Constructor.
Definition at line 19 of file PSDL_String.cpp.
: allocator_ (persistent_allocator), buffer_ (0), length_ (0) { }
TAO_PSDL_String::TAO_PSDL_String | ( | const TAO_PSDL_String & | rhs | ) |
TAO_PSDL_String::~TAO_PSDL_String | ( | void | ) |
Destructor.
Definition at line 27 of file PSDL_String.cpp.
{ if (this->buffer_ != 0) this->allocator_->free ((void *) this->buffer_); }
u_long TAO_PSDL_String::hash | ( | void | ) | const |
Returns a hash value for this string.
Definition at line 110 of file PSDL_String.cpp.
{ return ACE::hash_pjw (this->buffer_); }
TAO_PSDL_String::operator ACE_CString * | ( | ) |
Definition at line 129 of file PSDL_String.cpp.
{ ACE_CString *str = 0; char * dest = str->rep (); const char * src = this->buffer_; ACE_OS::memcpy (dest, src, this->length_); return str; }
TAO_PSDL_String::operator ACE_CString * | ( | ) | const |
Definition at line 117 of file PSDL_String.cpp.
{ ACE_CString *str = 0; char * dest = str->rep (); const char * src = this->buffer_; ACE_OS::memcpy (dest, src, this->length_); return str; }
bool TAO_PSDL_String::operator!= | ( | const TAO_PSDL_String & | rhs | ) | const |
Inequality comparison operator.
Definition at line 104 of file PSDL_String.cpp.
{ return (ACE_OS::strcmp (buffer_, rhs.buffer_) != 0); }
void TAO_PSDL_String::operator= | ( | const ACE_CString & | rhs | ) |
Definition at line 68 of file PSDL_String.cpp.
{ // Free the existing buffer before assigning octet // sequence. if (this->buffer_ != 0) this->allocator_->free ((void *) this->buffer_); const CORBA::ULong len = rhs.length (); void * buf = this->allocator_->malloc (len); this->buffer_ = (const char *) buf; if (this->buffer_) { const char * dest = this->buffer_; const char * src = rhs.rep (); // Deep copy the buffer. ACE_OS::memcpy ((void *)dest, src, len); this->length_ = len; } else this->length_ = 0; }
void TAO_PSDL_String::operator= | ( | const TAO_PSDL_String & | rhs | ) |
Assignment operator.
Definition at line 41 of file PSDL_String.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 ((void *) this->buffer_); this->allocator_ = rhs.allocator_; void * buf = this->allocator_->malloc (rhs.length_); this->buffer_ = (const char *) buf; if (this->buffer_) { // Deep copy the buffer. ACE_OS::memcpy ( (void *) this->buffer_, rhs.buffer_, rhs.length_); this->length_ = rhs.length_; } else this->length_ = 0; }
bool TAO_PSDL_String::operator== | ( | const TAO_PSDL_String & | rhs | ) | const |
Equality comparison operator.
Definition at line 98 of file PSDL_String.cpp.
{ return (ACE_OS::strcmp (buffer_, rhs.buffer_) == 0); }
Definition at line 74 of file PSDL_String.h.
const char* TAO_PSDL_String::buffer_ |
Definition at line 77 of file PSDL_String.h.
Definition at line 80 of file PSDL_String.h.