Example #1
0
CORBA::Any *
test_i::get_value (CORBA::Long offset)
{
  CORBA::Any_ptr retval_ptr = 0;
  ACE_NEW_THROW_EX (retval_ptr,
                    CORBA::Any,
                    CORBA::NO_MEMORY ());
  CORBA::Any_var retval = retval_ptr;

  switch (offset)
  {
    case 1:
    {
      obvmod::tcOffset1 *vt1 = 0;
      ACE_NEW_RETURN (vt1,
                      tcOffset1_i,
                      0);
      vt1->mem (offset);
      retval.inout () <<= &vt1;
      break;
    }
    case 3:
    {
      obvmod::tcOffset003 *vt3 = 0;
      ACE_NEW_RETURN (vt3,
                      tcOffset3_i,
                      0);
      vt3->mem (offset);
      retval.inout () <<= &vt3;
      break;
    }
    case 5:
    {
      obvmod::tcOffset00005 *vt5 = 0;
      ACE_NEW_RETURN (vt5,
                      tcOffset5_i,
                      0);
      vt5->mem (offset);
      retval.inout () <<= &vt5;
      break;
    }
    case 7:
    {
      obvmod::tcOffset0000007 *vt7 = 0;
      ACE_NEW_RETURN (vt7,
                      tcOffset7_i,
                      0);
      vt7->mem (offset);
      retval.inout () <<= &vt7;
      break;
    }
    default:
      return 0;
  }

  return retval._retn ();
}
Example #2
0
CORBA::Boolean
TAO_Log_Constraint_Visitor::union_does_contain (
    const CORBA::Any *any,
    TAO_ETCL_Literal_Constraint &item
)
{
    try
    {
        TAO_DynUnion_i dyn_union;
        dyn_union.init (*any);

        DynamicAny::DynAny_var cc =
            dyn_union.current_component ();

        CORBA::Any_var member = cc->to_any ();

        CORBA::TypeCode_var tc = member->type ();
        CORBA::TCKind kind = TAO_DynAnyFactory::unalias (tc.in ());

        // The literal and the union member must be
        // of the same simple type.
        CORBA::Boolean match = this->simple_type_match (item.expr_type (),
                               kind);

        if (!match)
        {
            return false;
        }

        TAO_ETCL_Literal_Constraint element (&member.inout ());

        return (item == element);
    }
    catch (const CORBA::Exception&)
    {
        return false;
    }
}