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

Any.cpp File Reference

#include "tao_pch.h"
#include "tao/Any.h"
#include "tao/Typecode.h"
#include "tao/Marshal.h"
#include "tao/ORB_Core.h"
#include "tao/Object.h"
#include "tao/AbstractBase.h"
#include "tao/debug.h"
#include "tao/Any.i"

Include dependency graph for Any.cpp:

Include dependency graph

Go to the source code of this file.

Functions

const char * get_rcsid_tao_Any (const char *)
CORBA::Boolean operator<< (TAO_OutputCDR &cdr, const CORBA::Any &x)
CORBA::Boolean operator>> (TAO_InputCDR &cdr, CORBA::Any &x)

Variables

const char * rcsid_tao_Any = get_rcsid_tao_Any ( rcsid_tao_Any )


Function Documentation

const char* get_rcsid_tao_Any const char *    [inline, static]
 

Definition at line 22 of file Any.cpp.

00022 : Any.cpp,v 1.1.1.4.2.3 2003/05/14 14:03:30 chad Exp $")

CORBA::Boolean operator<< TAO_OutputCDR   cdr,
const CORBA::Any   x
 

Definition at line 1847 of file Any.cpp.

References ACE_CATCH, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_TRY_CHECK, ACE_TRY_NEW_ENV, and TAO_Marshal_Object::perform_append.

01849 {
01850   // If a locality-constrained interface is contained at
01851   // any level, the Any cannot be marshaled.
01852   if (x.contains_local ())
01853     {
01854       return 0;
01855     }
01856 
01857   CORBA::TypeCode_var tc = x.type ();
01858 
01859   if (!(cdr << tc.in ()))
01860     {
01861       return 0;
01862     }
01863 
01864   ACE_TRY_NEW_ENV
01865     {
01866       TAO_InputCDR input (x._tao_get_cdr (),
01867                           x._tao_byte_order ());
01868 
01869       CORBA::TypeCode::traverse_status status =
01870         TAO_Marshal_Object::perform_append (tc.in (),
01871                                             &input,
01872                                             &cdr
01873                                             ACE_ENV_ARG_PARAMETER);
01874       ACE_TRY_CHECK;
01875 
01876       if (status != CORBA::TypeCode::TRAVERSE_CONTINUE)
01877         {
01878           return 0;
01879         }
01880     }
01881   ACE_CATCH (CORBA_Exception, ex)
01882     {
01883       return 0;
01884     }
01885   ACE_ENDTRY;
01886 
01887   return 1;
01888 }

CORBA::Boolean operator>> TAO_InputCDR   cdr,
CORBA::Any   x
 

Definition at line 1891 of file Any.cpp.

References ACE_CATCH, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_TRY_CHECK, ACE_TRY_NEW_ENV, ACE_InputCDR::byte_order, ACE_InputCDR::char_translator, ACE_CDR::MAX_ALIGNMENT, ACE_CDR::mb_align, ACE_OS_String::memcpy, TAO_Marshal_Object::perform_skip, ptr_arith_t, ACE_Message_Block::rd_ptr, ACE_InputCDR::rd_ptr, ACE_InputCDR::wchar_translator, and ACE_Message_Block::wr_ptr.

01892 {
01893   CORBA::TypeCode_var tc;
01894 
01895   if (!(cdr >> tc.out ()))
01896     {
01897       return 0;
01898     }
01899 
01900   ACE_TRY_NEW_ENV
01901     {
01902       // @@ (JP) The following code depends on the fact that
01903       //         TAO_InputCDR does not contain chained message blocks,
01904       //         otherwise <begin> and <end> could be part of
01905       //         different buffers!
01906 
01907       // This will be the start of a new message block.
01908       char *begin = cdr.rd_ptr ();
01909 
01910       // Skip over the next aregument.
01911       CORBA::TypeCode::traverse_status status =
01912         TAO_Marshal_Object::perform_skip (tc.in (),
01913                                           &cdr
01914                                           ACE_ENV_ARG_PARAMETER);
01915       ACE_TRY_CHECK;
01916 
01917       if (status != CORBA::TypeCode::TRAVERSE_CONTINUE)
01918         {
01919           return 0;
01920         }
01921 
01922       // This will be the end of the new message block.
01923       char *end = cdr.rd_ptr ();
01924 
01925       // The ACE_CDR::mb_align() call can shift the rd_ptr by up to
01926       // ACE_CDR::MAX_ALIGNMENT-1 bytes. Similarly, the offset adjustment
01927       // can move the rd_ptr by up to the same amount. We accommodate
01928       // this by including 2 * ACE_CDR::MAX_ALIGNMENT bytes of additional
01929       // space in the message block.
01930       size_t size = end - begin;
01931       ACE_Message_Block mb (size + 2 * ACE_CDR::MAX_ALIGNMENT);
01932       ACE_CDR::mb_align (&mb);
01933       ptr_arith_t offset = ptr_arith_t (begin) % ACE_CDR::MAX_ALIGNMENT;
01934       mb.rd_ptr (offset);
01935       mb.wr_ptr (offset + size);
01936       ACE_OS::memcpy (mb.rd_ptr (), begin, size);
01937 
01938       x.char_translator_ = cdr.char_translator();
01939       x.wchar_translator_ = cdr.wchar_translator();
01940 
01941       // Stick it into the Any. It gets duplicated there.
01942       x._tao_replace (tc.in (),
01943                       cdr.byte_order (),
01944                       &mb);
01945     }
01946   ACE_CATCH (CORBA_Exception, ex)
01947     {
01948       return 0;
01949     }
01950   ACE_ENDTRY;
01951 
01952   return 1;
01953 }


Variable Documentation

const char* rcsid_tao_Any = get_rcsid_tao_Any ( rcsid_tao_Any ) [static]
 

Definition at line 22 of file Any.cpp.


Generated on Mon Jun 16 13:51:42 2003 for TAO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002