2 //=============================================================================
4 * @file fixed_array.cpp
6 * tests fixed size arrays
8 * @author Aniruddha Gokhale
10 //=============================================================================
14 #include "fixed_array.h"
16 // ************************************************************************
18 // ************************************************************************
20 Test_Fixed_Array::Test_Fixed_Array (void)
21 : opname_ (CORBA::string_dup ("test_fixed_array")),
22 ret_ (new Param_Test::Fixed_Array
)
26 Test_Fixed_Array::~Test_Fixed_Array (void)
28 CORBA::string_free (this->opname_
);
33 Test_Fixed_Array::opname (void) const
39 Test_Fixed_Array::dii_req_invoke (CORBA::Request
*req
)
41 req
->add_in_arg ("s1") <<= Param_Test::Fixed_Array_forany (this->in_
);
42 req
->add_inout_arg ("s2") <<= Param_Test::Fixed_Array_forany (this->inout_
);
43 req
->add_out_arg ("s3") <<= Param_Test::Fixed_Array_forany (this->out_
);
44 req
->set_return_type (Param_Test::_tc_Fixed_Array
);
48 Param_Test::Fixed_Array_forany forany
;
49 req
->return_value () >>= forany
;
50 Param_Test::Fixed_Array_copy (this->ret_
, forany
.in ());
52 CORBA::NamedValue_ptr arg2
=
53 req
->arguments ()->item (1);
54 *arg2
->value () >>= forany
;
55 Param_Test::Fixed_Array_copy (this->inout_
, forany
.in ());
57 CORBA::NamedValue_ptr arg3
=
58 req
->arguments ()->item (2);
59 Param_Test::Fixed_Array_forany
out_any (this->out_
);
60 *arg3
->value () >>= forany
;
61 Param_Test::Fixed_Array_copy (this->out_
, forany
.in ());
65 Test_Fixed_Array::init_parameters (Param_Test_ptr
/*objref*/
68 Generator
*gen
= GENERATOR::instance (); // value generator
70 //ACE_UNUSED_ARG (objref);
72 for (CORBA::ULong i
=0; i
< Param_Test::DIM1
; i
++)
74 this->in_
[i
] = gen
->gen_long ();
81 Test_Fixed_Array::reset_parameters (void)
84 for (CORBA::ULong i
=0; i
< Param_Test::DIM1
; i
++)
89 // free the return value array
90 Param_Test::Fixed_Array_free (this->ret_
._retn ());
91 // needed for repeated DII calls
92 this->ret_
= new Param_Test::Fixed_Array
;
97 Test_Fixed_Array::run_sii_test (Param_Test_ptr objref
)
101 this->ret_
= objref
->test_fixed_array (this->in_
,
107 catch (const CORBA::Exception
& ex
)
109 ex
._tao_print_exception ("Test_Fixed_Array::run_sii_test\n");
116 Test_Fixed_Array::check_validity (void)
118 if (this->compare (this->in_
, this->inout_
) &&
119 this->compare (this->in_
, this->out_
) &&
120 this->compare (this->in_
, this->ret_
.in ()))
127 Test_Fixed_Array::check_validity (CORBA::Request_ptr
/*req*/)
129 //ACE_UNUSED_ARG (req);
130 return this->check_validity ();
134 Test_Fixed_Array::compare (const Param_Test::Fixed_Array_slice
*a1
,
135 const Param_Test::Fixed_Array_slice
*a2
)
137 for (CORBA::ULong i
=0; i
< Param_Test::DIM1
; i
++)
146 Test_Fixed_Array::print_values (void)
148 ACE_DEBUG ((LM_DEBUG
, "IN array\n"));
149 this->print (this->in_
);
150 ACE_DEBUG ((LM_DEBUG
, "INOUT array\n"));
151 this->print (this->inout_
);
152 ACE_DEBUG ((LM_DEBUG
, "OUT array\n"));
153 this->print (this->out_
);
154 ACE_DEBUG ((LM_DEBUG
, "RET array\n"));
155 this->print (this->ret_
.in ());
159 Test_Fixed_Array::print (const Param_Test::Fixed_Array_slice
*a
)
161 for (CORBA::ULong i
= 0; i
< Param_Test::DIM1
; i
++)
163 ACE_DEBUG ((LM_DEBUG
, "\t\tElement #%d = %d\n",i
, a
[i
]));