1 #include "TruncatableS_impl.h"
2 #include "ace/OS_NS_stdio.h"
4 Test_impl::Test_impl (CORBA::ORB_ptr orb
)
5 : orb_ (CORBA::ORB::_duplicate (orb
))
12 ::OBV_TruncatableTest::BaseValue
* iv
,
13 ::OBV_TruncatableTest::BaseValue_out ov
,
17 if (TAO_debug_level
> 0)
19 ACE_TEXT("(%P|%t)Test_impl::op1")
20 ACE_TEXT(" id=%s basic_data=%u desc=%s\n"),
21 id
, iv
->basic_data (), desc
));
23 char *tmp
= CORBA::string_alloc (
24 static_cast<CORBA::ULong
> (ACE_OS::strlen (id
) + ACE_OS::strlen (desc
) + 2));
25 ACE_OS::sprintf (tmp
, "%s: %s", id
, desc
);
26 CORBA::string_free (desc
);
29 ov
= new ::OBV_OBV_TruncatableTest::BaseValue();
30 ov
->basic_data (iv
->basic_data());
36 ::OBV_TruncatableTest::TValue1
* iv
,
38 ::OBV_TruncatableTest::TValue1_out ov
,
42 if (TAO_debug_level
> 0)
44 ACE_TEXT("(%P|%t)Test_impl::op2")
45 ACE_TEXT(" id=%s basic_data=%u data1=%u desc=%s\n"),
46 id
, iv
->basic_data (), iv
->data1 (), desc
));
47 char *tmp
= CORBA::string_alloc (
48 static_cast<CORBA::ULong
> (ACE_OS::strlen (id
) + ACE_OS::strlen (desc
) + 2));
49 ACE_OS::sprintf (tmp
, "%s: %s", id
, desc
);
50 CORBA::string_free (desc
);
53 ov
= new ::OBV_OBV_TruncatableTest::TValue1();
54 ov
->basic_data (iv
->basic_data());
55 ov
->data1 (iv
->data1());
62 ::OBV_TruncatableTest::TValue4
* iv
,
63 ::OBV_TruncatableTest::TValue4_out ov
,
67 if (TAO_debug_level
> 0)
69 ACE_TEXT("(%P|%t)Test_impl::op3")
70 ACE_TEXT(" id=%s basic_data=%u data=%u data4=%u desc=%s\n"),
71 id
, iv
->basic_data (), iv
->nv4()->data (), iv
->data4 (), desc
));
73 char *tmp
= CORBA::string_alloc (
74 static_cast<CORBA::ULong
> (ACE_OS::strlen (id
) + ACE_OS::strlen (desc
) + 2));
75 ACE_OS::sprintf (tmp
, "%s: %s", id
, desc
);
76 CORBA::string_free (desc
);
79 ov
= new ::OBV_OBV_TruncatableTest::TValue4();
80 ::OBV_OBV_TruncatableTest::NestedValue
* nv
=
81 new ::OBV_OBV_TruncatableTest::NestedValue();
82 nv
->data (iv
->nv4()->data ());
83 ov
->basic_data (iv
->basic_data());
85 ov
->data4 (iv
->data4());
86 CORBA::remove_ref(nv
);
90 ::OBV_TruncatableTest::BaseValue
*
93 ::OBV_TruncatableTest::TValue1
* iv1
,
95 ::OBV_TruncatableTest::TValue4
* iv2
,
96 ::OBV_TruncatableTest::TValue4
* iv3
,
97 ::OBV_TruncatableTest::TValue1
* iv4
,
101 if (TAO_debug_level
> 0)
104 ACE_TEXT("(%P|%t)Test_impl::op4")
105 ACE_TEXT(" id=%s basic_data=%u data1=%u desc=%s\n"),
106 id
, iv1
->basic_data (), iv1
->data1 (), desc
));
108 ACE_TEXT("(%P|%t)Test_impl::op4")
109 ACE_TEXT(" id=%s basic_data=%u data=%u data4=%u desc=%s\n"),
110 id
, iv2
->basic_data (), iv2
->nv4()->data (),
111 iv2
->data4 (), desc
));
113 ACE_TEXT("(%P|%t)Test_impl::op4")
114 ACE_TEXT(" id=%s basic_data=%u data=%u data4=%u desc=%s\n"),
115 id
, iv3
->basic_data (), iv3
->nv4()->data (),
116 iv3
->data4 (), desc
));
118 ACE_TEXT("(%P|%t)Test_impl::op4")
119 ACE_TEXT(" id=%s basic_data=%u data1=%u desc=%s\n"),
120 id
, iv4
->basic_data (), iv4
->data1 (), desc
));
123 char *tmp
= CORBA::string_alloc (
124 static_cast<CORBA::ULong
> (ACE_OS::strlen (id
) + ACE_OS::strlen (desc
) + 2));
125 ACE_OS::sprintf (tmp
, "%s: %s", id
, desc
);
126 CORBA::string_free (desc
);
129 ::OBV_TruncatableTest::BaseValue
* ov
=
130 new ::OBV_OBV_TruncatableTest::BaseValue();
133 x
* (iv1
->basic_data () + iv2
->basic_data () +
134 iv3
->basic_data () + iv4
->basic_data ());
135 ov
->basic_data (total
);
142 Test_impl::op5 (const CORBA::Any
& val
,
144 ::OBV_TruncatableTest::TValue1_out ov
,
148 ov
= new ::OBV_OBV_TruncatableTest::TValue1();
149 ::OBV_TruncatableTest::TValue1_var iv
;
150 CORBA::ValueBase_var target
;
151 if (!(val
>>= CORBA::Any::to_value(target
.inout())))
153 ACE_DEBUG ((LM_DEBUG
,
154 ACE_TEXT("(%P|%t)Test_impl::op5 extract failed\n")));
155 ov
->basic_data (101);
160 iv
= ::OBV_TruncatableTest::TValue1::_downcast(target
._retn());
161 if (TAO_debug_level
> 0)
163 ACE_TEXT("(%P|%t)Test_impl::op5")
164 ACE_TEXT(" id=%s basic_data=%u data1=%u desc=%s\n"),
165 id
, iv
->basic_data (), iv
->data1 (), desc
));
166 char *tmp
= CORBA::string_alloc (
167 static_cast<CORBA::ULong
> (ACE_OS::strlen (id
) + ACE_OS::strlen (desc
) + 2));
168 ACE_OS::sprintf (tmp
, "%s: %s", id
, desc
);
169 CORBA::string_free (desc
);
172 ov
->basic_data (iv
->basic_data());
173 ov
->data1 (iv
->data1());
178 Test_impl::shutdown ()
180 this->orb_
->shutdown (false);