Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / examples / Simple / echo / Echo_i.cpp
blobc32847e6c1ca8dae4ae6a9e703ec6b189ed1f3cf
1 #include "Echo_i.h"
3 // Set the ORB pointer.
4 void
5 Echo_i::orb (CORBA::ORB_ptr o)
7 this->orb_ = CORBA::ORB::_duplicate (o);
10 // Return a list of object references.
11 Echo::List *
12 Echo_i::echo_list (const char *)
14 Echo::List_var list;
17 Echo::List *tmp = 0;
18 ACE_NEW_RETURN (tmp,
19 Echo::List (3),
20 0);
21 // Pass ownership to the _var, pitty that ACE_NEW_RETURN cannot
22 // assign to T_vars directly.
23 list = tmp;
26 list->length (3);
28 // Just do something to get a list of object references.
29 list[CORBA::ULong(0)] =
30 orb_->resolve_initial_references ("NameService");
32 list[CORBA::ULong(1)] =
33 orb_->resolve_initial_references ("NameService");
35 list[CORBA::ULong(2)] =
36 orb_->resolve_initial_references ("NameService");
38 return list._retn ();
41 // Return the mesg string from the server
43 char *
44 Echo_i::echo_string (const char *mesg)
46 // The pointer mesg was NULL, return.
47 if (mesg == 0)
48 return 0;
50 CORBA::String_var str = CORBA::string_dup (mesg);
52 // if <CORBA::string_dup> returns a 0 pointer, an exception is
53 // raised.
55 if (str.in () == 0)
56 throw CORBA::NO_MEMORY ();
58 // Got thru! now, make a deep copy of the mesg string and send it
59 // back to the client.
61 return str._retn ();
62 // The _retn is used as it allows the conversion of
63 // CORBA::String_var to char* without causing any compiler errors.
66 // Shutdown the server application.
68 void
69 Echo_i::shutdown ()
71 ACE_DEBUG ((LM_DEBUG,
72 ACE_TEXT ("\nThe echo server is shutting down\n")));
74 // Instruct the ORB to shutdown.
75 this->orb_->shutdown ();