Public Member Functions

TAO_Preserve_Original_Key_Adapter Class Reference

A key adapter (encode/decode) class. More...

#include <Key_Adapters.h>

List of all members.

Public Member Functions

int encode (const PortableServer::ObjectId &original_key, const ACE_Active_Map_Manager_Key &active_key, PortableServer::ObjectId &modified_key)
int decode (const PortableServer::ObjectId &modified_key, ACE_Active_Map_Manager_Key &active_key)
int decode (const PortableServer::ObjectId &modified_key, PortableServer::ObjectId &original_key)

Detailed Description

A key adapter (encode/decode) class.

Define the encoding and decoding methods for converting between Object Ids and active keys. This class remembers the <original_key> passed to it.

Definition at line 108 of file Key_Adapters.h.


Member Function Documentation

int TAO_Preserve_Original_Key_Adapter::decode ( const PortableServer::ObjectId modified_key,
ACE_Active_Map_Manager_Key active_key 
)

Definition at line 119 of file Key_Adapters.cpp.

{
  // Read off value of index and generation.
  active_key.decode (modified_key.get_buffer ());

  // Success.
  return 0;
}

int TAO_Preserve_Original_Key_Adapter::decode ( const PortableServer::ObjectId modified_key,
PortableServer::ObjectId original_key 
)

Definition at line 130 of file Key_Adapters.cpp.

{
  // Size of active key.
  size_t const active_key_size = ACE_Active_Map_Manager_Key::size ();

  // Smartly copy all the data; <original_key does not own the data>.
  original_key.replace (static_cast <CORBA::ULong>
                            (modified_key.maximum () - active_key_size),
                        static_cast <CORBA::ULong>
                            (modified_key.length () - active_key_size),
                        const_cast <CORBA::Octet *>
                            (modified_key.get_buffer ()) + active_key_size,
                        0);

  // Success.
  return 0;
}

int TAO_Preserve_Original_Key_Adapter::encode ( const PortableServer::ObjectId original_key,
const ACE_Active_Map_Manager_Key active_key,
PortableServer::ObjectId modified_key 
)

Definition at line 95 of file Key_Adapters.cpp.

{
  // Size of active key.
  size_t const active_key_size = active_key.size ();

  // Resize to accommodate both the original data and the new active key.
  modified_key.length (static_cast <CORBA::ULong> (active_key_size)
                         + original_key.length ());

  // Copy active key data into user key.
  active_key.encode (modified_key.get_buffer ());

  // Copy the original key after the active key.
  ACE_OS::memcpy (modified_key.get_buffer () + active_key_size,
                  original_key.get_buffer (),
                  original_key.length ());

  // Success.
  return 0;
}


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