Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tests / TransportCurrent / Framework / Tester.cpp
blob2e08cbe97f24b8599575dab010da0685a30dd685
1 #include "tao/TransportCurrent/Transport_Current.h"
2 #include "tao/SystemException.h"
4 using namespace TAO;
6 /// Test referencing the TC data outside of the context of an upcall,
7 /// or a client-side interceptor
9 int
10 test_transport_current (Transport::Current_ptr tc)
12 CORBA::Long id = tc->id ();
14 TAO::CounterT bs = tc->bytes_sent ();
16 TAO::CounterT br = tc->bytes_received ();
18 TAO::CounterT rs = tc->messages_sent ();
20 TAO::CounterT rr = tc->messages_received ();
22 ACE_DEBUG ((LM_DEBUG,
23 ACE_TEXT ("Tester (%P|%t) Transport [%q] - Sent/Received [bytes=%q/%q, messages=%q/%q]\n"),
24 (ACE_UINT64)id,
25 (ACE_UINT64)bs,
26 (ACE_UINT64)br,
27 (ACE_UINT64)rs,
28 (ACE_UINT64)rr));
30 return 0;
33 int
34 test_transport_current (CORBA::ORB_ptr orb)
36 // Get the Current object.
37 CORBA::Object_var tcobject =
38 orb->resolve_initial_references ("TAO::Transport::Current");
40 Transport::Current_var tc =
41 Transport::Current::_narrow (tcobject.in ());
43 if (CORBA::is_nil (tc.in ()))
45 ACE_ERROR ((LM_ERROR,
46 ACE_TEXT ("(%P|%t) client - ERROR: Could not resolve ")
47 ACE_TEXT ("TAOTransportCurrent object.\n")));
49 throw CORBA::INTERNAL ();
52 return test_transport_current (tc.in ());