Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tests / Abstract_Interface / test_i.cpp
blob65900ae7808e7bcf939d04ce5dc8c80ea9648b3a
1 // -*- C++ -*-
2 #include "test_i.h"
3 #include "ace/OS_NS_string.h"
5 char *
6 foo_i::foo_op (const char * inarg)
8 CORBA::String_var retval = CORBA::string_dup ("bad");
10 if (ACE_OS::strcmp (inarg, "foo_op") == 0)
12 retval = CORBA::string_dup ("good");
14 else
16 throw BadInput ("expected \"foo_op\"\n");
19 return retval._retn ();
22 char *
23 foo_i::base_op (const char * inarg)
25 CORBA::String_var retval = CORBA::string_dup ("bad");
27 if (ACE_OS::strcmp (inarg, "base_op") == 0)
29 retval = CORBA::string_dup ("good");
31 else
33 throw BadInput ("expected \"base_op\"\n");
36 return retval._retn ();
39 passer_i::passer_i (CORBA::ORB_ptr orb, PortableServer::POA_ptr poa)
40 : orb_ (CORBA::ORB::_duplicate (orb))
41 , poa_ (PortableServer::POA::_duplicate (poa))
45 void
46 passer_i::shutdown ()
48 this->orb_->shutdown (false);
51 void
52 passer_i::pass_ops (base_out outarg)
54 foo_i *servant = 0;
55 ACE_NEW (servant,
56 foo_i);
58 PortableServer::ObjectId_var id =
59 this->poa_->activate_object (servant);
61 CORBA::Object_var object = this->poa_->id_to_reference (id.in ());
63 PortableServer::ServantBase_var safety (servant);
64 outarg = foo::_narrow (object.in ());
67 void
68 passer_i::pass_state (base_out outarg)
70 TreeController_var tc;
71 ACE_NEW (tc.inout (),
72 OBV_TreeController);
74 // Create the root node.
75 StringNode_var sn;
76 ACE_NEW (sn.inout (),
77 OBV_StringNode);
78 sn->name ((const char *) "RootNode");
79 tc->root (sn.in ());
81 // Create the left leaf.
82 StringNode_var l_dummy;
83 ACE_NEW (l_dummy.inout (),
84 OBV_StringNode);
85 l_dummy->name ((const char *) "LeftNode");
86 sn->left (l_dummy.in ());
88 // Create the right leaf.
89 StringNode_var r_dummy;
90 ACE_NEW (r_dummy.inout (),
91 OBV_StringNode);
92 r_dummy->name ((const char *) "RightNode");
93 sn->right (r_dummy.in ());
95 outarg = tc._retn ();
98 void
99 passer_i::pass_nil (base_out outarg)
101 outarg = foo::_nil ();