Esempio n. 1
0
    void
    Any_Handler::extract_into_any (const Any& desc,
                                   CORBA::Any& toconfig)
    {
      DANCE_TRACE("Any_Handler::extract_into_any");
      try
        {
          DynamicAny::DynAny_var dyn = DYNANY_HANDLER->extract_into_dynany (desc.type (),
                                                                            desc.value ());
          CORBA::Any_var any_safe (dyn->to_any ());
          toconfig = *any_safe;

          dyn->destroy ();
        }
      catch (CORBA::Exception &ex)
        {
          DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO
                           ACE_TEXT ("Any_Handler::extract_into_any -")
                           ACE_TEXT (" Caught CORBA Exception while extracting into")
                           ACE_TEXT (" dynany: %C\n"),
                           ex._info ().c_str ()));
          throw Config_Error (ACE_TEXT (""),
                              ACE_TEXT ("CORBA Exception while extracting into dynany\n"));
        }
      catch (Config_Error &ex)
        {
          throw ex;
        }
      catch (...)
        {
          throw Config_Error (ACE_TEXT (""), ACE_TEXT ("Caught error whilst parsing XML into Any\n"));
        }
    }
Esempio n. 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;
    }
}
Esempio n. 3
0
int
TAO_Log_Constraint_Visitor::visit_special (ETCL_Special *special)
{
  try
    {
      CORBA::TypeCode_var tc = this->current_member_->type ();

      switch (special->type ())
      {
        case ETCL_LENGTH:
          {
            // If the TCKind is not a sequence or an array, the
            // call to length() will raise an exception, and the
            // catch block will return -1;
            CORBA::ULong length = tc->length ();

            TAO_ETCL_Literal_Constraint lit (length);
            this->queue_.enqueue_head (lit);
            return 0;
          }
        case ETCL_DISCRIMINANT:
          {
            // If the TCKind is not a union, the
            // call to init() will raise an exception, and the
            // catch block will return -1;
            TAO_DynUnion_i dyn_union;
            dyn_union.init (this->current_member_.in ());

            DynamicAny::DynAny_var disc =
              dyn_union.get_discriminator ();

            CORBA::Any_var disc_any = disc->to_any ();

            TAO_ETCL_Literal_Constraint lit (disc_any.ptr ());
            this->queue_.enqueue_head (lit);
            return 0;
          }
        case ETCL_TYPE_ID:
          {
            const char *name = tc->name ();

            TAO_ETCL_Literal_Constraint lit (name);
            this->queue_.enqueue_head (lit);
            return 0;
          }
        case ETCL_REPOS_ID:
          {
            const char *id = tc->id ();

            TAO_ETCL_Literal_Constraint lit (id);
            this->queue_.enqueue_head (lit);
            return 0;
          }
        default:
          return -1;
      }
    }
  catch (const CORBA::Exception&)
    {
      return -1;
    }
}
Esempio n. 4
0
int
TAO_Log_Constraint_Visitor::visit_component_array (
    ETCL_Component_Array *array)
{
  try
    {
      // If we are here (from visit_component) the Any containing the
      // component as found in property_lookup_ will be in current_member_.
      CORBA::TypeCode_var tc = this->current_member_->type ();
      CORBA::TCKind kind = TAO_DynAnyFactory::unalias (tc.in ());

      DynamicAny::DynAny_var member;
      CORBA::Boolean success = 0;
      CORBA::ULong slot = (CORBA::ULong) *array->integer ();

      switch (kind)
      {
        case CORBA::tk_array:
          {
            TAO_DynEnum_i dyn_array;
            dyn_array.init (this->current_member_.in ());

            success = dyn_array.seek (slot);

            if (success == 0)
              {
                return -1;
              }

            member = dyn_array.current_component ();

            break;
          }
        case CORBA::tk_sequence:
          {
            TAO_DynStruct_i dyn_sequence;
            dyn_sequence.init (this->current_member_.in ());

            success = dyn_sequence.seek (slot);

            if (success == 0)
              {
                return -1;
              }

            member =
              dyn_sequence.current_component ();

            break;
          }
        // Enums and sequences are the only two cases handled
        // by Component_Array.
        default:
          return -1;
      }

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

      ETCL_Constraint *comp = array->component ();

      if (comp == 0)
        {
          TAO_ETCL_Literal_Constraint result (value.ptr ());
          this->queue_.enqueue_head (result);
          return 0;
        }
      else
        {
          this->current_member_ = value._retn ();
          return comp->accept (this);
        }
    }
  catch (const CORBA::Exception&)
    {
      return -1;
    }
}