CDR-based Any impl class. More...
#include <Any_Unknown_IDL_Type.h>
Public Member Functions | |
Unknown_IDL_Type (CORBA::TypeCode_ptr, TAO_InputCDR &cdr) | |
Unknown_IDL_Type (CORBA::TypeCode_ptr) | |
virtual | ~Unknown_IDL_Type (void) |
virtual CORBA::Boolean | marshal_value (TAO_OutputCDR &) |
virtual const void * | value (void) const |
virtual void | free_value (void) |
virtual TAO_InputCDR & | _tao_get_cdr (void) |
virtual int | _tao_byte_order (void) const |
virtual void | _tao_decode (TAO_InputCDR &) |
virtual CORBA::Boolean | to_object (CORBA::Object_ptr &) const |
virtual CORBA::Boolean | to_value (CORBA::ValueBase *&) const |
virtual CORBA::Boolean | to_abstract_base (CORBA::AbstractBase_ptr &) const |
Private Types | |
typedef ACE_Refcounted_Auto_Ptr < ACE_Lock, ACE_Lock_Adapter < TAO_SYNCH_MUTEX > > | LOCK |
Static Private Member Functions | |
static LOCK const | lock_i (void) |
Private Attributes | |
LOCK const | lock_ |
TAO_InputCDR | cdr_ |
CDR-based Any impl class.
Used when demarshaling an Any, and with DII/DSI, and Dynamic Anys.
Definition at line 40 of file Any_Unknown_IDL_Type.h.
typedef ACE_Refcounted_Auto_Ptr<ACE_Lock, ACE_Lock_Adapter<TAO_SYNCH_MUTEX> > TAO::Unknown_IDL_Type::LOCK [private] |
Definition at line 83 of file Any_Unknown_IDL_Type.h.
TAO::Unknown_IDL_Type::Unknown_IDL_Type | ( | CORBA::TypeCode_ptr | tc, | |
TAO_InputCDR & | cdr | |||
) |
Definition at line 28 of file Any_Unknown_IDL_Type.cpp.
: TAO::Any_Impl (0, tc, true) , lock_ (lock_i ()) , cdr_ (static_cast<ACE_Message_Block*>(0), lock_.get ()) { try { this->_tao_decode (cdr); } catch (::CORBA::Exception const &) { } }
TAO::Unknown_IDL_Type::Unknown_IDL_Type | ( | CORBA::TypeCode_ptr | tc | ) |
Definition at line 43 of file Any_Unknown_IDL_Type.cpp.
TAO::Unknown_IDL_Type::~Unknown_IDL_Type | ( | void | ) | [virtual] |
Definition at line 50 of file Any_Unknown_IDL_Type.cpp.
{ }
int TAO::Unknown_IDL_Type::_tao_byte_order | ( | void | ) | const [virtual] |
Reimplemented from TAO::Any_Impl.
Definition at line 100 of file Any_Unknown_IDL_Type.cpp.
{ return this->cdr_.byte_order (); }
void TAO::Unknown_IDL_Type::_tao_decode | ( | TAO_InputCDR & | cdr | ) | [virtual] |
Reimplemented from TAO::Any_Impl.
Definition at line 105 of file Any_Unknown_IDL_Type.cpp.
{ // @@ (JP) The following code depends on the fact that // TAO_InputCDR does not contain chained message blocks, // otherwise <begin> and <end> could be part of // different buffers! // This will be the start of a new message block. char const * const begin = cdr.rd_ptr (); // Skip over the next argument. TAO::traverse_status const status = TAO_Marshal_Object::perform_skip (this->type_, &cdr); if (status != TAO::TRAVERSE_CONTINUE) { throw ::CORBA::MARSHAL (); } // This will be the end of the new message block. char const * const end = cdr.rd_ptr (); // The ACE_CDR::mb_align() call can shift the rd_ptr by up to // ACE_CDR::MAX_ALIGNMENT - 1 bytes. Similarly, the offset adjustment // can move the rd_ptr by up to the same amount. We accommodate // this by including 2 * ACE_CDR::MAX_ALIGNMENT bytes of additional // space in the message block. size_t const size = end - begin; ACE_Message_Block new_mb (size + 2 * ACE_CDR::MAX_ALIGNMENT); ACE_CDR::mb_align (&new_mb); ptrdiff_t offset = ptrdiff_t (begin) % ACE_CDR::MAX_ALIGNMENT; if (offset < 0) { offset += ACE_CDR::MAX_ALIGNMENT; } new_mb.rd_ptr (offset); new_mb.wr_ptr (offset + size); ACE_OS::memcpy (new_mb.rd_ptr (), begin, size); this->cdr_.reset (&new_mb, cdr.byte_order ()); this->cdr_.char_translator (cdr.char_translator ()); this->cdr_.wchar_translator (cdr.wchar_translator ()); this->cdr_.set_repo_id_map (cdr.get_repo_id_map ()); this->cdr_.set_codebase_url_map (cdr.get_codebase_url_map ()); this->cdr_.set_value_map (cdr.get_value_map ()); // Take over the GIOP version, the input cdr can have a different // version then our current GIOP version. ACE_CDR::Octet major_version; ACE_CDR::Octet minor_version; cdr.get_version (major_version, minor_version); this->cdr_.set_version (major_version, minor_version); }
TAO_InputCDR & TAO::Unknown_IDL_Type::_tao_get_cdr | ( | void | ) | [virtual] |
Definition at line 94 of file Any_Unknown_IDL_Type.cpp.
{ return this->cdr_; }
void TAO::Unknown_IDL_Type::free_value | ( | void | ) | [virtual] |
Reimplemented from TAO::Any_Impl.
Definition at line 88 of file Any_Unknown_IDL_Type.cpp.
{ ::CORBA::release (this->type_); }
TAO::Unknown_IDL_Type::LOCK const TAO::Unknown_IDL_Type::lock_i | ( | void | ) | [static, private] |
Definition at line 22 of file Any_Unknown_IDL_Type.cpp.
{ static LOCK base_lock_ (new ACE_Lock_Adapter<TAO_SYNCH_MUTEX>()); return base_lock_; }
CORBA::Boolean TAO::Unknown_IDL_Type::marshal_value | ( | TAO_OutputCDR & | cdr | ) | [virtual] |
Implements TAO::Any_Impl.
Definition at line 55 of file Any_Unknown_IDL_Type.cpp.
{ try { // We don't want the rd_ptr to move, in case we are shared by // another Any, so we use this to copy the state, not the buffer. TAO_InputCDR for_reading (this->cdr_); TAO::traverse_status const status = TAO_Marshal_Object::perform_append (this->type_, &for_reading, &cdr); if (status != TAO::TRAVERSE_CONTINUE) { return false; } } catch (::CORBA::Exception const &) { return false; } return true; }
CORBA::Boolean TAO::Unknown_IDL_Type::to_abstract_base | ( | CORBA::AbstractBase_ptr & | obj | ) | const [virtual] |
Reimplemented from TAO::Any_Impl.
Definition at line 232 of file Any_Unknown_IDL_Type.cpp.
{ try { CORBA::TCKind const kind = TAO::unaliased_kind (this->type_); if (kind != CORBA::tk_abstract_interface) { return false; } TAO_ORB_Core *orb_core = this->cdr_.orb_core (); if (orb_core == 0) { orb_core = TAO_ORB_Core_instance (); if (TAO_debug_level > 0) { ACE_DEBUG ((LM_WARNING, ACE_TEXT ("TAO (%P|%t) WARNING: extracting ") ACE_TEXT ("abstract base using default ORB_Core\n"))); } } // We don't want the rd_ptr to move, in case we are shared by // another Any, so we use this to copy the state, not the buffer. TAO_InputCDR for_reading (this->cdr_); TAO_Valuetype_Adapter * const adapter = orb_core->valuetype_adapter (); CORBA::Boolean ret = adapter->stream_to_abstract_base (for_reading, obj); return ret; } catch (::CORBA::Exception const &) { } return false; }
CORBA::Boolean TAO::Unknown_IDL_Type::to_object | ( | CORBA::Object_ptr & | obj | ) | const [virtual] |
Reimplemented from TAO::Any_Impl.
Definition at line 166 of file Any_Unknown_IDL_Type.cpp.
{ try { CORBA::TCKind const kind = TAO::unaliased_kind (this->type_); if (kind != CORBA::tk_objref) { return false; } // We don't want the rd_ptr to move, in case we are shared by // another Any, so we use this to copy the state, not the buffer. TAO_InputCDR for_reading (this->cdr_); return for_reading >> obj; } catch (::CORBA::Exception const &) { } return false; }
CORBA::Boolean TAO::Unknown_IDL_Type::to_value | ( | CORBA::ValueBase *& | val | ) | const [virtual] |
Reimplemented from TAO::Any_Impl.
Definition at line 191 of file Any_Unknown_IDL_Type.cpp.
{ try { CORBA::TCKind const kind = TAO::unaliased_kind (this->type_); if (kind != CORBA::tk_value) { return false; } TAO_ORB_Core *orb_core = this->cdr_.orb_core (); if (orb_core == 0) { orb_core = TAO_ORB_Core_instance (); if (TAO_debug_level > 0) { ACE_DEBUG ((LM_WARNING, ACE_TEXT ("TAO (%P|%t) WARNING: extracting ") ACE_TEXT ("valuetype using default ORB_Core\n"))); } } // We don't want the rd_ptr to move, in case we are shared by // another Any, so we use this to copy the state, not the buffer. TAO_InputCDR for_reading (this->cdr_); TAO_Valuetype_Adapter * const adapter = orb_core->valuetype_adapter (); return adapter->stream_to_value (for_reading, val); } catch (::CORBA::Exception const &) { } return false; }
const void * TAO::Unknown_IDL_Type::value | ( | void | ) | const [virtual] |
Definition at line 82 of file Any_Unknown_IDL_Type.cpp.
TAO_InputCDR TAO::Unknown_IDL_Type::cdr_ [mutable, private] |
Definition at line 86 of file Any_Unknown_IDL_Type.h.
LOCK const TAO::Unknown_IDL_Type::lock_ [private] |
Definition at line 85 of file Any_Unknown_IDL_Type.h.