4 ACE_TMAIN (int argc
, ACE_TCHAR
*argv
[])
9 CORBA::ORB_init (argc
, argv
);
11 test::event0_init
*ev0_fac
= 0;
12 ACE_NEW_RETURN (ev0_fac
,
15 CORBA::ValueFactoryBase_var
ev0_fac_owner (ev0_fac
);
17 test::event1_init
*ev1_fac
= 0;
18 ACE_NEW_RETURN (ev1_fac
,
21 CORBA::ValueFactoryBase_var
ev1_fac_owner (ev1_fac
);
23 orb
->register_value_factory (ev0_fac
->tao_repository_id (), ev0_fac
);
24 orb
->register_value_factory (ev1_fac
->tao_repository_id (), ev1_fac
);
33 TAO_OutputCDR
cdr ((size_t) 0, // size
34 (int) ACE_CDR_BYTE_ORDER
,
35 (ACE_Allocator
*) 0, // buffer_allocator
36 (ACE_Allocator
*) 0, // data_block_allocator
37 (ACE_Allocator
*) 0, // message_block_allocator
43 if (!(cdr
<< ev0
.in ()))
45 ACE_ERROR_RETURN ((LM_DEBUG
,
46 "ERROR: cdr << ev0\n"),
50 // convert cdr into safe_octet_seq
51 CORBA::OctetSeq
safe_octet_seq (cdr
.total_length ());
52 safe_octet_seq
.length (cdr
.total_length ());
54 CORBA::Octet
*buffer
= safe_octet_seq
.get_buffer ();
55 for (ACE_Message_Block
const *i
= cdr
.begin ();
59 CORBA::ULong len
= i
->length ();
60 ACE_OS::memcpy (buffer
, i
->rd_ptr (), (size_t) len
);
64 // Use TAO_InputCDR for unmarshalling
65 buffer
= safe_octet_seq
.get_buffer ();
66 size_t char_len
= safe_octet_seq
.length () * sizeof (CORBA::Octet
);
67 TAO_InputCDR
input ((char const*) buffer
,
74 // Read ev1 from CDR, this should fail (we actually encoded a ev0),
75 // but *NOT* leak memory.
77 if (input
>> ev1
.out ())
79 ACE_ERROR_RETURN ((LM_DEBUG
,
80 "ERROR: unmarshal shouldn't work\n"),
89 catch (const CORBA::Exception
& ex
)
91 ex
._tao_print_exception (
92 "Caught exception in server:");