Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tests / Param_Test / short.cpp
blob3fd478cd8d988ef27a344e22ad850a9c96cd81bf
2 //=============================================================================
3 /**
4 * @file short.cpp
6 * tests shorts
8 * @author Aniruddha Gokhale
9 */
10 //=============================================================================
13 #include "helper.h"
14 #include "short.h"
16 // ************************************************************************
17 // Test_Short
18 // ************************************************************************
20 Test_Short::Test_Short ()
21 : opname_ (CORBA::string_dup ("test_short"))
25 Test_Short::~Test_Short ()
27 CORBA::string_free (this->opname_);
28 this->opname_ = 0;
31 const char *
32 Test_Short::opname () const
34 return this->opname_;
37 void
38 Test_Short::dii_req_invoke (CORBA::Request *req)
40 req->add_in_arg ("s1") <<= this->in_;
41 req->add_inout_arg ("s2") <<= this->inout_;
42 req->add_out_arg ("s3") <<= this->out_;
44 req->set_return_type (CORBA::_tc_short);
46 req->invoke ();
48 req->return_value () >>= this->ret_;
50 CORBA::NamedValue_ptr o2 =
51 req->arguments ()->item (1);
52 *o2->value () >>= this->inout_;
54 CORBA::NamedValue_ptr o3 =
55 req->arguments ()->item (2);
56 *o3->value () >>= this->out_;
59 int
60 Test_Short::init_parameters (Param_Test_ptr /*objref*/)
62 Generator *gen = GENERATOR::instance (); // value generator
64 this->in_ = gen->gen_short ();
65 this->inout_ = 0;
66 return 0;
69 int
70 Test_Short::reset_parameters ()
72 this->inout_ = 0;
73 this->out_ = 0;
74 this->ret_ = 0;
75 return 0;
78 int
79 Test_Short::run_sii_test (Param_Test_ptr objref)
81 try
83 this->ret_ = objref->test_short (this->in_,
84 this->inout_,
85 this->out_);
87 return 0;
89 catch (const CORBA::Exception& ex)
91 ex._tao_print_exception ("Test_Short::run_sii_test\n");
93 return -1;
96 CORBA::Boolean
97 Test_Short::check_validity ()
99 if (this->inout_ == this->in_ * 2 &&
100 this->out_ == this->in_ * 3 &&
101 this->ret_ == this->in_ * 4)
102 return 1; // success
103 else
104 return 0;
107 CORBA::Boolean
108 Test_Short::check_validity (CORBA::Request_ptr /*req*/)
110 return this->check_validity ();
113 void
114 Test_Short::print_values ()
116 ACE_DEBUG ((LM_DEBUG,
117 "\n=*=*=*=*=*=*\n"
118 "in = %d, "
119 "inout = %d, "
120 "out = %d, "
121 "ret = %d\n"
122 "\n=*=*=*=*=*=*\n",
123 this->in_,
124 this->inout_,
125 this->out_,
126 this->ret_));