Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

TAO_ObjectKey Class Reference

#include <Object_KeyC.h>

Inheritance diagram for TAO_ObjectKey:

Inheritance graph
[legend]
Collaboration diagram for TAO_ObjectKey:

Collaboration graph
[legend]
List of all members.

Public Types

typedef TAO_ObjectKey_var _var_type

Public Methods

 TAO_ObjectKey (void)
 TAO_ObjectKey (CORBA::ULong max)
 TAO_ObjectKey (CORBA::ULong max, CORBA::ULong length, CORBA::Octet *data, CORBA::Boolean release=0)
 TAO_ObjectKey (const TAO_ObjectKey &)
TAO_ObjectKey & operator= (const TAO_ObjectKey &)

Static Public Methods

void encode_sequence_to_string (char *&str, const TAO_Unbounded_Sequence< CORBA::Octet > &seq)
void decode_string_to_sequence (TAO_Unbounded_Sequence< CORBA::Octet > &seq, const char *str)

Member Typedef Documentation

typedef TAO_ObjectKey_var TAO_ObjectKey::_var_type
 

Definition at line 37 of file Object_KeyC.h.


Constructor & Destructor Documentation

ACE_INLINE TAO_ObjectKey::TAO_ObjectKey void   
 

Definition at line 15 of file Object_KeyC.i.

00016 {
00017 }

ACE_INLINE TAO_ObjectKey::TAO_ObjectKey CORBA::ULong    max
 

Definition at line 20 of file Object_KeyC.i.

References CORBA::Octet.

00021   :  TAO_Unbounded_Sequence<CORBA::Octet> (max)
00022 {
00023 }

ACE_INLINE TAO_ObjectKey::TAO_ObjectKey CORBA::ULong    max,
CORBA::ULong    length,
CORBA::Octet   data,
CORBA::Boolean    release = 0
 

Definition at line 26 of file Object_KeyC.i.

References CORBA::Octet.

00030   :  TAO_Unbounded_Sequence<CORBA::Octet> (max, length, data, release)
00031 {
00032 }

ACE_INLINE TAO_ObjectKey::TAO_ObjectKey const TAO_ObjectKey &   
 

Definition at line 35 of file Object_KeyC.i.

References CORBA::Octet.

00036   :  TAO_Unbounded_Sequence<CORBA::Octet> (rhs)
00037 {
00038 }


Member Function Documentation

void TAO_ObjectKey::decode_string_to_sequence TAO_Unbounded_Sequence< CORBA::Octet > &    seq,
const char *    str
[static]
 

Definition at line 93 of file Object_KeyC.cpp.

References ACE::hex2byte, TAO_Unbounded_Base_Sequence::length, and ACE_OS_String::strlen.

00095 {
00096   if (str == 0)
00097     {
00098       seq.length (0);
00099       return;
00100     }
00101 
00102   size_t length = ACE_OS::strlen (str);
00103   const char *eos = str + length;
00104   const char *cp = str;
00105 
00106   // Set the length of the sequence to be as long as
00107   // we'll possibly need...we'll reset it to the actual
00108   // length later.
00109   seq.length (ACE_static_cast(CORBA::ULong, length));
00110 
00111   CORBA::ULong i = 0;
00112   for (;
00113        cp < eos && i < seq.length ();
00114        i++)
00115     {
00116       if (*cp == '\\')
00117         {
00118           // This is an escaped non-printable,
00119           // so we decode the hex values into
00120           // the sequence's octet
00121           seq[i] = (u_char) (ACE::hex2byte (cp[1]) << 4);
00122           seq[i] |= (u_char) ACE::hex2byte (cp[2]);
00123           cp += 3;
00124         }
00125       else
00126         // Copy it in
00127         seq[i] = *cp++;
00128     }
00129 
00130   // Set the length appropriately
00131   seq.length (i);
00132 }

void TAO_ObjectKey::encode_sequence_to_string char *&    str,
const TAO_Unbounded_Sequence< CORBA::Octet > &    seq
[static]
 

Definition at line 53 of file Object_KeyC.cpp.

References TAO_Unbounded_Base_Sequence::length, ACE::nibble2hex, and CORBA::string_alloc.

Referenced by TAO_IIOP_Profile::to_string.

00055 {
00056   // We must allocate a buffer which is (gag) 3 times the length
00057   // of the sequence, which is the length required in the worst-case
00058   // scenario of all non-printable characters.
00059   //
00060   // There are two strategies here...we could allocate all that space here,
00061   // fill it up, then copy-allocate new space of just the right length.
00062   // OR, we could just return this space.  The classic time-space tradeoff,
00063   // and for now we'll let time win out, which means that we only do the
00064   // allocation once.
00065   u_int len = 3 * seq.length (); /* space for zero termination not needed */;
00066   str = CORBA::string_alloc (len);
00067 
00068   char *cp = str;
00069 
00070   for (u_int i = 0;
00071        cp < (cp + len) && i < seq.length();
00072        ++i)
00073     {
00074       // Some platforms define 'byte' as a macro, solve the problem
00075       // here.
00076 #undef byte
00077       u_char byte = seq[i];
00078       if (isprint (byte) && byte != '\\')
00079         {
00080           *cp++ = (char) byte;
00081           continue;
00082         }
00083 
00084       *cp++ = '\\';
00085       *cp++ = ACE::nibble2hex ((byte >> 4) & 0x0f);
00086       *cp++ = ACE::nibble2hex (byte & 0x0f);
00087     }
00088   // Zero terminate
00089   *cp = '\0';
00090 }

ACE_INLINE TAO_ObjectKey & TAO_ObjectKey::operator= const TAO_ObjectKey &   
 

Definition at line 41 of file Object_KeyC.i.

References TAO_Unbounded_Sequence::operator=.

00042 {
00043   if (this == &rhs)
00044     return *this;
00045 
00046   TAO_Unbounded_Sequence<CORBA::Octet>::operator= (rhs);
00047   return *this;
00048 }


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 15:29:44 2003 for TAO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002