void
reportResult(CORBA::Request_ptr request)
{
  Miro::Client client;
  Miro::AnyPrinter printer(printName,
                           printType,
                           printLength,
                           printEnums,
                           printTc,
                           printId);

  CORBA::NVList_ptr arguments = request->arguments();
  for (CORBA::ULong i = 0; i < arguments->count(); ++i) {
    cout << "argument name: " << arguments->item(i)->name() << endl;
    CORBA::Any_ptr any = arguments->item(i)->value();

    printer.print(cout, *any);
    cout << endl;
  }

  cout << "return value: " << endl;
  CORBA::Any any = request->return_value();
  printer.print(cout, any);
  cout << endl;
}
Esempio n. 2
0
void
TAO_AMH_DSI_Response_Handler::invoke_reply (CORBA::NVList_ptr args,
                                            CORBA::NamedValue_ptr result)
{
  try
   {
     this->_tao_rh_init_reply ();

    // Send the return value, if any.
    if (result != 0 && result->value () != 0)
      {
        result->value ()->impl ()->marshal_value (this->_tao_out);
      }

    // Send the "inout" and "out" parameters.
    if (args != 0)
      {
        args->_tao_encode (this->_tao_out, CORBA::ARG_INOUT | CORBA::ARG_OUT);
      }
    this->_tao_rh_send_reply ();
  }
  catch (const CORBA::Exception &)
    {
      // TODO:
    }
}
Esempio n. 3
0
void TIDorb::core::ContextImpl::set_values(CORBA::NVList_ptr values)
{
  TIDThr::Synchronized sync(*this);	
  
  if (!(values))
    throw  CORBA::BAD_PARAM(0,CORBA::COMPLETED_NO); // "Null NVList reference"

  delete m_values;
  
  CORBA::ULong list_size = values->count();
  
  m_orb->create_list(list_size, m_values);

  for(CORBA::ULong i = 0; i < list_size; i++) 
    set_one_value(values->item(i)->name(), *(values->item(i)->value()));
}
Esempio n. 4
0
void
OCI_APT::ArgList::prepare_request(CORBA::NVList_ptr args,
				  CORBA::TypeCode_ptr &result_tc,
				  bool &is_oneway)
{
	is_oneway = this->is_oneway_;
	if (!is_oneway)
		result_tc = CORBA::TypeCode::_duplicate (this->result_.tc_);
	for (CORBA::ULong i = 0; i < this->num_args_; i++)
	{
		TAO::Unknown_IDL_Type *ut = 0;
		ACE_NEW(ut, TAO::Unknown_IDL_Type(this->args_[i].tc_));
		CORBA::Any_var value = new CORBA::Any;
		value->replace(ut);
		args->add_value("",value.in(), this->args_[i].mode_);
	}
}
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);
    }
}
Esempio n. 6
0
void TIDorb::core::ContextImpl::get_values_aux(const char* prop_name, CORBA::Flags flags, 
                                               const char* pattern, CORBA::NVList_ptr values)
{
  if ((!prop_name) || (!pattern))
    throw CORBA::BAD_PARAM(0,CORBA::COMPLETED_NO); //"Null string reference"
  
  if(m_values && (!strcmp(prop_name, m_name))) 
  {
     CORBA::ULong list_size = m_values->count();
     for(CORBA::ULong i = 0; i < list_size; i++)
  	if(match_pattern(m_values->item(i)->name(), pattern)) 
                         values->add_value(m_values->item(i)->name(), 
			 *(m_values->item(i)->value()),0);
  }
  
  if(m_childs && (flags != CORBA::CTX_RESTRICT_SCOPE))
  {
    ContextList::iterator i;
    ContextList::iterator end = m_childs->end();
    
    for(i = m_childs->begin(); i != end; i++)
      (*i)->get_values_aux(prop_name, flags,pattern, values);
  }
}
void
TAO_CEC_DynamicImplementationServer::is_a (CORBA::ServerRequest_ptr request)
{
  CORBA::NVList_ptr list;

  this->typed_event_channel_->create_list (0, list);

  CORBA::Any any_1;
  any_1._tao_set_typecode(CORBA::_tc_string);

  list->add_value ("value",
                   any_1,
                   CORBA::ARG_IN);

  request->arguments (list);

  CORBA::NamedValue_ptr nv = list->item (0);

  CORBA::Any_ptr ap = nv->value ();
  const char *value = 0;
  *ap >>= value;

  if (TAO_debug_level >= 10)
    {
      ORBSVCS_DEBUG ((LM_DEBUG,
                  ACE_TEXT ("***** TAO_CEC_DynamicImplementationServer::is_a called with value %s *****\n"),
                  value));
    }

  const char *object_id =
    CORBA::_tc_Object->id ();

  if (TAO_debug_level >= 10)
    {
      ORBSVCS_DEBUG ((LM_DEBUG,
                  ACE_TEXT ("***** is_a using Server's RepositoryId %s *****\n"),
                  this->repository_id_));
      ORBSVCS_DEBUG ((LM_DEBUG,
                  ACE_TEXT ("***** is_a using base interface %s *****\n"),
                  object_id));
    }

  CORBA::Boolean result = 0;
  if (ACE_OS::strcmp (value, this->repository_id_) == 0
      || ACE_OS::strcmp (value, object_id) == 0)
    {
      result = 1;
    }
  else
    {
      CORBA::ULong num = this->typed_event_channel_->number_of_base_interfaces ();
      for (CORBA::ULong base=0; base<num; base++)
        {
          if (TAO_debug_level >= 10)
            {
              ORBSVCS_DEBUG ((LM_DEBUG,
                          ACE_TEXT ("***** is_a using base interface %s *****\n"),
                          this->typed_event_channel_->base_interfaces (base) ));
            }

          if (ACE_OS::strcmp (value, this->typed_event_channel_->base_interfaces (base) ) == 0)
            {
              result = 1;
            }
        }
    }

  if (TAO_debug_level >= 10)
    {
      ORBSVCS_DEBUG ((LM_DEBUG,
                  ACE_TEXT ("***** is_a returning %d *****\n"),
                  result));
    }

  CORBA::Any result_any;
  CORBA::Any::from_boolean from_boolean (result);
  result_any <<= from_boolean;

  request->set_result (result_any);
}