Example #1
0
CORBA::Any *
TAO::TypeCode::Case_Enum_T<StringType,
                           TypeCodeType>::label (void) const
{
    TAO_OutputCDR out_cdr;

    out_cdr.write_ulong (this->label_);

    CORBA::Any *retval = 0;
    ACE_NEW_THROW_EX (retval,
                        CORBA::Any,
                        CORBA::NO_MEMORY ());

    TAO_InputCDR in_cdr (out_cdr);
    TAO::Unknown_IDL_Type *unk = 0;
    ACE_NEW_THROW_EX (unk,
                      TAO::Unknown_IDL_Type (this->discriminator_tc_.in (),
                                             in_cdr),
                      CORBA::NO_MEMORY ());

    CORBA::Any_var safe_value (retval);

    retval->replace (unk);

    return safe_value._retn ();
}
Example #2
0
void
TAO::Any_Impl_T<T>::insert (CORBA::Any & any,
                            _tao_destructor destructor,
                            CORBA::TypeCode_ptr tc,
                            T * const value)
{
  TAO::Any_Impl_T<T> *new_impl = 0;
  ACE_NEW (new_impl,
           TAO::Any_Impl_T<T> (destructor,
                               tc,
                               value));
  any.replace (new_impl);
}
Example #3
0
void
TAO::Any_Array_Impl_T<T_slice, T_forany>::insert (CORBA::Any & any,
                                                  _tao_destructor destructor,
                                                  CORBA::TypeCode_ptr tc,
                                                  T_slice * const value)
{
  TAO::Any_Array_Impl_T<T_slice, T_forany> *new_impl = 0;
  typedef TAO::Any_Array_Impl_T<T_slice, T_forany> ARRAY_ANY_IMPL;
  ACE_NEW (new_impl,
           ARRAY_ANY_IMPL (destructor,
                           tc,
                           value));
  any.replace (new_impl);
}
void
TAO_IFR_Client_Adapter_Impl::create_operation_list (
    CORBA::ORB_ptr orb,
    CORBA::OperationDef_ptr opDef,
    CORBA::NVList_ptr &result)
{
    // Create an empty NVList.
    orb->create_list (0, result);

    // Get the parameters (if any) from the OperationDef, and for each
    // parameter add a corresponding entry to the result.
    CORBA::ParDescriptionSeq_var params = opDef->params ();

    CORBA::ULong paramCount = params->length ();

    for (CORBA::ULong i = 0; i < paramCount; ++i)
    {
        CORBA::Any value;
        TAO::Unknown_IDL_Type *unk = 0;
        ACE_NEW (unk,
                 TAO::Unknown_IDL_Type (params[i].type.in ()));
        value.replace (unk);

        // Convert the parameter mode to an arg mode
        CORBA::Flags flags = 0;
        switch(params[i].mode)
        {
        case CORBA::PARAM_IN:
            flags = CORBA::ARG_IN;
            break;
        case CORBA::PARAM_OUT:
            flags = CORBA::ARG_OUT;
            break;
        case CORBA::PARAM_INOUT:
            flags = CORBA::ARG_INOUT;
            break;
        default:
            // Shouldn't happen
            throw ::CORBA::INTERNAL();
        }

        // Add an argument to the NVList.
        result->add_value (params[i].name.in (), value, flags);
    }
}
Example #5
0
CORBA::Any_ptr
TAO_DynEnum_i::to_any (void)
{
  TAO_OutputCDR out_cdr;

  out_cdr.write_ulong (this->value_);

  CORBA::Any *retval;
  ACE_NEW_THROW_EX (retval,
                    CORBA::Any,
                    CORBA::NO_MEMORY ());

  TAO_InputCDR in_cdr (out_cdr);
  TAO::Unknown_IDL_Type *unk = 0;
  ACE_NEW_THROW_EX (unk,
                    TAO::Unknown_IDL_Type (this->type_.in (),
                                           in_cdr),
                    CORBA::NO_MEMORY ());

  retval->replace (unk);
  return retval;
}
Example #6
0
CORBA::Any *
TAO_ConstantDef_i::value_i (void)
{
  CORBA::TypeCode_var tc = this->type_i ();

  void *ref = 0;
  size_t length = 0;

  this->repo_->config ()->get_binary_value (
                              this->section_key_,
                              "value",
                              ref,
                              length
                            );

  char *data = static_cast<char *> (ref);
  ACE_Auto_Basic_Array_Ptr<char> safety (data);

  ACE_Message_Block mb (data,
                        length);
  mb.length (length);
  TAO_InputCDR in_cdr (&mb);

  CORBA::Any *retval = 0;
  ACE_NEW_THROW_EX (retval,
                    CORBA::Any,
                    CORBA::NO_MEMORY ());

  TAO::Unknown_IDL_Type *impl = 0;
  ACE_NEW_THROW_EX (impl,
                    TAO::Unknown_IDL_Type (tc.in (),
                                           in_cdr),
                    CORBA::NO_MEMORY ());

  retval->replace (impl);
  return retval;
}
Example #7
0
void
operator<<=(::CORBA::Any& any, Hello_ptr* v)
{
    any.replace(_tc_Hello, (::CORBA::Object_ptr)*v, true);
}
Example #8
0
  Invocation_Status
  DII_Invocation::handle_user_exception (TAO_InputCDR &cdr)
  {
    Reply_Guard mon (this, TAO_INVOKE_FAILURE);

    if (TAO_debug_level > 3)
      {
        TAOLIB_DEBUG ((LM_DEBUG,
                    "TAO (%P|%t) - DII_Invocation::"
                    "handle_user_exception\n"));
      }

    // Match the exception interface repository id with the
    // exception in the exception list.
    // This is important to decode the exception.
    CORBA::String_var buf;

    TAO_InputCDR tmp_stream (cdr,
                             cdr.start ()->length (),
                             0);

    // Pull the exception ID out of the marshaling buffer.
    if (tmp_stream.read_string (buf.inout ()) == 0)
      {
        throw ::CORBA::MARSHAL (TAO::VMCID, CORBA::COMPLETED_YES);
      }

    for (CORBA::ULong i = 0;
         this->excp_list_ != 0 && i < this->excp_list_->count ();
         i++)
      {
          CORBA::TypeCode_var tc = this->excp_list_->item (i);

          const char *xid = tc->id ();

          if (ACE_OS::strcmp (buf.in (), xid) != 0)
            {
              continue;
            }

          CORBA::Any any;
          TAO::Unknown_IDL_Type *unk = 0;
          ACE_NEW_RETURN (unk,
                          TAO::Unknown_IDL_Type (
                              tc.in (),
                              cdr
                            ),
                          TAO_INVOKE_FAILURE);

          any.replace (unk);

          mon.set_status (TAO_INVOKE_USER_EXCEPTION);

          throw ::CORBA::UnknownUserException (any);
        }

    // If we couldn't find the right exception, report it as
    // CORBA::UNKNOWN.

    // But first, save the user exception in case we
    // are being used in a TAO gateway.
    this->host_->raw_user_exception (cdr);

    mon.set_status (TAO_INVOKE_USER_EXCEPTION);

    // @@ It would seem that if the remote exception is a
    //    UserException we can assume that the request was
    //    completed.
    throw ::CORBA::UNKNOWN (TAO::VMCID, CORBA::COMPLETED_YES);

  }
Example #9
0
void
operator<<=(CORBA::Any& any, date** v)
{
    static const OB::ValueInfo info(date::_OB_id());
    any.replace(_tc_date, (CORBA::ValueBase*)*v, true, &info);
}