예제 #1
0
int
Test_Bounded_Array_Sequence::init_parameters (Param_Test_ptr)
{
  Generator *gen = GENERATOR::instance (); // value generator

  // set the length of the sequence
  this->in_.length (MAX_ARRAYSEQ_LEN);
  // different from in_.
  this->inout_->length (1);

  // now set each individual element
  Param_Test::Fixed_Array tmp;

  for (CORBA::ULong j = 0; j < Param_Test::DIM1; j++)
    {
      tmp[j] = gen->gen_long ();
    }

  Param_Test::Fixed_Array_copy (this->inout_[0], tmp);

  for (CORBA::ULong i = 0; i < this->in_.length (); i++)
    {
      // Generate some arbitrary array to be filled into the ith
      // location in the sequence.
      for (CORBA::ULong j = 0; j < Param_Test::DIM1; j++)
        {
          tmp[j] = gen->gen_long ();
        }

      Param_Test::Fixed_Array_copy (this->in_[i], tmp);
    }

  return 0;
}
예제 #2
0
int
Test_Objref_Struct::init_parameters (Param_Test_ptr objref)
{
  try
    {
      Generator *gen = GENERATOR::instance (); // value generator

      // Set the long member.
      this->in_.x = gen->gen_long ();

      this->in_.y = objref->make_coffee ();

      Coffee::Desc d;
      d.name = gen->gen_string ();

      this->in_.y->description (d);

            this->inout_->x = 0;

            this->inout_->y = Coffee::_nil ();

      Coffee::Desc dd;
            dd.name = CORBA::string_dup ("");

      return 0;
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("Test_Objref_Struct::init_parameters\n");

    }
  return -1;
}
예제 #3
0
int
Test_Var_Struct::init_parameters (Param_Test_ptr)
{
  Generator *gen = GENERATOR::instance (); // value generator

  // get some sequence length (not more than 10)
  CORBA::ULong len = (CORBA::ULong) (gen->gen_long () % 10) + 1;

  this->in_.dbl = 3.14159;
  this->in_.dummy1 = gen->gen_string ();
  this->in_.boole = gen->gen_short () % 2;
  this->in_.dummy2 = gen->gen_string ();
  this->in_.shrt = gen->gen_short ();
  // set the length of the sequence
  this->in_.seq.length (len);

  // now set each individual element
  for (CORBA::ULong i = 0; i < this->in_.seq.length (); i++)
    {
      // generate some arbitrary string to be filled into the ith location in
      // the sequence
      char *str = gen->gen_string ();
      this->in_.seq[i] = str;
    }

  this->inout_->dbl = 0.0;
  this->inout_->dummy1 = CORBA::string_dup ("");
  this->inout_->boole = 0;
  this->inout_->dummy2 = CORBA::string_dup ("");
  this->inout_->shrt = 0;
  // set the length of the sequence
  this->inout_->seq.length (0);

  return 0;
}
예제 #4
0
int
Test_Small_Union::reset_parameters (void)
{
  Generator *gen = GENERATOR::instance (); // value generator
  CORBA::ULong index = (counter++ % 2);

  switch (index)
    {
    case 0:
      {
        CORBA::Long l = gen->gen_long ();
        this->in_.the_long (l);
        this->inout_.the_long (l);
      }
      break;
    default:
    case 1:
      {
        CORBA::Short s = gen->gen_short ();
        this->in_.the_short (s);
        this->inout_.the_short (s);
      }
      break;
    }
  this->out_ = new Param_Test::Small_Union (this->in_);
  this->ret_ = new Param_Test::Small_Union (this->in_);
  return 0;
}
예제 #5
0
int
Test_Recursive_Struct::reset_parameters (void)
{
  // Since these are _vars, we do this the first call and
  // every call thereafter (if any).
  this->inout_ = new Param_Test::Recursive_Struct;
  this->out_ = new Param_Test::Recursive_Struct;
  this->ret_ = new Param_Test::Recursive_Struct;

   // value generator
  Generator *gen = GENERATOR::instance ();

  // Set the depth of recursion.
  CORBA::ULong depth = (CORBA::ULong) (gen->gen_long () % MAX_DEPTH) + 1;

  // No recursion for inout_ until after the call.
  this->inout_->children.length (0);

  // Keeps Purify happy.
  this->inout_->x = 0;

  // Call the recursive helper function.
  this->deep_init (this->in_,
                   gen,
                   depth);

  return 0;
}
예제 #6
0
int
Test_ULongLong::init_parameters (Param_Test_ptr)
{
  Generator *gen = GENERATOR::instance (); // value generator

  this->in_ = gen->gen_long ();
  this->inout_ =  0;
  return 0;
}
예제 #7
0
int
Test_ObjRef_Sequence::init_parameters (Param_Test_ptr objref)
{
  try
    {
      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 () % 5) + 5;

      // 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 ();

          // select a Coffee flavor at random
          CORBA::ULong index = (CORBA::ULong) (gen->gen_long () % 6);

          desc.name = Coffee_Flavor [index];
          // set the attribute for the in object
          Coffee_ptr tmp = this->in_[i];

          tmp->description (desc);
        }

        return 0;
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("Test_ObjRef_Sequence::init_parameters\n");

    }
  return -1;
}
예제 #8
0
int
Test_Fixed_Array::init_parameters (Param_Test_ptr /*objref*/
                                   /*env*/)
{
    Generator *gen = GENERATOR::instance (); // value generator

    //ACE_UNUSED_ARG (objref);

    for (CORBA::ULong i=0; i < Param_Test::DIM1; i++)
    {
        this->in_ [i] = gen->gen_long ();
    }

    return 0;
}
예제 #9
0
int
Test_Struct_Sequence::init_parameters (Param_Test_ptr)
{
  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);
  this->inout_->length (len);
  // now set each individual element
  for (CORBA::ULong i = 0; i < this->in_.length (); i++)
    {
      // generate some arbitrary struct to be filled into the ith location in
      // the sequence
      this->in_[i] = gen->gen_fixed_struct ();
      this->inout_[i] = gen->gen_fixed_struct ();
    }
  return 0;
}
예제 #10
0
int
Test_Any::reset_parameters (void)
{
  Generator *gen = GENERATOR::instance (); // value generator
  CORBA::ULong index = (counter++ % Test_Any::ANY_LAST_TEST_ITEM);

  switch (index)
    {
    default:
    case Test_Any::ANY_SHORT:
      {
        if (TAO_debug_level > 0)
          ACE_DEBUG ((LM_DEBUG,
                      "Param_Test: ANY_SHORT subtest\n"));
        CORBA::Short s;
        s = gen->gen_short ();

        if (TAO_debug_level > 0)
          ACE_DEBUG ((LM_DEBUG, "setting short = %d\n", s));
        this->in_ <<= s;
        this->inout_ <<= s;
      }
      break;

    case Test_Any::ANY_STRING:
      {
        if (TAO_debug_level > 0)
          ACE_DEBUG ((LM_DEBUG,
                      "Param_Test: ANY_STRING subtest\n"));
        char *str = gen->gen_string ();

        if (TAO_debug_level > 0)
          ACE_DEBUG ((LM_DEBUG, "setting string = %s\n", str));
        this->in_ <<= str;
        this->inout_ <<= str;
        CORBA::string_free (str);
      }
      break;

    case Test_Any::ANY_OBJREF:
      {
        if (TAO_debug_level > 0)
          ACE_DEBUG ((LM_DEBUG,
                      "Param_Test: ANY_OBJREF subtest\n"));

        // insert the coffee object into the Any
        this->in_ <<= this->cobj_.in ();
        this->inout_ <<= this->cobj_.in ();
      }
      break;

    case Test_Any::ANY_ARRAY:
      {
        if (TAO_debug_level > 0)
          ACE_DEBUG ((LM_DEBUG,
                      "Param_Test: ANY_ARRAY subtest\n"));

        Param_Test::Fixed_Array array;
        for (size_t i = 0; i < Param_Test::DIM1; i++)
          array[i] = i;
        if (TAO_debug_level > 0)
          ACE_DEBUG ((LM_DEBUG, "Setting Fixed_Array\n"));
        this->in_ <<= Param_Test::Fixed_Array_forany (array);
        this->inout_ <<= Param_Test::Fixed_Array_forany (array);
      }
      break;

    case Test_Any::ANY_SHORT_SEQ:
      {
        if (TAO_debug_level > 0)
          ACE_DEBUG ((LM_DEBUG,
                      "Param_Test: ANY_SHORT_SEQ subtest\n"));
        CORBA::ShortSeq seq;
        seq.length (gen->gen_short () % 16);
        for (size_t i = 0; i < seq.length (); i++)
          seq[i] = gen->gen_short ();
        this->in_    <<= seq;
        this->inout_ <<= seq;
      }
      break;

    case Test_Any::ANY_BD_SHORT_SEQ:
      {
        if (TAO_debug_level > 0)
          ACE_DEBUG ((LM_DEBUG,
                      "Param_Test: ANY_BD_SHORT_SEQ subtest\n"));
        Param_Test::Bounded_Short_Seq seq;
        seq.length (gen->gen_short () % seq.maximum ());
        for (size_t i = 0; i < seq.length (); i++)
          seq[i] = gen->gen_short ();
        this->in_    <<= seq;
        this->inout_ <<= seq;
      }
      break;

    case Test_Any::ANY_STRUCT:
      {
        if (TAO_debug_level > 0)
          ACE_DEBUG ((LM_DEBUG,
                      "Param_Test: ANY_STRUCT subtest\n"));
        Param_Test::Fixed_Struct structure;
        structure = gen->gen_fixed_struct ();
        this->in_ <<= structure;
        this->inout_ <<= structure;
      }
      break;

    case Test_Any::ANY_BIG_UNION:
      {
        CORBA::Long x = gen->gen_long ();
        Param_Test::Big_Union the_union;
        the_union.the_long (x);
        this->in_    <<= the_union;
        this->inout_ <<= the_union;

        if (TAO_debug_level > 0)
          {
            Param_Test::Big_Union *bu_in, *bu_inout;
            this->in_ >>= bu_in;
            this->inout_ >>= bu_inout;
            ACE_DEBUG ((LM_DEBUG,
                        "Param_Test: ANY_BIG_UNION subtest\n"
                        "  in %d\n"
                        "  inout %d\n",
                        bu_in->the_long (),
                        bu_inout->the_long ()));
          }
      }
      break;

    case Test_Any::ANY_SMALL_UNION:
      {
        CORBA::Long x = gen->gen_long ();
        Param_Test::Small_Union the_union;
        the_union.the_long (x);
        this->in_    <<= the_union;
        this->inout_ <<= the_union;

        if (TAO_debug_level > 0)
          {
            Param_Test::Small_Union *bu_in, *bu_inout;
            this->in_ >>= bu_in;
            this->inout_ >>= bu_inout;
            ACE_DEBUG ((LM_DEBUG,
                        "Param_Test: ANY_SMALL_UNION subtest\n"
                        "  in %d\n"
                        "  inout %d\n",
                        bu_in->the_long (),
                        bu_inout->the_long ()));
          }
      }