diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-05-11 23:18:15 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-05-11 23:18:15 +0000 |
commit | d198b25fd2780b310dbfbbbacd0c7eb353d53493 (patch) | |
tree | 75484ea59adbef7359ca5d91146a9704d04158ee /TAO/tests | |
parent | 88fbbbcec97a68d0383b5d09285fb1f8bba192c2 (diff) | |
download | ATCD-d198b25fd2780b310dbfbbbacd0c7eb353d53493.tar.gz |
ChangeLogTag:Mon May 11 18:11:03 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
Diffstat (limited to 'TAO/tests')
-rw-r--r-- | TAO/tests/Param_Test/README | 9 | ||||
-rw-r--r-- | TAO/tests/Param_Test/driver.cpp | 110 | ||||
-rw-r--r-- | TAO/tests/Param_Test/options.cpp | 16 | ||||
-rw-r--r-- | TAO/tests/Param_Test/options.h | 10 | ||||
-rw-r--r-- | TAO/tests/Param_Test/param_test.idl | 20 | ||||
-rw-r--r-- | TAO/tests/Param_Test/param_test_i.cpp | 56 | ||||
-rw-r--r-- | TAO/tests/Param_Test/param_test_i.h | 18 | ||||
-rw-r--r-- | TAO/tests/Param_Test/tests.cpp | 1605 | ||||
-rw-r--r-- | TAO/tests/Param_Test/tests.h | 488 |
9 files changed, 2331 insertions, 1 deletions
diff --git a/TAO/tests/Param_Test/README b/TAO/tests/Param_Test/README index d20b7ff7bb4..8ceaa11b0cf 100644 --- a/TAO/tests/Param_Test/README +++ b/TAO/tests/Param_Test/README @@ -54,10 +54,19 @@ To run the client, type ubstring for unbounded string fixed_struct for fixed sized structs strseq for sequences of strings + bounded_strseq for bounded sequences of strings var_struct for variable structs nested_struct for nested structs struct_seq for sequences of structs + bounded_struct_seq for bounded sequences of structs + any for Any objref for object references + objref_sequence for sequences object references + any_sequence for sequences of Any + short_sequence for sequences of shorts + long_sequence for sequences of shorts + bounded_short_sequence for bounded sequences of shorts + bounded_long_sequence for bounded sequences of shorts There are 2 options of giving the Param_obj-ref-key i.e IOR to the client: diff --git a/TAO/tests/Param_Test/driver.cpp b/TAO/tests/Param_Test/driver.cpp index 6226d305378..4035db148e6 100644 --- a/TAO/tests/Param_Test/driver.cpp +++ b/TAO/tests/Param_Test/driver.cpp @@ -172,6 +172,19 @@ Driver::run (void) delete client; } break; + case Options::TEST_BOUNDED_STRING_SEQUENCE: + { + Param_Test_Client<Test_Bounded_String_Sequence> *client = new + Param_Test_Client<Test_Bounded_String_Sequence> (this->orb_ptr_, + this->objref_.in(), + new Test_Bounded_String_Sequence); + if (opt->invoke_type () == Options::SII) + retstatus = client->run_sii_test (); + else + retstatus = client->run_dii_test (); + delete client; + } + break; case Options::TEST_VAR_STRUCT: { Param_Test_Client<Test_Var_Struct> *client = new @@ -211,6 +224,19 @@ Driver::run (void) delete client; } break; + case Options::TEST_BOUNDED_STRUCT_SEQUENCE: + { + Param_Test_Client<Test_Bounded_Struct_Sequence> *client = new + Param_Test_Client<Test_Bounded_Struct_Sequence> (this->orb_ptr_, + this->objref_.in(), + new Test_Bounded_Struct_Sequence); + if (opt->invoke_type () == Options::SII) + retstatus = client->run_sii_test (); + else + retstatus = client->run_dii_test (); + delete client; + } + break; case Options::TEST_OBJREF: { Param_Test_Client<Test_ObjRef> *client = new @@ -250,6 +276,84 @@ Driver::run (void) delete client; } break; + case Options::TEST_OBJREF_SEQUENCE: + { + Param_Test_Client<Test_ObjRef_Sequence> *client = new + Param_Test_Client<Test_ObjRef_Sequence> (this->orb_ptr_, + this->objref_.in(), + new Test_ObjRef_Sequence); + if (opt->invoke_type () == Options::SII) + retstatus = client->run_sii_test (); + else + retstatus = client->run_dii_test (); + delete client; + } + break; + case Options::TEST_ANYSEQ: + { + Param_Test_Client<Test_AnySeq> *client = new + Param_Test_Client<Test_AnySeq> (this->orb_ptr_, + this->objref_.in(), + new Test_AnySeq); + if (opt->invoke_type () == Options::SII) + retstatus = client->run_sii_test (); + else + retstatus = client->run_dii_test (); + delete client; + } + break; + case Options::TEST_SHORTSEQ: + { + Param_Test_Client<Test_Short_Sequence> *client = new + Param_Test_Client<Test_Short_Sequence> (this->orb_ptr_, + this->objref_.in(), + new Test_Short_Sequence); + if (opt->invoke_type () == Options::SII) + retstatus = client->run_sii_test (); + else + retstatus = client->run_dii_test (); + delete client; + } + break; + case Options::TEST_BOUNDED_SHORTSEQ: + { + Param_Test_Client<Test_Bounded_Short_Sequence> *client = new + Param_Test_Client<Test_Bounded_Short_Sequence> (this->orb_ptr_, + this->objref_.in(), + new Test_Bounded_Short_Sequence); + if (opt->invoke_type () == Options::SII) + retstatus = client->run_sii_test (); + else + retstatus = client->run_dii_test (); + delete client; + } + break; + case Options::TEST_LONGSEQ: + { + Param_Test_Client<Test_Long_Sequence> *client = new + Param_Test_Client<Test_Long_Sequence> (this->orb_ptr_, + this->objref_.in(), + new Test_Long_Sequence); + if (opt->invoke_type () == Options::SII) + retstatus = client->run_sii_test (); + else + retstatus = client->run_dii_test (); + delete client; + } + break; + case Options::TEST_BOUNDED_LONGSEQ: + { + Param_Test_Client<Test_Bounded_Long_Sequence> *client = new + Param_Test_Client<Test_Bounded_Long_Sequence> (this->orb_ptr_, + this->objref_.in(), + new Test_Bounded_Long_Sequence); + if (opt->invoke_type () == Options::SII) + retstatus = client->run_sii_test (); + else + retstatus = client->run_dii_test (); + delete client; + } + break; default: break; } @@ -262,22 +366,28 @@ template class Param_Test_Client<Test_Short>; template class Param_Test_Client<Test_Unbounded_String>; template class Param_Test_Client<Test_Fixed_Struct>; template class Param_Test_Client<Test_String_Sequence>; +template class Param_Test_Client<Test_Bounded_String_Sequence>; template class Param_Test_Client<Test_Var_Struct>; template class Param_Test_Client<Test_Nested_Struct>; template class Param_Test_Client<Test_Struct_Sequence>; +template class Param_Test_Client<Test_Bounded_Struct_Sequence>; template class Param_Test_Client<Test_ObjRef>; template class Param_Test_Client<Test_TypeCode>; template class Param_Test_Client<Test_Any>; +template class Param_Test_Client<Test_Short_Sequence>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Singleton<Driver, ACE_SYNCH_RECURSIVE_MUTEX> #pragma instantiate Param_Test_Client<Test_Short> #pragma instantiate Param_Test_Client<Test_Unbounded_String> #pragma instantiate Param_Test_Client<Test_Fixed_Struct> #pragma instantiate Param_Test_Client<Test_String_Sequence> +#pragma instantiate Param_Test_Client<Test_Bounded_String_Sequence>; #pragma instantiate Param_Test_Client<Test_Var_Struct> #pragma instantiate Param_Test_Client<Test_Nested_Struct> #pragma instantiate Param_Test_Client<Test_Struct_Sequence> +#pragma instantiate Param_Test_Client<Test_Struct_Sequence> #pragma instantiate Param_Test_Client<Test_ObjRef> #pragma instantiate Param_Test_Client<Test_TypeCode> #pragma instantiate Param_Test_Client<Test_Any> +#pragma instantiate Param_Test_Client<Test_Short_Sequence> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/tests/Param_Test/options.cpp b/TAO/tests/Param_Test/options.cpp index d0b3c47a103..c942c650ab8 100644 --- a/TAO/tests/Param_Test/options.cpp +++ b/TAO/tests/Param_Test/options.cpp @@ -91,18 +91,34 @@ Options::parse_args (int argc, char **argv) this->test_type_ = Options::TEST_FIXED_STRUCT; else if (!ACE_OS::strcmp (get_opts.optarg, "strseq")) this->test_type_ = Options::TEST_STRING_SEQUENCE; + else if (!ACE_OS::strcmp (get_opts.optarg, "bounded_strseq")) + this->test_type_ = Options::TEST_BOUNDED_STRING_SEQUENCE; else if (!ACE_OS::strcmp (get_opts.optarg, "var_struct")) this->test_type_ = Options::TEST_VAR_STRUCT; else if (!ACE_OS::strcmp (get_opts.optarg, "nested_struct")) this->test_type_ = Options::TEST_NESTED_STRUCT; else if (!ACE_OS::strcmp (get_opts.optarg, "struct_seq")) this->test_type_ = Options::TEST_STRUCT_SEQUENCE; + else if (!ACE_OS::strcmp (get_opts.optarg, "bounded_struct_seq")) + this->test_type_ = Options::TEST_BOUNDED_STRUCT_SEQUENCE; else if (!ACE_OS::strcmp (get_opts.optarg, "objref")) this->test_type_ = Options::TEST_OBJREF; else if (!ACE_OS::strcmp (get_opts.optarg, "typecode")) this->test_type_ = Options::TEST_TYPECODE; else if (!ACE_OS::strcmp (get_opts.optarg, "any")) this->test_type_ = Options::TEST_ANY; + else if (!ACE_OS::strcmp (get_opts.optarg, "objref_sequence")) + this->test_type_ = Options::TEST_OBJREF_SEQUENCE; + else if (!ACE_OS::strcmp (get_opts.optarg, "any_sequence")) + this->test_type_ = Options::TEST_ANYSEQ; + else if (!ACE_OS::strcmp (get_opts.optarg, "short_sequence")) + this->test_type_ = Options::TEST_SHORTSEQ; + else if (!ACE_OS::strcmp (get_opts.optarg, "bounded_short_sequence")) + this->test_type_ = Options::TEST_BOUNDED_SHORTSEQ; + else if (!ACE_OS::strcmp (get_opts.optarg, "long_sequence")) + this->test_type_ = Options::TEST_LONGSEQ; + else if (!ACE_OS::strcmp (get_opts.optarg, "bounded_long_sequence")) + this->test_type_ = Options::TEST_BOUNDED_LONGSEQ; break; case '?': default: diff --git a/TAO/tests/Param_Test/options.h b/TAO/tests/Param_Test/options.h index c8ed12be068..6bae30fbaa5 100644 --- a/TAO/tests/Param_Test/options.h +++ b/TAO/tests/Param_Test/options.h @@ -33,12 +33,20 @@ public: TEST_UNBOUNDED_STRING, TEST_FIXED_STRUCT, TEST_STRING_SEQUENCE, + TEST_BOUNDED_STRING_SEQUENCE, TEST_VAR_STRUCT, TEST_NESTED_STRUCT, TEST_STRUCT_SEQUENCE, + TEST_BOUNDED_STRUCT_SEQUENCE, TEST_OBJREF, TEST_TYPECODE, - TEST_ANY + TEST_ANY, + TEST_OBJREF_SEQUENCE, + TEST_ANYSEQ, + TEST_SHORTSEQ, + TEST_BOUNDED_SHORTSEQ, + TEST_LONGSEQ, + TEST_BOUNDED_LONGSEQ }; enum INVOKE_TYPE diff --git a/TAO/tests/Param_Test/param_test.idl b/TAO/tests/Param_Test/param_test.idl index 1f447016259..5eee547e4fd 100644 --- a/TAO/tests/Param_Test/param_test.idl +++ b/TAO/tests/Param_Test/param_test.idl @@ -63,6 +63,16 @@ interface Param_Test // = Sequences of long, strings, Var_Struct and Object // references... + typedef sequence<short> Short_Seq; + Short_Seq test_short_sequence (in Short_Seq s1, + inout Short_Seq s2, + out Short_Seq s3); + + typedef sequence<short,32> Bounded_Short_Seq; + Bounded_Short_Seq test_bounded_short_sequence (in Bounded_Short_Seq s1, + inout Bounded_Short_Seq s2, + out Bounded_Short_Seq s3); + typedef sequence<long> Long_Seq; Long_Seq test_long_sequence (in Long_Seq s1, inout Long_Seq s2, @@ -103,6 +113,16 @@ interface Param_Test inout Bounded_Coffee_Mix s2, out Bounded_Coffee_Mix s3); + typedef sequence<any> AnySeq; + AnySeq test_anyseq (in AnySeq s1, + inout AnySeq s2, + out AnySeq s3); + +/* typedef sequence<any, 32> Bounded_AnySeq; + Bounded_AnySeq test_bounded_anyseq (in Bounded_AnySeq s1, + inout Bounded_AnySeq s2, + out Bounded_AnySeq s3); +*/ typedef string DUMMY; // variable structures diff --git a/TAO/tests/Param_Test/param_test_i.cpp b/TAO/tests/Param_Test/param_test_i.cpp index 9b4ee3c1cbb..4bcff56c02e 100644 --- a/TAO/tests/Param_Test/param_test_i.cpp +++ b/TAO/tests/Param_Test/param_test_i.cpp @@ -129,6 +129,42 @@ Param_Test::Long_Seq * Param_Test_i::test_long_sequence ( return ret; } +Param_Test::Short_Seq * Param_Test_i::test_short_sequence ( + const Param_Test::Short_Seq & s1, + Param_Test::Short_Seq & s2, + Param_Test::Short_Seq_out s3, + CORBA::Environment & + ) +{ + Param_Test::Short_Seq + *ret = new Param_Test::Short_Seq, + *out = new Param_Test::Short_Seq; + + s2 = s1; + *out = s1; + *ret = s1; + s3 = out; + return ret; +} + +Param_Test::Bounded_Short_Seq * Param_Test_i::test_bounded_short_sequence ( + const Param_Test::Bounded_Short_Seq & s1, + Param_Test::Bounded_Short_Seq & s2, + Param_Test::Bounded_Short_Seq_out s3, + CORBA::Environment & + ) +{ + Param_Test::Bounded_Short_Seq + *ret = new Param_Test::Bounded_Short_Seq, + *out = new Param_Test::Bounded_Short_Seq; + + s2 = s1; + *out = s1; + *ret = s1; + s3 = out; + return ret; +} + Param_Test::Bounded_Long_Seq * Param_Test_i::test_bounded_long_sequence ( const Param_Test::Bounded_Long_Seq & s1, Param_Test::Bounded_Long_Seq & s2, @@ -265,6 +301,26 @@ Param_Test::Bounded_Coffee_Mix * Param_Test_i::test_bounded_coffe_mix ( return ret; } +Param_Test::AnySeq * +Param_Test_i::test_anyseq (const Param_Test::AnySeq &s1, + Param_Test::AnySeq &s2, + Param_Test::AnySeq_out s3, + CORBA::Environment &env) +{ + ACE_UNUSED_ARG (env); + // we copy the "in" sequences into all the inout, out and return sequences. + + Param_Test::AnySeq + *ret = new Param_Test::AnySeq, + *out = new Param_Test::AnySeq; + + // now copy all elements of s1 into the others using the assignment operator + s2 = s1; + *out = s1; + *ret = s1; + s3 = out; + return ret; +} // = end of sequences... diff --git a/TAO/tests/Param_Test/param_test_i.h b/TAO/tests/Param_Test/param_test_i.h index f3a6cf2615d..6d6987b86df 100644 --- a/TAO/tests/Param_Test/param_test_i.h +++ b/TAO/tests/Param_Test/param_test_i.h @@ -90,6 +90,18 @@ public: Param_Test::Bounded_Long_Seq_out s3, CORBA::Environment &env ); + virtual Param_Test::Short_Seq * test_short_sequence ( + const Param_Test::Short_Seq & s1, + Param_Test::Short_Seq & s2, + Param_Test::Short_Seq_out s3, + CORBA::Environment &env + ); + virtual Param_Test::Bounded_Short_Seq * test_bounded_short_sequence ( + const Param_Test::Bounded_Short_Seq & s1, + Param_Test::Bounded_Short_Seq & s2, + Param_Test::Bounded_Short_Seq_out s3, + CORBA::Environment &env + ); virtual Param_Test::StrSeq * test_strseq ( const Param_Test::StrSeq & s1, Param_Test::StrSeq & s2, @@ -126,6 +138,12 @@ public: Param_Test::Bounded_Coffee_Mix_out s3, CORBA::Environment &env ); + virtual Param_Test::AnySeq * test_anyseq ( + const Param_Test::AnySeq & s1, + Param_Test::AnySeq & s2, + Param_Test::AnySeq_out s3, + CORBA::Environment &env + ); // = End of sequences tests.... virtual Param_Test::Var_Struct * diff --git a/TAO/tests/Param_Test/tests.cpp b/TAO/tests/Param_Test/tests.cpp index 2ae869f50c4..480382ba890 100644 --- a/TAO/tests/Param_Test/tests.cpp +++ b/TAO/tests/Param_Test/tests.cpp @@ -670,6 +670,195 @@ Test_String_Sequence::print_values (void) } // ************************************************************************ +// Test_Bounded_String_Sequence +// ************************************************************************ + +Test_Bounded_String_Sequence::Test_Bounded_String_Sequence (void) + : opname_ (CORBA::string_dup ("test_bounded_strseq")), + in_ (new Param_Test::Bounded_StrSeq), + inout_ (new Param_Test::Bounded_StrSeq), + out_ (0), + ret_ (0) +{ +} + +Test_Bounded_String_Sequence::~Test_Bounded_String_Sequence (void) +{ +} + +const char * +Test_Bounded_String_Sequence::opname (void) const +{ + return this->opname_; +} + +int +Test_Bounded_String_Sequence::init_parameters (Param_Test_ptr objref, + CORBA::Environment &env) +{ + Generator *gen = GENERATOR::instance (); // value generator + + ACE_UNUSED_ARG (objref); + ACE_UNUSED_ARG (env); + + const char *choiceList[] = + { + "one", + "two", + "three" + }; + + CORBA::ULong len = this->in_->maximum (); + + // set the length of the sequence + this->in_->length (len); + // now set each individual element + for (CORBA::ULong i=0; i < this->in_->length (); i++) + { + // generate some arbitrary string to be filled into the ith location in + // the sequence + // char *str = gen->gen_string (); + //this->in_[i] = str; + this->in_[i] = choiceList[i]; + + } + return 0; +} + +int +Test_Bounded_String_Sequence::reset_parameters (void) +{ + this->inout_ = new Param_Test::Bounded_StrSeq; // delete the previous one + this->out_ = 0; + this->ret_ = 0; + return 0; +} + +int +Test_Bounded_String_Sequence::run_sii_test (Param_Test_ptr objref, + CORBA::Environment &env) +{ + Param_Test::Bounded_StrSeq_out out (this->out_.out ()); + this->ret_ = objref->test_bounded_strseq (this->in_.in (), + this->inout_.inout (), + out, + env); + return (env.exception () ? -1:0); +} + +int +Test_Bounded_String_Sequence::add_args (CORBA::NVList_ptr ¶m_list, + CORBA::NVList_ptr &retval, + CORBA::Environment &env) +{ + CORBA::Any in_arg (Param_Test::_tc_Bounded_StrSeq, (void *) &this->in_.in (), 0); + CORBA::Any inout_arg (Param_Test::_tc_Bounded_StrSeq, &this->inout_.inout (), 0); + // ORB will allocate + CORBA::Any out_arg (Param_Test::_tc_Bounded_StrSeq, 0, 0); + + // add parameters + (void)param_list->add_value ("s1", in_arg, CORBA::ARG_IN, env); + (void)param_list->add_value ("s2", inout_arg, CORBA::ARG_INOUT, env); + (void)param_list->add_value ("s3", out_arg, CORBA::ARG_OUT, env); + + // add return value type + (void)retval->item (0, env)->value ()->replace (Param_Test::_tc_Bounded_StrSeq, + 0, + 0, // does not own + env); + return 0; +} + +CORBA::Boolean +Test_Bounded_String_Sequence::check_validity (void) +{ + CORBA::Boolean flag = 0; + if ((this->in_->length () == this->inout_->length ()) && + (this->in_->length () == this->out_->length ()) && + (this->in_->length () == this->ret_->length ())) + { + flag = 1; // assume all are equal + // lengths are same. Now compare the contents + for (CORBA::ULong i=0; i < this->in_->length () && flag; i++) + { + if (ACE_OS::strcmp (this->in_[i], this->inout_[i]) || + ACE_OS::strcmp (this->in_[i], this->out_[i]) || + ACE_OS::strcmp (this->in_[i], this->ret_[i])) + // not equal + flag = 0; + } + } + return flag; +} + +CORBA::Boolean +Test_Bounded_String_Sequence::check_validity (CORBA::Request_ptr req) +{ + CORBA::Environment env; + + Param_Test::Bounded_StrSeq *out, *ret; + + *req->arguments ()->item (2, env)->value () >>= out; + *req->result ()->value () >>= ret; + + this->out_ = out; + this->ret_ = ret; + + return this->check_validity (); +} + +void +Test_Bounded_String_Sequence::print_values (void) +{ + CORBA::ULong i; + ACE_DEBUG ((LM_DEBUG, "\n*=*=*=*=*=*=*=*=*=*=\n")); + for (i=0; this->in_.ptr () && (i < this->in_->length ()); i++) + { + ACE_DEBUG ((LM_DEBUG, + "Element #%d\n" + "in : %s\n", + i, + this->in_[i]? (const char *)this->in_[i]:"<nul>")); + } + if (!this->in_.ptr ()) + ACE_DEBUG ((LM_DEBUG, "\nin sequence is NUL\n")); + ACE_DEBUG ((LM_DEBUG, "\n*=*=*=*=*=*=*=*=*=*=\n")); + for (i=0; this->inout_.ptr () && (i < this->inout_->length ()); i++) + { + ACE_DEBUG ((LM_DEBUG, + "Element #%d\n" + "in : %s\n", + i, + (this->inout_[i]? (const char *)this->inout_[i]:"<nul>"))); + } + if (!this->inout_.ptr ()) + ACE_DEBUG ((LM_DEBUG, "\ninout sequence is NUL\n")); + ACE_DEBUG ((LM_DEBUG, "\n*=*=*=*=*=*=*=*=*=*=\n")); + for (i=0; this->out_.ptr () && (i < this->out_->length ()); i++) + { + ACE_DEBUG ((LM_DEBUG, + "Element #%d\n" + "in : %s\n", + i, + (this->out_[i]? (const char *)this->out_[i]:"<nul>"))); + } + if (!this->out_.ptr ()) + ACE_DEBUG ((LM_DEBUG, "\nout sequence is NUL\n")); + ACE_DEBUG ((LM_DEBUG, "\n*=*=*=*=*=*=*=*=*=*=\n")); + for (i=0; this->ret_.ptr () && (i < this->ret_->length ()); i++) + { + ACE_DEBUG ((LM_DEBUG, + "Element #%d\n" + "in : %s\n", + i, + (this->ret_[i]? (const char *)this->ret_[i]:"<nul>"))); + } + if (!this->ret_.ptr ()) + ACE_DEBUG ((LM_DEBUG, "\nin sequence is NUL\n")); + ACE_DEBUG ((LM_DEBUG, "\n*=*=*=*=*=*=*=*=*=*=\n")); +} + +// ************************************************************************ // Test_Var_Struct // ************************************************************************ @@ -1221,6 +1410,198 @@ Test_Struct_Sequence::print_sequence (const Param_Test::StructSeq &s) } // ************************************************************************ +// Test_Bounded_Struct_Sequence +// ************************************************************************ + +Test_Bounded_Struct_Sequence::Test_Bounded_Struct_Sequence (void) + : opname_ (CORBA::string_dup ("test_bounded_struct_sequence")), + inout_ (new Param_Test::Bounded_StructSeq), + out_ (0), + ret_ (0) +{ +} + +Test_Bounded_Struct_Sequence::~Test_Bounded_Struct_Sequence (void) +{ + CORBA::string_free (this->opname_); + // the other data members will be freed as they are "_var"s and objects + // (rather than pointers to objects) +} + +const char * +Test_Bounded_Struct_Sequence::opname (void) const +{ + return this->opname_; +} + +int +Test_Bounded_Struct_Sequence::init_parameters (Param_Test_ptr objref, + CORBA::Environment &env) +{ + Generator *gen = GENERATOR::instance (); // value generator + + ACE_UNUSED_ARG (objref); + ACE_UNUSED_ARG (env); + + // get some sequence length (not more than 10) + CORBA::ULong len = this->in_.maximum (); + + // set the length of the sequence + this->in_.length (len); + // now set each individual element + for (CORBA::ULong i = 0; i < this->in_.length (); i++) + { + // generate some arbitrary string to be filled into the ith location in + // the sequence + this->in_[i] = gen->gen_fixed_struct (); + } + return 0; +} + +int +Test_Bounded_Struct_Sequence::reset_parameters (void) +{ + this->inout_ = new Param_Test::Bounded_StructSeq; // delete the previous one + this->out_ = 0; + this->ret_ = 0; + return 0; +} + +int +Test_Bounded_Struct_Sequence::run_sii_test (Param_Test_ptr objref, + CORBA::Environment &env) +{ + Param_Test::Bounded_StructSeq_out out (this->out_.out ()); + this->ret_ = objref->test_bounded_struct_sequence (this->in_, + this->inout_.inout (), + out, + env); + return (env.exception () ? -1:0); +} + +int +Test_Bounded_Struct_Sequence::add_args (CORBA::NVList_ptr ¶m_list, + CORBA::NVList_ptr &retval, + CORBA::Environment &env) +{ + CORBA::Any in_arg (Param_Test::_tc_Bounded_StructSeq, (void *) &this->in_, 0); + CORBA::Any inout_arg (Param_Test::_tc_Bounded_StructSeq, &this->inout_.inout (), 0); + CORBA::Any out_arg (Param_Test::_tc_Bounded_StructSeq, this->out_.out (), 0); + + // add parameters + (void)param_list->add_value ("s1", in_arg, CORBA::ARG_IN, env); + (void)param_list->add_value ("s2", inout_arg, CORBA::ARG_INOUT, env); + (void)param_list->add_value ("s3", out_arg, CORBA::ARG_OUT, env); + + // add return value + (void)retval->item (0, env)->value ()->replace (Param_Test::_tc_Bounded_StructSeq, + &this->ret_, + 0, // does not own + env); + return 0; +} + +CORBA::Boolean +Test_Bounded_Struct_Sequence::check_validity (void) +{ + if (this->compare (this->in_, this->inout_.in ()) && + this->compare (this->in_, this->out_.in ()) && + this->compare (this->in_, this->ret_.in ())) + return 1; + else + return 0; +} + +CORBA::Boolean +Test_Bounded_Struct_Sequence::check_validity (CORBA::Request_ptr req) +{ + CORBA::Environment env; + this->inout_ = new Param_Test::Bounded_StructSeq (*(Param_Test::Bounded_StructSeq *) + req->arguments ()->item + (1, env)->value ()->value ()); + this->out_ = new Param_Test::Bounded_StructSeq (*(Param_Test::Bounded_StructSeq *) req->arguments + ()->item (2, env)->value ()->value ()); + this->ret_ = new Param_Test::Bounded_StructSeq (*(Param_Test::Bounded_StructSeq *)req->result + ()->value ()->value ()); + return this->check_validity (); +} + +void +Test_Bounded_Struct_Sequence::print_values (void) +{ + ACE_DEBUG ((LM_DEBUG, + "*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*\n" + "IN sequence\n")); + this->print_sequence (this->in_); + ACE_DEBUG ((LM_DEBUG, + "*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*\n" + "INOUT sequence\n")); + this->print_sequence (this->inout_.in ()); + ACE_DEBUG ((LM_DEBUG, + "*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*\n" + "OUT sequence\n")); + this->print_sequence (this->out_.in ()); + ACE_DEBUG ((LM_DEBUG, + "*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*\n" + "RET sequence\n")); + this->print_sequence (this->ret_.in ()); +} + +CORBA::Boolean +Test_Bounded_Struct_Sequence::compare (const Param_Test::Bounded_StructSeq &s1, + const Param_Test::Bounded_StructSeq &s2) +{ + if (s1.maximum () != s2.maximum ()) + return 0; + if (s1.length () != s2.length ()) + return 0; + + for (CORBA::ULong i=0; i < s1.length (); i++) + { + const Param_Test::Fixed_Struct& vs1 = s1[i]; + const Param_Test::Fixed_Struct& vs2 = s2[i]; + + if (vs1.l != vs2.l + || vs1.c != vs2.c + || vs1.s != vs2.s + || vs1.o != vs2.o + || vs1.f != vs2.f + || vs1.b != vs2.b + || vs1.d != vs2.d ) + return 0; + } + + return 1; // success +} + +void +Test_Bounded_Struct_Sequence::print_sequence (const Param_Test::Bounded_StructSeq &s) +{ + ACE_DEBUG ((LM_DEBUG, + "maximum = %d\n" + "length = %d\n", + s.maximum (), + s.length ())); + ACE_DEBUG ((LM_DEBUG, "Elements -\n")); + for (CORBA::ULong i=0; i < s.length (); i++) + { + const Param_Test::Fixed_Struct& vs = s[i]; + + ACE_DEBUG ((LM_DEBUG, + "Element #%d\n" + "\tl = %d\n" + "\tc = %c\n" + "\ts = %d\n" + "\to = %x\n" + "\tf = %f\n" + "\tb = %d\n" + "\td = %f\n", + i, + vs.l, vs.c, vs.s, vs.o, vs.f, vs.b, vs.d)); + } +} + +// ************************************************************************ // Test_ObjRef // ************************************************************************ @@ -1778,3 +2159,1227 @@ void Test_Any::print_values (void) { } + +// ************************************************************************ +// Test_Short_Sequence +// ************************************************************************ + +Test_Short_Sequence::Test_Short_Sequence (void) + : opname_ (CORBA::string_dup ("test_shortseq")), + in_ (new Param_Test::Short_Seq), + inout_ (new Param_Test::Short_Seq), + out_ (0), + ret_ (0) +{ +} + +Test_Short_Sequence::~Test_Short_Sequence (void) +{ +} + +const char * +Test_Short_Sequence::opname (void) const +{ + return this->opname_; +} + +int +Test_Short_Sequence::init_parameters (Param_Test_ptr objref, + CORBA::Environment &env) +{ + Generator *gen = GENERATOR::instance (); // value generator + + ACE_UNUSED_ARG (objref); + ACE_UNUSED_ARG (env); + + // get some sequence length (not more than 10) + CORBA::ULong len = (CORBA::ULong) (gen->gen_long () % 10) + 1; + + // set the length of the sequence + this->in_->length (len); + // now set each individual element + for (CORBA::Short i=0; i < this->in_->length (); i++) + { + // generate some arbitrary string to be filled into the ith location in + // the sequence + this->in_[i] = i; + + } + return 0; +} + +int +Test_Short_Sequence::reset_parameters (void) +{ + this->inout_ = new Param_Test::Short_Seq; // delete the previous one + this->out_ = 0; + this->ret_ = 0; + return 0; +} + +int +Test_Short_Sequence::run_sii_test (Param_Test_ptr objref, + CORBA::Environment &env) +{ + Param_Test::Short_Seq_out out (this->out_.out ()); + this->ret_ = objref->test_short_sequence (this->in_.in (), + this->inout_.inout (), + out, + env); + return (env.exception () ? -1:0); +} + +int +Test_Short_Sequence::add_args (CORBA::NVList_ptr ¶m_list, + CORBA::NVList_ptr &retval, + CORBA::Environment &env) +{ + CORBA::Any in_arg (Param_Test::_tc_Short_Seq, (void *) &this->in_.in (), 0); + CORBA::Any inout_arg (Param_Test::_tc_Short_Seq, &this->inout_.inout (), 0); + // ORB will allocate + CORBA::Any out_arg (Param_Test::_tc_Short_Seq, 0, 0); + + // add parameters + (void)param_list->add_value ("s1", in_arg, CORBA::ARG_IN, env); + (void)param_list->add_value ("s2", inout_arg, CORBA::ARG_INOUT, env); + (void)param_list->add_value ("s3", out_arg, CORBA::ARG_OUT, env); + + // add return value type + (void)retval->item (0, env)->value ()->replace (Param_Test::_tc_Short_Seq, + 0, + 0, // does not own + env); + return 0; +} + +CORBA::Boolean +Test_Short_Sequence::check_validity (void) +{ + CORBA::Boolean flag = 0; + if ((this->in_->length () == this->inout_->length ()) && + (this->in_->length () == this->out_->length ()) && + (this->in_->length () == this->ret_->length ())) + { + flag = 1; // assume all are equal + // lengths are same. Now compare the contents + for (CORBA::ULong i=0; i < this->in_->length () && flag; i++) + { + if ((this->in_[i] != this->inout_[i]) || + (this->in_[i] != this->out_[i]) || + (this->in_[i] != this->ret_[i])) + // not equal + flag = 0; + } + } + return flag; +} + +CORBA::Boolean +Test_Short_Sequence::check_validity (CORBA::Request_ptr req) +{ + CORBA::Environment env; + + Param_Test::Short_Seq *out, *ret; + + *req->arguments ()->item (2, env)->value () >>= out; + *req->result ()->value () >>= ret; + + this->out_ = out; + this->ret_ = ret; + + return this->check_validity (); +} + +void +Test_Short_Sequence::print_values (void) +{ + CORBA::ULong i; + ACE_DEBUG ((LM_DEBUG, "\n*=*=*=*=*=*=*=*=*=*=\n")); + for (i=0; this->in_.ptr () && (i < this->in_->length ()); i++) + { + ACE_DEBUG ((LM_DEBUG, + "Element #%d\n" + "in : %s\n", + i, + this->in_[i]? (const char *)this->in_[i]:"<nul>")); + } + if (!this->in_.ptr ()) + ACE_DEBUG ((LM_DEBUG, "\nin sequence is NUL\n")); + ACE_DEBUG ((LM_DEBUG, "\n*=*=*=*=*=*=*=*=*=*=\n")); + for (i=0; this->inout_.ptr () && (i < this->inout_->length ()); i++) + { + ACE_DEBUG ((LM_DEBUG, + "Element #%d\n" + "in : %s\n", + i, + (this->inout_[i]? (const char *)this->inout_[i]:"<nul>"))); + } + if (!this->inout_.ptr ()) + ACE_DEBUG ((LM_DEBUG, "\ninout sequence is NUL\n")); + ACE_DEBUG ((LM_DEBUG, "\n*=*=*=*=*=*=*=*=*=*=\n")); + for (i=0; this->out_.ptr () && (i < this->out_->length ()); i++) + { + ACE_DEBUG ((LM_DEBUG, + "Element #%d\n" + "in : %s\n", + i, + (this->out_[i]? (const char *)this->out_[i]:"<nul>"))); + } + if (!this->out_.ptr ()) + ACE_DEBUG ((LM_DEBUG, "\nout sequence is NUL\n")); + ACE_DEBUG ((LM_DEBUG, "\n*=*=*=*=*=*=*=*=*=*=\n")); + for (i=0; this->ret_.ptr () && (i < this->ret_->length ()); i++) + { + ACE_DEBUG ((LM_DEBUG, + "Element #%d\n" + "in : %s\n", + i, + (this->ret_[i]? (const char *)this->ret_[i]:"<nul>"))); + } + if (!this->ret_.ptr ()) + ACE_DEBUG ((LM_DEBUG, "\nin sequence is NUL\n")); + ACE_DEBUG ((LM_DEBUG, "\n*=*=*=*=*=*=*=*=*=*=\n")); +} + +// ************************************************************************ +// Test_Bounded_Short_Sequence +// ************************************************************************ + +Test_Bounded_Short_Sequence::Test_Bounded_Short_Sequence (void) + : opname_ (CORBA::string_dup ("test_bounded_shortseq")), + in_ (new Param_Test::Bounded_Short_Seq), + inout_ (new Param_Test::Bounded_Short_Seq), + out_ (0), + ret_ (0) +{ +} + +Test_Bounded_Short_Sequence::~Test_Bounded_Short_Sequence (void) +{ +} + +const char * +Test_Bounded_Short_Sequence::opname (void) const +{ + return this->opname_; +} + +int +Test_Bounded_Short_Sequence::init_parameters (Param_Test_ptr objref, + CORBA::Environment &env) +{ + Generator *gen = GENERATOR::instance (); // value generator + + ACE_UNUSED_ARG (objref); + ACE_UNUSED_ARG (env); + + // get some sequence length (not more than 10) + CORBA::ULong len = this->in_->maximum (); + + // set the length of the sequence + this->in_->length (len); + // now set each individual element + for (CORBA::Short i=0; i < this->in_->maximum (); i++) + { + // generate some arbitrary string to be filled into the ith location in + // the sequence + this->in_[i] = i; + + } + return 0; +} + +int +Test_Bounded_Short_Sequence::reset_parameters (void) +{ + this->inout_ = new Param_Test::Bounded_Short_Seq; // delete the previous one + this->out_ = 0; + this->ret_ = 0; + return 0; +} + +int +Test_Bounded_Short_Sequence::run_sii_test (Param_Test_ptr objref, + CORBA::Environment &env) +{ + Param_Test::Bounded_Short_Seq_out out (this->out_.out ()); + this->ret_ = objref->test_bounded_short_sequence (this->in_.in (), + this->inout_.inout (), + out, + env); + return (env.exception () ? -1:0); +} + +int +Test_Bounded_Short_Sequence::add_args (CORBA::NVList_ptr ¶m_list, + CORBA::NVList_ptr &retval, + CORBA::Environment &env) +{ + CORBA::Any in_arg (Param_Test::_tc_Bounded_Short_Seq, (void *) &this->in_.in (), 0); + CORBA::Any inout_arg (Param_Test::_tc_Bounded_Short_Seq, &this->inout_.inout (), 0); + // ORB will allocate + CORBA::Any out_arg (Param_Test::_tc_Bounded_Short_Seq, 0, 0); + + // add parameters + (void)param_list->add_value ("s1", in_arg, CORBA::ARG_IN, env); + (void)param_list->add_value ("s2", inout_arg, CORBA::ARG_INOUT, env); + (void)param_list->add_value ("s3", out_arg, CORBA::ARG_OUT, env); + + // add return value type + (void)retval->item (0, env)->value ()->replace (Param_Test::_tc_Bounded_Short_Seq, + 0, + 0, // does not own + env); + return 0; +} + +CORBA::Boolean +Test_Bounded_Short_Sequence::check_validity (void) +{ + CORBA::Boolean flag = 0; + if ((this->in_->length () == this->inout_->length ()) && + (this->in_->length () == this->out_->length ()) && + (this->in_->length () == this->ret_->length ())) + { + flag = 1; // assume all are equal + // lengths are same. Now compare the contents + for (CORBA::ULong i=0; i < this->in_->length () && flag; i++) + { + if ((this->in_[i] != this->inout_[i]) || + (this->in_[i] != this->out_[i]) || + (this->in_[i] != this->ret_[i])) + // not equal + flag = 0; + } + } + return flag; +} + +CORBA::Boolean +Test_Bounded_Short_Sequence::check_validity (CORBA::Request_ptr req) +{ + CORBA::Environment env; + + Param_Test::Bounded_Short_Seq *out, *ret; + + *req->arguments ()->item (2, env)->value () >>= out; + *req->result ()->value () >>= ret; + + this->out_ = out; + this->ret_ = ret; + + return this->check_validity (); +} + +void +Test_Bounded_Short_Sequence::print_values (void) +{ + CORBA::ULong i; + ACE_DEBUG ((LM_DEBUG, "\n*=*=*=*=*=*=*=*=*=*=\n")); + for (i=0; this->in_.ptr () && (i < this->in_->length ()); i++) + { + ACE_DEBUG ((LM_DEBUG, + "Element #%d\n" + "in : %s\n", + i, + this->in_[i]? (const char *)this->in_[i]:"<nul>")); + } + if (!this->in_.ptr ()) + ACE_DEBUG ((LM_DEBUG, "\nin sequence is NUL\n")); + ACE_DEBUG ((LM_DEBUG, "\n*=*=*=*=*=*=*=*=*=*=\n")); + for (i=0; this->inout_.ptr () && (i < this->inout_->length ()); i++) + { + ACE_DEBUG ((LM_DEBUG, + "Element #%d\n" + "in : %s\n", + i, + (this->inout_[i]? (const char *)this->inout_[i]:"<nul>"))); + } + if (!this->inout_.ptr ()) + ACE_DEBUG ((LM_DEBUG, "\ninout sequence is NUL\n")); + ACE_DEBUG ((LM_DEBUG, "\n*=*=*=*=*=*=*=*=*=*=\n")); + for (i=0; this->out_.ptr () && (i < this->out_->length ()); i++) + { + ACE_DEBUG ((LM_DEBUG, + "Element #%d\n" + "in : %s\n", + i, + (this->out_[i]? (const char *)this->out_[i]:"<nul>"))); + } + if (!this->out_.ptr ()) + ACE_DEBUG ((LM_DEBUG, "\nout sequence is NUL\n")); + ACE_DEBUG ((LM_DEBUG, "\n*=*=*=*=*=*=*=*=*=*=\n")); + for (i=0; this->ret_.ptr () && (i < this->ret_->length ()); i++) + { + ACE_DEBUG ((LM_DEBUG, + "Element #%d\n" + "in : %s\n", + i, + (this->ret_[i]? (const char *)this->ret_[i]:"<nul>"))); + } + if (!this->ret_.ptr ()) + ACE_DEBUG ((LM_DEBUG, "\nin sequence is NUL\n")); + ACE_DEBUG ((LM_DEBUG, "\n*=*=*=*=*=*=*=*=*=*=\n")); +} + +// ************************************************************************ +// Test_Long_Sequence +// ************************************************************************ + +Test_Long_Sequence::Test_Long_Sequence (void) + : opname_ (CORBA::string_dup ("test_longseq")), + in_ (new Param_Test::Long_Seq), + inout_ (new Param_Test::Long_Seq), + out_ (0), + ret_ (0) +{ +} + +Test_Long_Sequence::~Test_Long_Sequence (void) +{ +} + +const char * +Test_Long_Sequence::opname (void) const +{ + return this->opname_; +} + +int +Test_Long_Sequence::init_parameters (Param_Test_ptr objref, + CORBA::Environment &env) +{ + Generator *gen = GENERATOR::instance (); // value generator + + ACE_UNUSED_ARG (objref); + ACE_UNUSED_ARG (env); + + // get some sequence length (not more than 10) + CORBA::ULong len = (CORBA::ULong) (gen->gen_long () % 10) + 1; + + // set the length of the sequence + this->in_->length (len); + // now set each individual element + for (CORBA::Long i=0; i < this->in_->length (); i++) + { + this->in_[i] = i; + } + return 0; +} + +int +Test_Long_Sequence::reset_parameters (void) +{ + this->inout_ = new Param_Test::Long_Seq; // delete the previous one + this->out_ = 0; + this->ret_ = 0; + return 0; +} + +int +Test_Long_Sequence::run_sii_test (Param_Test_ptr objref, + CORBA::Environment &env) +{ + Param_Test::Long_Seq_out out (this->out_.out ()); + this->ret_ = objref->test_long_sequence (this->in_.in (), + this->inout_.inout (), + out, + env); + return (env.exception () ? -1:0); +} + +int +Test_Long_Sequence::add_args (CORBA::NVList_ptr ¶m_list, + CORBA::NVList_ptr &retval, + CORBA::Environment &env) +{ + CORBA::Any in_arg (Param_Test::_tc_Long_Seq, (void *) &this->in_.in (), 0); + CORBA::Any inout_arg (Param_Test::_tc_Long_Seq, &this->inout_.inout (), 0); + // ORB will allocate + CORBA::Any out_arg (Param_Test::_tc_Long_Seq, 0, 0); + + // add parameters + (void)param_list->add_value ("s1", in_arg, CORBA::ARG_IN, env); + (void)param_list->add_value ("s2", inout_arg, CORBA::ARG_INOUT, env); + (void)param_list->add_value ("s3", out_arg, CORBA::ARG_OUT, env); + + // add return value type + (void)retval->item (0, env)->value ()->replace (Param_Test::_tc_Long_Seq, + 0, + 0, // does not own + env); + return 0; +} + +CORBA::Boolean +Test_Long_Sequence::check_validity (void) +{ + CORBA::Boolean flag = 0; + if ((this->in_->length () == this->inout_->length ()) && + (this->in_->length () == this->out_->length ()) && + (this->in_->length () == this->ret_->length ())) + { + flag = 1; // assume all are equal + // lengths are same. Now compare the contents + for (CORBA::ULong i=0; i < this->in_->length () && flag; i++) + { + if ((this->in_[i] != this->inout_[i]) || + (this->in_[i] != this->out_[i]) || + (this->in_[i] != this->ret_[i])) + // not equal + flag = 0; + } + } + return flag; +} + +CORBA::Boolean +Test_Long_Sequence::check_validity (CORBA::Request_ptr req) +{ + CORBA::Environment env; + + Param_Test::Long_Seq *out, *ret; + + *req->arguments ()->item (2, env)->value () >>= out; + *req->result ()->value () >>= ret; + + this->out_ = out; + this->ret_ = ret; + + return this->check_validity (); +} + +void +Test_Long_Sequence::print_values (void) +{ + CORBA::ULong i; + ACE_DEBUG ((LM_DEBUG, "\n*=*=*=*=*=*=*=*=*=*=\n")); + for (i=0; this->in_.ptr () && (i < this->in_->length ()); i++) + { + ACE_DEBUG ((LM_DEBUG, + "Element #%d\n" + "in : %s\n", + i, + this->in_[i]? (const char *)this->in_[i]:"<nul>")); + } + if (!this->in_.ptr ()) + ACE_DEBUG ((LM_DEBUG, "\nin sequence is NUL\n")); + ACE_DEBUG ((LM_DEBUG, "\n*=*=*=*=*=*=*=*=*=*=\n")); + for (i=0; this->inout_.ptr () && (i < this->inout_->length ()); i++) + { + ACE_DEBUG ((LM_DEBUG, + "Element #%d\n" + "in : %s\n", + i, + (this->inout_[i]? (const char *)this->inout_[i]:"<nul>"))); + } + if (!this->inout_.ptr ()) + ACE_DEBUG ((LM_DEBUG, "\ninout sequence is NUL\n")); + ACE_DEBUG ((LM_DEBUG, "\n*=*=*=*=*=*=*=*=*=*=\n")); + for (i=0; this->out_.ptr () && (i < this->out_->length ()); i++) + { + ACE_DEBUG ((LM_DEBUG, + "Element #%d\n" + "in : %s\n", + i, + (this->out_[i]? (const char *)this->out_[i]:"<nul>"))); + } + if (!this->out_.ptr ()) + ACE_DEBUG ((LM_DEBUG, "\nout sequence is NUL\n")); + ACE_DEBUG ((LM_DEBUG, "\n*=*=*=*=*=*=*=*=*=*=\n")); + for (i=0; this->ret_.ptr () && (i < this->ret_->length ()); i++) + { + ACE_DEBUG ((LM_DEBUG, + "Element #%d\n" + "in : %s\n", + i, + (this->ret_[i]? (const char *)this->ret_[i]:"<nul>"))); + } + if (!this->ret_.ptr ()) + ACE_DEBUG ((LM_DEBUG, "\nin sequence is NUL\n")); + ACE_DEBUG ((LM_DEBUG, "\n*=*=*=*=*=*=*=*=*=*=\n")); +} + +// ************************************************************************ +// Test_Bounded_Long_Sequence +// ************************************************************************ + +Test_Bounded_Long_Sequence::Test_Bounded_Long_Sequence (void) + : opname_ (CORBA::string_dup ("test_bounded_longseq")), + in_ (new Param_Test::Bounded_Long_Seq), + inout_ (new Param_Test::Bounded_Long_Seq), + out_ (0), + ret_ (0) +{ +} + +Test_Bounded_Long_Sequence::~Test_Bounded_Long_Sequence (void) +{ +} + +const char * +Test_Bounded_Long_Sequence::opname (void) const +{ + return this->opname_; +} + +int +Test_Bounded_Long_Sequence::init_parameters (Param_Test_ptr objref, + CORBA::Environment &env) +{ + Generator *gen = GENERATOR::instance (); // value generator + + ACE_UNUSED_ARG (objref); + ACE_UNUSED_ARG (env); + + // get some sequence length (not more than 10) + CORBA::ULong len = this->in_->maximum (); + + // set the length of the sequence + this->in_->length (len); + // now set each individual element + for (CORBA::Short i=0; i < this->in_->maximum (); i++) + { + this->in_[i] = i; + } + return 0; +} + +int +Test_Bounded_Long_Sequence::reset_parameters (void) +{ + this->inout_ = new Param_Test::Bounded_Long_Seq; // delete the previous one + this->out_ = 0; + this->ret_ = 0; + return 0; +} + +int +Test_Bounded_Long_Sequence::run_sii_test (Param_Test_ptr objref, + CORBA::Environment &env) +{ + Param_Test::Bounded_Long_Seq_out out (this->out_.out ()); + this->ret_ = objref->test_bounded_long_sequence (this->in_.in (), + this->inout_.inout (), + out, + env); + return (env.exception () ? -1:0); +} + +int +Test_Bounded_Long_Sequence::add_args (CORBA::NVList_ptr ¶m_list, + CORBA::NVList_ptr &retval, + CORBA::Environment &env) +{ + CORBA::Any in_arg (Param_Test::_tc_Bounded_Long_Seq, (void *) &this->in_.in (), 0); + CORBA::Any inout_arg (Param_Test::_tc_Bounded_Long_Seq, &this->inout_.inout (), 0); + // ORB will allocate + CORBA::Any out_arg (Param_Test::_tc_Bounded_Long_Seq, 0, 0); + + // add parameters + (void)param_list->add_value ("s1", in_arg, CORBA::ARG_IN, env); + (void)param_list->add_value ("s2", inout_arg, CORBA::ARG_INOUT, env); + (void)param_list->add_value ("s3", out_arg, CORBA::ARG_OUT, env); + + // add return value type + (void)retval->item (0, env)->value ()->replace (Param_Test::_tc_Bounded_Long_Seq, + 0, + 0, // does not own + env); + return 0; +} + +CORBA::Boolean +Test_Bounded_Long_Sequence::check_validity (void) +{ + CORBA::Boolean flag = 0; + if ((this->in_->length () == this->inout_->length ()) && + (this->in_->length () == this->out_->length ()) && + (this->in_->length () == this->ret_->length ())) + { + flag = 1; // assume all are equal + // lengths are same. Now compare the contents + for (CORBA::ULong i=0; i < this->in_->length () && flag; i++) + { + if ((this->in_[i] != this->inout_[i]) || + (this->in_[i] != this->out_[i]) || + (this->in_[i] != this->ret_[i])) + // not equal + flag = 0; + } + } + return flag; +} + +CORBA::Boolean +Test_Bounded_Long_Sequence::check_validity (CORBA::Request_ptr req) +{ + CORBA::Environment env; + + Param_Test::Bounded_Long_Seq *out, *ret; + + *req->arguments ()->item (2, env)->value () >>= out; + *req->result ()->value () >>= ret; + + this->out_ = out; + this->ret_ = ret; + + return this->check_validity (); +} + +void +Test_Bounded_Long_Sequence::print_values (void) +{ + CORBA::ULong i; + ACE_DEBUG ((LM_DEBUG, "\n*=*=*=*=*=*=*=*=*=*=\n")); + for (i=0; this->in_.ptr () && (i < this->in_->length ()); i++) + { + ACE_DEBUG ((LM_DEBUG, + "Element #%d\n" + "in : %s\n", + i, + this->in_[i]? (const char *)this->in_[i]:"<nul>")); + } + if (!this->in_.ptr ()) + ACE_DEBUG ((LM_DEBUG, "\nin sequence is NUL\n")); + ACE_DEBUG ((LM_DEBUG, "\n*=*=*=*=*=*=*=*=*=*=\n")); + for (i=0; this->inout_.ptr () && (i < this->inout_->length ()); i++) + { + ACE_DEBUG ((LM_DEBUG, + "Element #%d\n" + "in : %s\n", + i, + (this->inout_[i]? (const char *)this->inout_[i]:"<nul>"))); + } + if (!this->inout_.ptr ()) + ACE_DEBUG ((LM_DEBUG, "\ninout sequence is NUL\n")); + ACE_DEBUG ((LM_DEBUG, "\n*=*=*=*=*=*=*=*=*=*=\n")); + for (i=0; this->out_.ptr () && (i < this->out_->length ()); i++) + { + ACE_DEBUG ((LM_DEBUG, + "Element #%d\n" + "in : %s\n", + i, + (this->out_[i]? (const char *)this->out_[i]:"<nul>"))); + } + if (!this->out_.ptr ()) + ACE_DEBUG ((LM_DEBUG, "\nout sequence is NUL\n")); + ACE_DEBUG ((LM_DEBUG, "\n*=*=*=*=*=*=*=*=*=*=\n")); + for (i=0; this->ret_.ptr () && (i < this->ret_->length ()); i++) + { + ACE_DEBUG ((LM_DEBUG, + "Element #%d\n" + "in : %s\n", + i, + (this->ret_[i]? (const char *)this->ret_[i]:"<nul>"))); + } + if (!this->ret_.ptr ()) + ACE_DEBUG ((LM_DEBUG, "\nin sequence is NUL\n")); + ACE_DEBUG ((LM_DEBUG, "\n*=*=*=*=*=*=*=*=*=*=\n")); +} + +// ************************************************************************ +// Test_ObjRef_Sequence +// ************************************************************************ + +Test_ObjRef_Sequence::Test_ObjRef_Sequence (void) + : opname_ (CORBA::string_dup ("test_objref_sequence")), + inout_ (new Param_Test::Coffee_Mix), + out_ (0), + ret_ (0) +{ +} + +Test_ObjRef_Sequence::~Test_ObjRef_Sequence (void) +{ + CORBA::string_free (this->opname_); + // the other data members will be freed as they are "_var"s and objects + // (rather than pointers to objects) +} + +const char * +Test_ObjRef_Sequence::opname (void) const +{ + return this->opname_; +} + +int +Test_ObjRef_Sequence::init_parameters (Param_Test_ptr objref, + CORBA::Environment &env) +{ + Coffee::Desc desc; + Generator *gen = GENERATOR::instance (); // value generator + + // get some sequence length (not more than 10) + CORBA::ULong len = (CORBA::ULong) (gen->gen_long () % 10) + 1; + + // set the length of the sequence + this->in_.length (len); + // now set each individual element + for (CORBA::ULong i = 0; i < this->in_.length (); i++) + { + // generate some arbitrary string to be filled into the ith location in + // the sequence + this->in_[i] = objref->make_coffee (env); + if (env.exception ()) + { + env.print_exception ("make_coffee"); + return -1; + } + // get some sequence length (not more than 10) + CORBA::ULong index = (CORBA::ULong) (gen->gen_long () % 6); + desc.name = Coffee_Flavor [index]; + // set the attribute of the object +// this->in_[i]->description (desc, env); // set the attribute for the in object + Coffee_ptr tmp = this->in_[i]; + tmp->description (desc, env); + + if (env.exception ()) + { + env.print_exception ("set coffee attribute"); + return -1; + } + } + return 0; +} + +int +Test_ObjRef_Sequence::reset_parameters (void) +{ + this->inout_ = new Param_Test::Coffee_Mix; // delete the previous one + this->out_ = 0; + this->ret_ = 0; + return 0; +} + +int +Test_ObjRef_Sequence::run_sii_test (Param_Test_ptr objref, + CORBA::Environment &env) +{ + Param_Test::Coffee_Mix_out out (this->out_.out ()); + this->ret_ = objref->test_coffe_mix (this->in_, + this->inout_.inout (), + out, + env); + return (env.exception () ? -1:0); +} + +int +Test_ObjRef_Sequence::add_args (CORBA::NVList_ptr ¶m_list, + CORBA::NVList_ptr &retval, + CORBA::Environment &env) +{ + CORBA::Any in_arg (Param_Test::_tc_Coffee_Mix, (void *) &this->in_, 0); + CORBA::Any inout_arg (Param_Test::_tc_Coffee_Mix, &this->inout_.inout (), 0); + CORBA::Any out_arg (Param_Test::_tc_Coffee_Mix, this->out_.out (), 0); + + // add parameters + (void)param_list->add_value ("s1", in_arg, CORBA::ARG_IN, env); + (void)param_list->add_value ("s2", inout_arg, CORBA::ARG_INOUT, env); + (void)param_list->add_value ("s3", out_arg, CORBA::ARG_OUT, env); + + // add return value + (void)retval->item (0, env)->value ()->replace (Param_Test::_tc_Coffee_Mix, + &this->ret_, + 0, // does not own + env); + return 0; +} + +CORBA::Boolean +Test_ObjRef_Sequence::check_validity (void) +{ + TAO_TRY + { + if (this->compare (this->in_, this->inout_.in (), TAO_TRY_ENV) && + this->compare (this->in_, this->out_.in (), TAO_TRY_ENV) && + this->compare (this->in_, this->ret_.in (), TAO_TRY_ENV)) + return 1; + else + return 0; + } + TAO_CATCHANY; + { + return 0; + } + TAO_ENDTRY; + return 0; +} + +CORBA::Boolean +Test_ObjRef_Sequence::check_validity (CORBA::Request_ptr req) +{ + CORBA::Environment env; + this->inout_ = new Param_Test::Coffee_Mix (*(Param_Test::Coffee_Mix *) + req->arguments ()->item + (1, env)->value ()->value ()); + this->out_ = new Param_Test::Coffee_Mix (*(Param_Test::Coffee_Mix *) req->arguments + ()->item (2, env)->value ()->value ()); + this->ret_ = new Param_Test::Coffee_Mix (*(Param_Test::Coffee_Mix *)req->result + ()->value ()->value ()); + return this->check_validity (); +} + +void +Test_ObjRef_Sequence::print_values (void) +{ + ACE_DEBUG ((LM_DEBUG, + "*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*\n" + "IN sequence\n")); + this->print_sequence (this->in_); + ACE_DEBUG ((LM_DEBUG, + "*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*\n" + "INOUT sequence\n")); + this->print_sequence (this->inout_.in ()); + ACE_DEBUG ((LM_DEBUG, + "*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*\n" + "OUT sequence\n")); + this->print_sequence (this->out_.in ()); + ACE_DEBUG ((LM_DEBUG, + "*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*\n" + "RET sequence\n")); + this->print_sequence (this->ret_.in ()); +} + +CORBA::Boolean +Test_ObjRef_Sequence::compare (const Param_Test::Coffee_Mix &s1, + const Param_Test::Coffee_Mix &s2, + CORBA::Environment& env) +{ + if (s1.maximum () != s2.maximum ()) + return 0; + if (s1.length () != s2.length ()) + return 0; + + for (CORBA::ULong i=0; i < s1.length (); i++) + { + const Coffee_ptr vs1 = s1[i]; + const Coffee_ptr vs2 = s2[i]; + + char* n1 = vs1->description (env)->name; + if (env.exception ()) + { + env.print_exception ("retrieving description for vs1"); + return 0; + } + char* n2 = vs2->description (env)->name; + if (env.exception ()) + { + env.print_exception ("retrieving description for vs2"); + return 0; + } + if (!ACE_OS::strcmp(n1, n2)) + return 0; + } + + return 1; // success +} + +void +Test_ObjRef_Sequence::print_sequence (const Param_Test::Coffee_Mix &s) +{ + ACE_DEBUG ((LM_DEBUG, + "maximum = %d\n" + "length = %d\n", + s.maximum (), + s.length ())); + ACE_DEBUG ((LM_DEBUG, "Elements -\n")); + for (CORBA::ULong i=0; i < s.length (); i++) + { + const Coffee_ptr vs = s[i]; + + /* ACE_DEBUG ((LM_DEBUG, + "Element #%d\n" + "\tdesc = %d\n" + i, + vs.description(env).name)); */ + } +} + +// ************************************************************************ +// Test_AnySeq +// ************************************************************************ + +Test_AnySeq::Test_AnySeq (void) + : opname_ (CORBA::string_dup ("test_any_sequence")), + in_ (new Param_Test::AnySeq), + inout_ (new Param_Test::AnySeq), + out_ (0), + ret_ (0) +{ +} + +Test_AnySeq::~Test_AnySeq (void) +{ + CORBA::string_free (this->opname_); + this->opname_ = 0; +} + +const char * +Test_AnySeq::opname (void) const +{ + return this->opname_; +} + +int +Test_AnySeq::init_parameters (Param_Test_ptr objref, + CORBA::Environment &env) +{ + Generator *gen = GENERATOR::instance (); // value generator + + for (CORBA::ULong i=0; i < this->in_->length (); i++) + { + // CORBA::ULong index = (CORBA::ULong) (gen->gen_long () % 3); + CORBA::ULong index = 2; + + switch (index) + { + case 0: + { + CORBA::Short s; + s = gen->gen_short (); + ACE_DEBUG ((LM_DEBUG, "setting short = %d\n", s)); + this->in_[i] <<= s; + this->inout_[i] <<= s; + } + break; + case 1: + { + char *str = gen->gen_string (); + ACE_DEBUG ((LM_DEBUG, "setting string = %s\n", str)); + this->in_[i] <<= str; + this->inout_[i] <<= str; + } + break; + case 2: + { + TAO_TRY + { + // get access to a Coffee Object + Coffee_var cobj = objref->make_coffee (TAO_TRY_ENV); + TAO_CHECK_ENV; + + // insert the coffee object into the Any + this->in_[i] <<= cobj.in (); + this->inout_[i] <<= cobj.in (); + } + TAO_CATCH (CORBA::SystemException, sysex) + { + ACE_UNUSED_ARG (sysex); + TAO_TRY_ENV.print_exception ("System Exception doing make_coffee"); + return -1; + } + TAO_ENDTRY; + } + break; + case 3: + break; + case 4: + break; + case 5: + break; + } + return 0; + } +} + +int +Test_AnySeq::reset_parameters (void) +{ + Generator *gen = GENERATOR::instance (); // value generator + + for (CORBA::ULong i=0; i < this->in_->length (); i++) + { + // CORBA::ULong index = (CORBA::ULong) (gen->gen_long () % 2); + CORBA::ULong index = 2; + + switch (index) + { + case 0: + { + CORBA::Short s; + s = gen->gen_short (); + this->in_[i] <<= s; + this->inout_[i] <<= s; + } + break; + case 1: + { + char *str = gen->gen_string (); + this->in_[i] <<= str; + this->inout_[i] <<= str; + } + break; + case 2: + { + this->inout_[i] = this->in_[i]; + } + break; + case 3: + break; + case 4: + break; + case 5: + break; + } + return 0; + } +} + +int +Test_AnySeq::run_sii_test (Param_Test_ptr objref, + CORBA::Environment &env) +{ + Param_Test::AnySeq_var out (this->out_.out ()); + this->ret_ = objref->test_anyseq (this->in_, + this->inout_, + out, + env); + return (env.exception () ? -1:0); +} + +int +Test_AnySeq::add_args (CORBA::NVList_ptr ¶m_list, + CORBA::NVList_ptr &retval, + CORBA::Environment &env) +{ + CORBA::Any in_arg (Param_Test::_tc_AnySeq, (void *) &this->in_, 0); + CORBA::Any inout_arg (Param_Test::_tc_AnySeq, &this->inout_, 0); + // ORB will allocate + CORBA::Any out_arg (Param_Test::_tc_AnySeq, 0, 0); + + // add parameters + (void)param_list->add_value ("s1", in_arg, CORBA::ARG_IN, env); + (void)param_list->add_value ("s2", inout_arg, CORBA::ARG_INOUT, env); + (void)param_list->add_value ("s3", out_arg, CORBA::ARG_OUT, env); + + // add return value type + (void)retval->item (0, env)->value ()->replace (Param_Test::_tc_AnySeq, + 0, + 0, // does not own + env); + + return 0; +} + +CORBA::Boolean +Test_AnySeq::check_validity (void) +{ + CORBA::Environment env; + CORBA::Short short_in, short_inout, short_out, short_ret; + char *str_in, *str_inout, *str_out, *str_ret; + Coffee_ptr obj_in, obj_inout, obj_out, obj_ret; + + for (CORBA::ULong i=0; i < this->in_->length (); i++) + { + if ((this->in_[i] >>= short_in) && + (this->inout_[i] >>= short_inout) && + (this->out_[i] >>= short_out) && + (this->ret_[i] >>= short_ret)) + { + ACE_DEBUG ((LM_DEBUG, "Received shorts: in = %d, " + "inout = %d, out = %d, ret = %d\n", + short_in, short_inout, short_out, short_ret)); + + if ((short_in == short_inout) && + (short_in == short_out) && + (short_in == short_ret)) + return 1; + else + { + ACE_DEBUG ((LM_DEBUG, "mismatch of short values\n")); + return 0; + } + } + else if ((this->in_[i] >>= str_in) && + (this->inout_[i] >>= str_inout) && + (this->out_[i] >>= str_out) && + (this->ret_[i] >>= str_ret)) + { + if (!ACE_OS::strcmp (str_in, str_inout) && + !ACE_OS::strcmp (str_in, str_out) && + !ACE_OS::strcmp (str_in, str_ret)) + return 1; + else + { + ACE_DEBUG ((LM_DEBUG, "mismatch of string values\n")); + return 0; + } + } + else if ((this->in_[i] >>= obj_in) && + (this->inout_[i] >>= obj_inout) && + (this->out_[i] >>= obj_out) && + (this->ret_[i] >>= obj_ret)) + { + // all the >>= operators returned true so we are OK. + return 1; + } + else + return 0; + + } +} + +CORBA::Boolean +Test_AnySeq::check_validity (CORBA::Request_ptr req) +{ + CORBA::Environment env; + + Param_Test::AnySeq *out, *ret; + + *req->arguments ()->item (2, env)->value () >>= out; + *req->result ()->value () >>= ret; + + this->out_ = out; + this->ret_ = ret; + + return this->check_validity (); +} + +void +Test_AnySeq::print_values (void) +{ + ACE_DEBUG ((LM_DEBUG, + "*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*\n" + "IN sequence\n")); + this->print_sequence (this->in_); + ACE_DEBUG ((LM_DEBUG, + "*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*\n" + "INOUT sequence\n")); + this->print_sequence (this->inout_); + ACE_DEBUG ((LM_DEBUG, + "*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*\n" + "OUT sequence\n")); + this->print_sequence (this->out_.in ()); + ACE_DEBUG ((LM_DEBUG, + "*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*\n" + "RET sequence\n")); + this->print_sequence (this->ret_.in ()); +} + +void +Test_AnySeq::print_sequence (const Param_Test::AnySeq &s) +{ + ACE_DEBUG ((LM_DEBUG, + "maximum = %d\n" + "length = %d\n", + s.maximum (), + s.length ())); + ACE_DEBUG ((LM_DEBUG, "Elements -\n")); + for (CORBA::ULong i=0; i < s.length (); i++) + { + const CORBA::Any& vs = s[i]; + + /* ACE_DEBUG ((LM_DEBUG, + "Element #%d\n" + "\tl = %d\n" + "\tc = %c\n" + "\ts = %d\n" + "\to = %x\n" + "\tf = %f\n" + "\tb = %d\n" + "\td = %f\n", + i, + vs.l, vs.c, vs.s, vs.o, vs.f, vs.b, vs.d)); +*/ } +} diff --git a/TAO/tests/Param_Test/tests.h b/TAO/tests/Param_Test/tests.h index c5af51ff5dc..440ed10ffd3 100644 --- a/TAO/tests/Param_Test/tests.h +++ b/TAO/tests/Param_Test/tests.h @@ -252,6 +252,64 @@ private: }; // =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +// test typedefed sequences (in our case, sequences of strings) +// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* + +class Test_Bounded_String_Sequence +{ +public: + Test_Bounded_String_Sequence (void); + // ctor + + ~Test_Bounded_String_Sequence (void); + // dtor + + int run_sii_test (Param_Test_ptr objref, + CORBA::Environment &env); + // run the SII test + + int add_args (CORBA::NVList_ptr &nvlist, + CORBA::NVList_ptr &retval, + CORBA::Environment &env); + // add args to NVList for DII + + const char *opname (void) const; + // return operation name + + int init_parameters (Param_Test_ptr objref, + CORBA::Environment &env); + // set values for parameters + + int reset_parameters (void); + // reset values for CORBA + + CORBA::Boolean check_validity (void); + // check if results are valid + + CORBA::Boolean check_validity (CORBA::Request_ptr req); + // check if results are valid. This is used for DII results + + void print_values (void); + // print all the values + +private: + char *opname_; + // operation name + + Param_Test::Bounded_StrSeq_var in_; + // in parameter + + Param_Test::Bounded_StrSeq_var inout_; + // inout parameter + + Param_Test::Bounded_StrSeq_var out_; + // out parameter + + Param_Test::Bounded_StrSeq_var ret_; + // return value +}; + +// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* // test variable sized structs // =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* @@ -370,6 +428,238 @@ private: }; // =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +// test sequences of shorts +// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* + +class Test_Short_Sequence +{ +public: + Test_Short_Sequence (void); + // ctor + + ~Test_Short_Sequence (void); + // dtor + + int run_sii_test (Param_Test_ptr objref, + CORBA::Environment &env); + // run the SII test + + int add_args (CORBA::NVList_ptr &nvlist, + CORBA::NVList_ptr &retval, + CORBA::Environment &env); + // add args to NVList for DII + + const char *opname (void) const; + // return operation name + + int init_parameters (Param_Test_ptr objref, + CORBA::Environment &env); + // set values for parameters + + int reset_parameters (void); + // reset values for CORBA + + CORBA::Boolean check_validity (void); + // check if results are valid + + CORBA::Boolean check_validity (CORBA::Request_ptr req); + // check if results are valid. This is used for DII results + + void print_values (void); + // print all the values + +private: + char *opname_; + // operation name + + Param_Test::Short_Seq_var in_; + // in parameter + + Param_Test::Short_Seq_var inout_; + // inout parameter + + Param_Test::Short_Seq_var out_; + // out parameter + + Param_Test::Short_Seq_var ret_; + // return value +}; + +// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +// test bounded sequences of shorts +// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* + +class Test_Bounded_Short_Sequence +{ +public: + Test_Bounded_Short_Sequence (void); + // ctor + + ~Test_Bounded_Short_Sequence (void); + // dtor + + int run_sii_test (Param_Test_ptr objref, + CORBA::Environment &env); + // run the SII test + + int add_args (CORBA::NVList_ptr &nvlist, + CORBA::NVList_ptr &retval, + CORBA::Environment &env); + // add args to NVList for DII + + const char *opname (void) const; + // return operation name + + int init_parameters (Param_Test_ptr objref, + CORBA::Environment &env); + // set values for parameters + + int reset_parameters (void); + // reset values for CORBA + + CORBA::Boolean check_validity (void); + // check if results are valid + + CORBA::Boolean check_validity (CORBA::Request_ptr req); + // check if results are valid. This is used for DII results + + void print_values (void); + // print all the values + +private: + char *opname_; + // operation name + + Param_Test::Bounded_Short_Seq_var in_; + // in parameter + + Param_Test::Bounded_Short_Seq_var inout_; + // inout parameter + + Param_Test::Bounded_Short_Seq_var out_; + // out parameter + + Param_Test::Bounded_Short_Seq_var ret_; + // return value +}; + +// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +// test sequences of longs +// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* + +class Test_Long_Sequence +{ +public: + Test_Long_Sequence (void); + // ctor + + ~Test_Long_Sequence (void); + // dtor + + int run_sii_test (Param_Test_ptr objref, + CORBA::Environment &env); + // run the SII test + + int add_args (CORBA::NVList_ptr &nvlist, + CORBA::NVList_ptr &retval, + CORBA::Environment &env); + // add args to NVList for DII + + const char *opname (void) const; + // return operation name + + int init_parameters (Param_Test_ptr objref, + CORBA::Environment &env); + // set values for parameters + + int reset_parameters (void); + // reset values for CORBA + + CORBA::Boolean check_validity (void); + // check if results are valid + + CORBA::Boolean check_validity (CORBA::Request_ptr req); + // check if results are valid. This is used for DII results + + void print_values (void); + // print all the values + +private: + char *opname_; + // operation name + + Param_Test::Long_Seq_var in_; + // in parameter + + Param_Test::Long_Seq_var inout_; + // inout parameter + + Param_Test::Long_Seq_var out_; + // out parameter + + Param_Test::Long_Seq_var ret_; + // return value +}; + +// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +// test bounded sequences of longs +// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* + +class Test_Bounded_Long_Sequence +{ +public: + Test_Bounded_Long_Sequence (void); + // ctor + + ~Test_Bounded_Long_Sequence (void); + // dtor + + int run_sii_test (Param_Test_ptr objref, + CORBA::Environment &env); + // run the SII test + + int add_args (CORBA::NVList_ptr &nvlist, + CORBA::NVList_ptr &retval, + CORBA::Environment &env); + // add args to NVList for DII + + const char *opname (void) const; + // return operation name + + int init_parameters (Param_Test_ptr objref, + CORBA::Environment &env); + // set values for parameters + + int reset_parameters (void); + // reset values for CORBA + + CORBA::Boolean check_validity (void); + // check if results are valid + + CORBA::Boolean check_validity (CORBA::Request_ptr req); + // check if results are valid. This is used for DII results + + void print_values (void); + // print all the values + +private: + char *opname_; + // operation name + + Param_Test::Bounded_Long_Seq_var in_; + // in parameter + + Param_Test::Bounded_Long_Seq_var inout_; + // inout parameter + + Param_Test::Bounded_Long_Seq_var out_; + // out parameter + + Param_Test::Bounded_Long_Seq_var ret_; + // return value +}; + +// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* // test sequence of structs // =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* @@ -436,6 +726,72 @@ private: }; // =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +// test bounded sequence of structs +// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* + +class Test_Bounded_Struct_Sequence +{ +public: + Test_Bounded_Struct_Sequence (void); + // ctor + + ~Test_Bounded_Struct_Sequence (void); + // dtor + + int run_sii_test (Param_Test_ptr objref, + CORBA::Environment &env); + // run the SII test + + int add_args (CORBA::NVList_ptr &nvlist, + CORBA::NVList_ptr &retval, + CORBA::Environment &env); + // add args to NVList for DII + + const char *opname (void) const; + // return operation name + + int init_parameters (Param_Test_ptr objref, + CORBA::Environment &env); + // set values for parameters + + int reset_parameters (void); + // reset values for CORBA + + CORBA::Boolean check_validity (void); + // check if results are valid + + CORBA::Boolean check_validity (CORBA::Request_ptr req); + // check if results are valid. This is used for DII results + + void print_values (void); + // print all the values + +protected: + CORBA::Boolean compare (const Param_Test::Bounded_StructSeq &s1, + const Param_Test::Bounded_StructSeq &s2); + // compare + + void print_sequence (const Param_Test::Bounded_StructSeq &s); + // print individual sequence +private: + char *opname_; + // operation name + + Param_Test::Bounded_StructSeq in_; + // in parameter + + // these need memory management + Param_Test::Bounded_StructSeq_var inout_; + // inout parameter + + Param_Test::Bounded_StructSeq_var out_; + // out parameter + + Param_Test::Bounded_StructSeq_var ret_; + // return value +}; + +// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* // test objrefs // =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* class Test_ObjRef @@ -606,4 +962,136 @@ private: // return value }; +// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +// test sequence of object references +// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* + +class Test_ObjRef_Sequence +{ +public: + Test_ObjRef_Sequence (void); + // ctor + + ~Test_ObjRef_Sequence (void); + // dtor + + int run_sii_test (Param_Test_ptr objref, + CORBA::Environment &env); + // run the SII test + + int add_args (CORBA::NVList_ptr &nvlist, + CORBA::NVList_ptr &retval, + CORBA::Environment &env); + // add args to NVList for DII + + const char *opname (void) const; + // return operation name + + int init_parameters (Param_Test_ptr objref, + CORBA::Environment &env); + // set values for parameters + + int reset_parameters (void); + // reset values for CORBA + + CORBA::Boolean check_validity (void); + // check if results are valid + + CORBA::Boolean check_validity (CORBA::Request_ptr req); + // check if results are valid. This is used for DII results + + void print_values (void); + // print all the values + +protected: + CORBA::Boolean compare (const Param_Test::Coffee_Mix &s1, + const Param_Test::Coffee_Mix &s2, + CORBA::Environment& env); + // compare + + void print_sequence (const Param_Test::Coffee_Mix &s); + // print individual sequence +private: + char *opname_; + // operation name + + Param_Test::Coffee_Mix in_; + // in parameter + + // these need memory management + Param_Test::Coffee_Mix_var inout_; + // inout parameter + + Param_Test::Coffee_Mix_var out_; + // out parameter + + Param_Test::Coffee_Mix_var ret_; + // return value +}; + +// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +// test sequences of Anys +// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +class Test_AnySeq +{ +public: + Test_AnySeq (void); + // ctor + + ~Test_AnySeq (void); + // dtor + + int run_sii_test (Param_Test_ptr objref, + CORBA::Environment &env); + // run the SII test + + int add_args (CORBA::NVList_ptr &nvlist, + CORBA::NVList_ptr &retval, + CORBA::Environment &env); + // add args to NVList for DII + + const char *opname (void) const; + // return operation name + + int init_parameters (Param_Test_ptr objref, + CORBA::Environment &env); + // set values for parameters + + int reset_parameters (void); + // reset values for CORBA + + CORBA::Boolean check_validity (void); + // check if results are valid + + CORBA::Boolean check_validity (CORBA::Request_ptr req); + // check if results are valid. This is used for DII results + + void print_values (void); + // print all the values + +protected: + CORBA::Boolean compare (const Param_Test::AnySeq &s1, + const Param_Test::StructSeq &s2); + // compare + + void print_sequence (const Param_Test::AnySeq &s); + // print individual sequence + +private: + char *opname_; + // operation name + + Param_Test::AnySeq_var in_; + // in parameter + + Param_Test::AnySeq_var inout_; + // inout parameter + + Param_Test::AnySeq_var out_; + // out parameter + + Param_Test::AnySeq_var ret_; + // return value +}; + #endif /* if !defined */ |