Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tests / Param_Test / fixed_struct.cpp
blob9e6c2fdc2f4b92b49cb2280a5ecdee7fe3275bb6
2 //=============================================================================
3 /**
4 * @file fixed_struct.cpp
6 * tests fixed sized structs
8 * @author Aniruddha Gokhale
9 */
10 //=============================================================================
13 #include "helper.h"
14 #include "fixed_struct.h"
16 // ************************************************************************
17 // Test_Fixed_Struct
18 // ************************************************************************
20 Test_Fixed_Struct::Test_Fixed_Struct ()
21 : opname_ (CORBA::string_dup ("test_fixed_struct"))
25 Test_Fixed_Struct::~Test_Fixed_Struct ()
27 CORBA::string_free (this->opname_);
28 this->opname_ = 0;
31 const char *
32 Test_Fixed_Struct::opname () const
34 return this->opname_;
37 void
38 Test_Fixed_Struct::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_;
43 req->set_return_type (Param_Test::_tc_Fixed_Struct);
45 req->invoke ();
47 const Param_Test::Fixed_Struct *tmp = 0;
48 req->return_value () >>= tmp;
49 this->ret_ = *tmp;
51 CORBA::NamedValue_ptr arg2 =
52 req->arguments ()->item (1);
53 *arg2->value () >>= tmp;
54 this->inout_ = *tmp;
56 CORBA::NamedValue_ptr arg3 =
57 req->arguments ()->item (2);
58 *arg3->value () >>= tmp;
59 this->out_ = *tmp;
62 int
63 Test_Fixed_Struct::init_parameters (Param_Test_ptr /*objref*/
64 /*env*/)
66 Generator *gen = GENERATOR::instance (); // value generator
68 //ACE_UNUSED_ARG (objref);
70 this->in_ = gen->gen_fixed_struct ();
71 ACE_OS::memset (&this->inout_,
73 sizeof (Param_Test::Fixed_Struct));
74 return 0;
77 int
78 Test_Fixed_Struct::reset_parameters ()
80 ACE_OS::memset (&this->inout_,
82 sizeof (Param_Test::Fixed_Struct));
84 ACE_OS::memset (&this->out_,
86 sizeof (Param_Test::Fixed_Struct));
88 ACE_OS::memset (&this->ret_,
90 sizeof (Param_Test::Fixed_Struct));
92 return 0;
95 int
96 Test_Fixed_Struct::run_sii_test (Param_Test_ptr objref)
98 try
100 this->ret_ = objref->test_fixed_struct (this->in_,
101 this->inout_,
102 this->out_);
104 return 0;
106 catch (const CORBA::Exception& ex)
108 ex._tao_print_exception ("Test_Fixed_Struct::run_sii_test\n");
110 return -1;
113 CORBA::Boolean
114 Test_Fixed_Struct::check_validity ()
116 if (this->in_.l == this->inout_.l &&
117 this->in_.c == this->inout_.c &&
118 this->in_.s == this->inout_.s &&
119 this->in_.o == this->inout_.o &&
120 ACE::is_equal (this->in_.f, this->inout_.f) &&
121 this->in_.b == this->inout_.b &&
122 ACE::is_equal (this->in_.d, this->inout_.d) &&
123 this->in_.l == this->out_.l &&
124 this->in_.c == this->out_.c &&
125 this->in_.s == this->out_.s &&
126 this->in_.o == this->out_.o &&
127 ACE::is_equal (this->in_.f, this->out_.f) &&
128 this->in_.b == this->out_.b &&
129 ACE::is_equal (this->in_.d, this->out_.d) &&
130 this->in_.l == this->ret_.l &&
131 this->in_.c == this->ret_.c &&
132 this->in_.s == this->ret_.s &&
133 this->in_.o == this->ret_.o &&
134 ACE::is_equal (this->in_.f, this->ret_.f) &&
135 this->in_.b == this->ret_.b &&
136 ACE::is_equal (this->in_.d, this->ret_.d))
137 return 1;
138 else
139 return 0;
142 CORBA::Boolean
143 Test_Fixed_Struct::check_validity (CORBA::Request_ptr /*req*/)
145 //ACE_UNUSED_ARG (req);
146 return this->check_validity ();
149 void
150 Test_Fixed_Struct::print_values ()
152 ACE_DEBUG ((LM_DEBUG,
153 "\n=*=*=*=*=*=*\n"
154 "in = {\n"
155 "\tl = %d\n"
156 "\tc = %c\n"
157 "\ts = %d\n"
158 "\to = %x\n"
159 "\tf = %f\n"
160 "\tb = %d\n"
161 "\td = %f\n"
162 "}\n"
163 "inout = {\n"
164 "\tl = %d\n"
165 "\tc = %c\n"
166 "\ts = %d\n"
167 "\to = %x\n"
168 "\tf = %f\n"
169 "\tb = %d\n"
170 "\td = %f\n"
171 "}\n"
172 "out = {\n"
173 "\tl = %d\n"
174 "\tc = %c\n"
175 "\ts = %d\n"
176 "\to = %x\n"
177 "\tf = %f\n"
178 "\tb = %d\n"
179 "\td = %f\n"
180 "}\n"
181 "ret = {\n"
182 "\tl = %d\n"
183 "\tc = %c\n"
184 "\ts = %d\n"
185 "\to = %x\n"
186 "\tf = %f\n"
187 "\tb = %d\n"
188 "\td = %f\n"
189 "}\n"
190 "=*=*=*=*=*=*\n",
191 this->in_.l,
192 this->in_.c,
193 this->in_.s,
194 this->in_.o,
195 this->in_.f,
196 this->in_.b,
197 this->in_.d,
198 this->inout_.l,
199 this->inout_.c,
200 this->inout_.s,
201 this->inout_.o,
202 this->inout_.f,
203 this->inout_.b,
204 this->inout_.d,
205 this->out_.l,
206 this->out_.c,
207 this->out_.s,
208 this->out_.o,
209 this->out_.f,
210 this->out_.b,
211 this->out_.d,
212 this->ret_.l,
213 this->ret_.c,
214 this->ret_.s,
215 this->ret_.o,
216 this->ret_.f,
217 this->ret_.b,
218 this->ret_.d));