#include <Marshal.h>
Inheritance diagram for TAO_Marshal_Array:
Public Member Functions | |
TAO_Marshal_Array (void) | |
virtual TAO::traverse_status | skip (CORBA::TypeCode_ptr tc, TAO_InputCDR *context) |
skip operation | |
virtual TAO::traverse_status | append (CORBA::TypeCode_ptr tc, TAO_InputCDR *src, TAO_OutputCDR *dest) |
append operation |
marshal an array
Definition at line 312 of file Marshal.h.
|
Definition at line 58 of file Marshal.inl.
00059 { 00060 } |
|
append operation
Implements TAO_Marshal_Object. Definition at line 840 of file append.cpp. References ACE_DEBUG, ACE_TEXT, ACE_OutputCDR::adjust(), LM_DEBUG, TAO_Marshal_Object::perform_append(), ACE_InputCDR::read_boolean_array(), ACE_InputCDR::read_char_array(), ACE_InputCDR::read_double_array(), ACE_InputCDR::read_float_array(), ACE_InputCDR::read_long_array(), ACE_InputCDR::read_longdouble_array(), ACE_InputCDR::read_longlong_array(), ACE_InputCDR::read_octet_array(), ACE_InputCDR::read_short_array(), ACE_InputCDR::read_ulong_array(), ACE_InputCDR::read_ulonglong_array(), ACE_InputCDR::read_ushort_array(), ACE_InputCDR::read_wchar_array(), and TAO_debug_level.
00843 { 00844 // retrieve the bounds of the array 00845 CORBA::ULong bounds = tc->length (); 00846 00847 // get element typecode 00848 CORBA::TypeCode_var tc2 = tc->content_type (); 00849 00850 // For CORBA basic types, the copy can be optimized 00851 CORBA::TCKind kind = tc2->kind (); 00852 00853 // Return status. 00854 TAO::traverse_status retval = 00855 TAO::TRAVERSE_CONTINUE; 00856 00857 switch (kind) 00858 { 00859 case CORBA::tk_octet: 00860 { 00861 char* buf; 00862 if (dest->adjust (ACE_CDR::OCTET_SIZE * bounds, 00863 ACE_CDR::OCTET_ALIGN, buf) == 0) 00864 { 00865 if (src->read_octet_array ((ACE_CDR::Octet*)buf, bounds) == 0) 00866 retval = TAO::TRAVERSE_STOP; 00867 } 00868 } 00869 break; 00870 case CORBA::tk_boolean: 00871 { 00872 char* buf; 00873 if (dest->adjust (ACE_CDR::OCTET_SIZE * bounds, 00874 ACE_CDR::OCTET_ALIGN, buf) == 0) 00875 { 00876 if (src->read_boolean_array ((ACE_CDR::Boolean*)buf, bounds) == 0) 00877 retval = TAO::TRAVERSE_STOP; 00878 } 00879 } 00880 break; 00881 case CORBA::tk_char: 00882 { 00883 char* buf; 00884 if (dest->adjust (ACE_CDR::OCTET_SIZE * bounds, 00885 ACE_CDR::OCTET_ALIGN, buf) == 0) 00886 { 00887 if (src->read_char_array ((ACE_CDR::Char*)buf, bounds) == 0) 00888 retval = TAO::TRAVERSE_STOP; 00889 } 00890 } 00891 break; 00892 case CORBA::tk_short: 00893 { 00894 char* buf; 00895 if (dest->adjust (ACE_CDR::SHORT_SIZE * bounds, 00896 ACE_CDR::SHORT_ALIGN, buf) == 0) 00897 { 00898 if (src->read_short_array ((ACE_CDR::Short*)buf, bounds) == 0) 00899 retval = TAO::TRAVERSE_STOP; 00900 } 00901 } 00902 break; 00903 case CORBA::tk_ushort: 00904 { 00905 char* buf; 00906 if (dest->adjust (ACE_CDR::SHORT_SIZE * bounds, 00907 ACE_CDR::SHORT_ALIGN, buf) == 0) 00908 { 00909 if (src->read_ushort_array ((ACE_CDR::UShort*)buf, bounds) == 0) 00910 retval = TAO::TRAVERSE_STOP; 00911 } 00912 } 00913 break; 00914 case CORBA::tk_wchar: 00915 { 00916 char* buf; 00917 if (dest->adjust (ACE_CDR::SHORT_SIZE * bounds, 00918 ACE_CDR::SHORT_ALIGN, buf) == 0) 00919 { 00920 if (src->read_wchar_array ((ACE_CDR::WChar*)buf, bounds) == 0) 00921 retval = TAO::TRAVERSE_STOP; 00922 } 00923 } 00924 break; 00925 case CORBA::tk_long: 00926 { 00927 char* buf; 00928 if (dest->adjust (ACE_CDR::LONG_SIZE * bounds, 00929 ACE_CDR::LONG_ALIGN, buf) == 0) 00930 { 00931 if (src->read_long_array ((ACE_CDR::Long*)buf, bounds) == 0) 00932 retval = TAO::TRAVERSE_STOP; 00933 } 00934 } 00935 break; 00936 case CORBA::tk_ulong: 00937 { 00938 char* buf; 00939 if (dest->adjust (ACE_CDR::LONG_SIZE * bounds, 00940 ACE_CDR::LONG_ALIGN, buf) == 0) 00941 { 00942 if (src->read_ulong_array ((ACE_CDR::ULong*)buf, bounds) == 0) 00943 retval = TAO::TRAVERSE_STOP; 00944 } 00945 } 00946 break; 00947 case CORBA::tk_float: 00948 { 00949 char* buf; 00950 if (dest->adjust (ACE_CDR::LONG_SIZE * bounds, 00951 ACE_CDR::LONG_ALIGN, buf) == 0) 00952 { 00953 if (src->read_float_array ((ACE_CDR::Float*)buf, bounds) == 0) 00954 retval = TAO::TRAVERSE_STOP; 00955 } 00956 } 00957 break; 00958 case CORBA::tk_double: 00959 { 00960 char* buf; 00961 if (dest->adjust (ACE_CDR::LONGLONG_SIZE * bounds, 00962 ACE_CDR::LONGLONG_ALIGN, buf) == 0) 00963 { 00964 if (src->read_double_array ((ACE_CDR::Double*)buf, bounds) == 0) 00965 retval = TAO::TRAVERSE_STOP; 00966 } 00967 } 00968 break; 00969 case CORBA::tk_longlong: 00970 { 00971 char* buf; 00972 if (dest->adjust (ACE_CDR::LONGLONG_SIZE * bounds, 00973 ACE_CDR::LONGLONG_ALIGN, buf) == 0) 00974 { 00975 if (src->read_longlong_array ((ACE_CDR::LongLong*)buf, bounds) == 0) 00976 retval = TAO::TRAVERSE_STOP; 00977 } 00978 } 00979 break; 00980 case CORBA::tk_ulonglong: 00981 { 00982 char* buf; 00983 if (dest->adjust (ACE_CDR::LONGLONG_SIZE * bounds, 00984 ACE_CDR::LONGLONG_ALIGN, buf) == 0) 00985 { 00986 if (src->read_ulonglong_array ((ACE_CDR::ULongLong*)buf, bounds) == 0) 00987 retval = TAO::TRAVERSE_STOP; 00988 } 00989 } 00990 break; 00991 case CORBA::tk_longdouble: 00992 { 00993 char* buf; 00994 if (dest->adjust (ACE_CDR::LONGDOUBLE_SIZE * bounds, 00995 ACE_CDR::LONGDOUBLE_ALIGN, buf) == 0) 00996 { 00997 if (src->read_longdouble_array ((ACE_CDR::LongDouble*)buf, bounds) == 0) 00998 retval = TAO::TRAVERSE_STOP; 00999 } 01000 } 01001 break; 01002 default: 01003 while (bounds-- && retval == TAO::TRAVERSE_CONTINUE) 01004 { 01005 retval = TAO_Marshal_Object::perform_append (tc2.in (), 01006 src, 01007 dest 01008 ); 01009 } 01010 break; 01011 }// end of switch 01012 01013 if (retval == TAO::TRAVERSE_CONTINUE) 01014 return retval; 01015 01016 // error exit 01017 if (TAO_debug_level > 0) 01018 ACE_DEBUG ((LM_DEBUG, 01019 ACE_TEXT ("TAO_Marshal_Sequence::append detected error\n"))); 01020 01021 throw ::CORBA::MARSHAL (); 01022 } |
|
skip operation
Implements TAO_Marshal_Object. Definition at line 676 of file skip.cpp. References ACE_DEBUG, ACE_TEXT, ACE_InputCDR::adjust(), LM_DEBUG, TAO_Marshal_Object::perform_skip(), ACE_InputCDR::skip_bytes(), and TAO_debug_level.
00677 { 00678 CORBA::Boolean continue_skipping = true; 00679 00680 // retrieve the bounds of the array 00681 CORBA::ULong bounds = tc->length (); 00682 00683 // get element typecode 00684 // Typecode of the element. 00685 CORBA::TypeCode_var tc2 = tc->content_type (); 00686 00687 // For CORBA basic types, the skip can be optimized 00688 CORBA::TCKind const kind = tc2->kind (); 00689 00690 char *dummy; 00691 switch (kind) 00692 { 00693 case CORBA::tk_octet: 00694 case CORBA::tk_boolean: 00695 case CORBA::tk_char: 00696 { 00697 stream->adjust (0, ACE_CDR::OCTET_ALIGN, dummy); 00698 continue_skipping = 00699 stream->skip_bytes (ACE_CDR::OCTET_SIZE * bounds); 00700 } 00701 break; 00702 case CORBA::tk_short: 00703 case CORBA::tk_ushort: 00704 case CORBA::tk_wchar: 00705 { 00706 stream->adjust (0, ACE_CDR::SHORT_ALIGN, dummy); 00707 continue_skipping = 00708 stream->skip_bytes (ACE_CDR::SHORT_SIZE * bounds); 00709 } 00710 break; 00711 case CORBA::tk_long: 00712 case CORBA::tk_ulong: 00713 case CORBA::tk_float: 00714 { 00715 stream->adjust (0, ACE_CDR::LONG_ALIGN, dummy); 00716 continue_skipping = 00717 stream->skip_bytes (ACE_CDR::LONG_SIZE * bounds); 00718 } 00719 break; 00720 case CORBA::tk_double: 00721 case CORBA::tk_longlong: 00722 case CORBA::tk_ulonglong: 00723 { 00724 stream->adjust (0, ACE_CDR::LONGLONG_ALIGN, dummy); 00725 continue_skipping = 00726 stream->skip_bytes (ACE_CDR::LONGLONG_SIZE * bounds); 00727 } 00728 break; 00729 case CORBA::tk_longdouble: 00730 { 00731 stream->adjust (0, ACE_CDR::LONGDOUBLE_ALIGN, dummy); 00732 continue_skipping = 00733 stream->skip_bytes (ACE_CDR::LONGDOUBLE_SIZE * bounds); 00734 } 00735 break; 00736 00737 default: 00738 while (bounds-- && continue_skipping) 00739 { 00740 int stop = 00741 TAO_Marshal_Object::perform_skip (tc2.in (), stream); 00742 if (stop == TAO::TRAVERSE_STOP) 00743 continue_skipping = false; 00744 } 00745 break; 00746 }// end of switch 00747 00748 if (continue_skipping) 00749 return TAO::TRAVERSE_CONTINUE; 00750 00751 // error exit 00752 if (TAO_debug_level > 0) 00753 ACE_DEBUG ((LM_DEBUG, 00754 ACE_TEXT ("TAO_Marshal_Sequence::skip detected error\n"))); 00755 00756 throw ::CORBA::MARSHAL (); 00757 } |