当前位置: 首页>>代码示例>>C++>>正文


C++ corba::Any_var类代码示例

本文整理汇总了C++中corba::Any_var的典型用法代码示例。如果您正苦于以下问题:C++ Any_var类的具体用法?C++ Any_var怎么用?C++ Any_var使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Any_var类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

void
EDF_Scheduler::receive_request (PortableInterceptor::ServerRequestInfo_ptr ri,
                                RTScheduling::Current::IdType_out guid_out,
                                CORBA::String_out /*name*/,
                                CORBA::Policy_out sched_param_out,
                                CORBA::Policy_out /*implicit_sched_param_out*/)
{

  Kokyu::Svc_Ctxt_DSRT_QoS* sc_qos_ptr;
  RTScheduling::Current::IdType guid;
  int int_guid;

  DSUI_EVENT_LOG (EDF_SCHED_FAM, ENTER_SERVER_SCHED_TIME, 0, 0, 0);



#ifdef KOKYU_DSRT_LOGGING
  ACE_DEBUG ((LM_DEBUG, "(%t|%T):entered EDF_Scheduler::receive_request\n"));
#endif


  CORBA::String_var operation = ri->operation ();

#ifdef KOKYU_DSRT_LOGGING
  ACE_DEBUG ((LM_DEBUG,
              "(%t|%T): receive_request from "
              "\"%s\"\n",
              operation.in ()));
#endif

  // Ignore the "_is_a" operation since it may have been invoked
  // locally on the server side as a side effect of another call,
  // meaning that the client hasn't added the service context yet.
  if (ACE_OS::strcmp ("_is_a", operation.in ()) == 0)
    return;

  IOP::ServiceContext_var sc =
    ri->get_request_service_context (Server_Interceptor::SchedulingInfo);

  CORBA::Long importance;
  TimeBase::TimeT deadline;
  TimeBase::TimeT period;
  CORBA::Long task_id=-1;

  if (sc.ptr () == 0)
    {
      //Since send_request will add an QoS for any request, why can this case happen?
      //24 hrs from now - infinity
      ACE_Time_Value deadline_tv = ACE_OS::gettimeofday () + ACE_Time_Value (24*60*60,0);
      deadline = deadline_tv.sec ()*1000000 + deadline_tv.usec ()*10; //100s of nanoseconds for TimeBase::TimeT
      importance = 0;
      period = 0;
//      task_id = ID_BEGIN ++;
    }
  else
    {
      CORBA::OctetSeq oc_seq = CORBA::OctetSeq (sc->context_data.length (),
                                                sc->context_data.length (),
                                                sc->context_data.get_buffer (),
                                                0);
      CORBA::Any sc_qos_as_any;
      CORBA::Any_var scqostmp = codec_->decode (oc_seq);
      sc_qos_as_any = scqostmp.in ();
      //Don't store in a _var, since >>= returns a pointer to an
      //internal buffer and we are not supposed to free it.
      sc_qos_as_any >>= sc_qos_ptr;

      deadline  = sc_qos_ptr->deadline;
      importance = sc_qos_ptr->importance;
      period = sc_qos_ptr->period;
      task_id = sc_qos_ptr->task_id;

      guid.length (sc_qos_ptr->guid.length ());
      guid_copy (guid, sc_qos_ptr->guid);

      ACE_NEW (guid_out.ptr (),
               RTScheduling::Current::IdType);
      guid_out.ptr ()->length (guid.length ());
      *(guid_out.ptr ()) = guid;

      ACE_OS::memcpy (&int_guid,
                      guid.get_buffer (),
                      guid.length ());


#ifdef KOKYU_DSRT_LOGGING
      ACE_DEBUG ((LM_DEBUG,
                  "(%t|%T): Importance = %d, guid = %d "
                  "in recvd service context\n",
                  importance,
                  int_guid));
#endif

      EDF_Scheduling::SchedulingParameter sched_param;
      sched_param.importance = importance;
      sched_param.deadline = deadline;
      sched_param.period = period;
      sched_param.task_id = task_id;
      sched_param_out = this->create_scheduling_parameter (sched_param);
    }
//.........这里部分代码省略.........
开发者ID:CCJY,项目名称:ATCD,代码行数:101,代码来源:EDF_Scheduler.cpp

示例2:

CORBA::Contained::Description *
TAO_ConstantDef_i::describe_i (void)
{
  CORBA::Contained::Description *desc_ptr = 0;
  ACE_NEW_THROW_EX (desc_ptr,
                    CORBA::Contained::Description,
                    CORBA::NO_MEMORY ());

  CORBA::Contained::Description_var retval = desc_ptr;

  retval->kind = this->def_kind ();

  CORBA::ConstantDescription cd;

  cd.name = this->name_i ();

  cd.id = this->id_i ();

  ACE_TString container_id;
  this->repo_->config ()->get_string_value (this->section_key_,
                                            "container_id",
                                            container_id);
  cd.defined_in = container_id.c_str ();

  cd.version = this->version_i ();

  cd.type = this->type_i ();

  CORBA::Any_var val = this->value_i ();

  cd.value = val.in ();

  retval->value <<= cd;
  return retval._retn ();
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:35,代码来源:ConstantDef_i.cpp

示例3: execute

    bool execute() {
        try {
            if (mdocall) {
                CORBA::Any_var any = mfact->callOperation( mop.c_str(), nargs.inout() );
                for (size_t i=0; i < margs.size(); ++i ) {
                    const types::TypeInfo* ti = margs[i]->getTypeInfo();
                    CorbaTypeTransporter* ctt = dynamic_cast<CorbaTypeTransporter*>( ti->getProtocol(ORO_CORBA_PROTOCOL_ID) );
                    assert( ctt );
                    ctt->updateFromAny( &nargs[i], margs[i] );
                }
                // convert returned any to local type:
                if (mctt)
                    return mctt->updateFromAny(&any.in(), mresult);
            } else {
                CSendHandle_var sh = mfact->sendOperation( mop.c_str(), nargs.in() );
                AssignableDataSource<CSendHandle_var>::shared_ptr ads = AssignableDataSource<CSendHandle_var>::narrow( mresult.get() );
                if (ads) {
                    ads->set( sh ); // _var creates a copy of the obj reference.
                }
            }
            return true;
        } catch ( corba::CNoSuchNameException& ) {
            return false;
        } catch ( corba::CWrongNumbArgException& ) {
            return false;
        } catch ( corba::CWrongTypeArgException& ) {
            return false;
        }

    }
开发者ID:pelletierts,项目名称:orocos-rtt,代码行数:30,代码来源:CorbaOperationCallerFactory.cpp

示例4:

DynamicAny::AnySeq *
TAO_DynSequence_i::get_elements (void)
{
  if (this->destroyed_)
    {
      throw ::CORBA::OBJECT_NOT_EXIST ();
    }

  CORBA::ULong length = static_cast<CORBA::ULong> (this->da_members_.size ());

  DynamicAny::AnySeq *elements;
  ACE_NEW_THROW_EX (elements,
                    DynamicAny::AnySeq (length),
                    CORBA::NO_MEMORY ());

  elements->length (length);
  DynamicAny::AnySeq_var safe_retval = elements;

  // Initialize each Any.
  for (CORBA::ULong i = 0; i < length; ++i)
    {
      CORBA::Any_var tmp =
        this->da_members_[i]->to_any ();


      safe_retval[i] = tmp.in ();
    }

  return safe_retval._retn ();
}
开发者ID:asdlei00,项目名称:ACE,代码行数:30,代码来源:DynSequence_i.cpp

示例5:

void
MIF_Scheduler::receive_reply (PortableInterceptor::ClientRequestInfo_ptr ri)
{
  RTScheduling::Current::IdType guid;
  CORBA::Short importance=0;

  CORBA::String_var operation = ri->operation ();

  CORBA::Object_var target = ri->target ();

  ACE_CString opname = operation.in ();
#ifdef KOKYU_DSRT_LOGGING
  ACE_DEBUG ((LM_DEBUG,
              "(%t|%T):receive_reply from "
              "\"%s\"\n",
              opname.c_str ()));
#endif

  // Check that the reply service context was received as
  // expected.
  IOP::ServiceContext_var sc =
    ri->get_reply_service_context (Client_Interceptor::SchedulingInfo);

  if (sc.ptr () == 0)
    {
      importance = 0;
    }
  else
    {
      CORBA::OctetSeq oc_seq = CORBA::OctetSeq (sc->context_data.length (),
                                                sc->context_data.length (),
                                                sc->context_data.get_buffer (),
                                                0);

      //Don't store in a _var, since >>= returns a pointer to an internal buffer
      //and we are not supposed to free it.
      Kokyu::Svc_Ctxt_DSRT_QoS* sc_qos_ptr;
      CORBA::Any sc_qos_as_any;
      CORBA::Any_var scqostmp = codec_->decode (oc_seq);
      sc_qos_as_any = scqostmp.in ();
      sc_qos_as_any >>= sc_qos_ptr;
      importance = sc_qos_ptr->importance;
      guid.length (sc_qos_ptr->guid.length ());
      guid_copy (guid, sc_qos_ptr->guid);

#ifdef KOKYU_DSRT_LOGGING
      ACE_DEBUG ((LM_DEBUG,
                  "(%t|%T): Importance = %d in recvd service context\n",
                  importance ));
#endif
    }

  MIF_Scheduler_Traits::QoSDescriptor_t qos;
  qos.importance_ = importance;
  this->kokyu_dispatcher_->schedule (guid, qos);
}
开发者ID:chenbk85,项目名称:ACE,代码行数:56,代码来源:MIF_Scheduler.cpp

示例6:

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_);
	}
}
开发者ID:colding,项目名称:lorica,代码行数:17,代码来源:OperationTable.cpp

示例7: ForwardRequest

void
Client_Request_Interceptor::receive_exception (
    PortableInterceptor::ClientRequestInfo_ptr ri)
{
  ++this->exception_count_;
  ACE_DEBUG ((LM_DEBUG, "received exception %d\n",
              this->exception_count_));
  if (CORBA::is_nil (this->orb_.in ()))
  {
    int argc = 0;
    ACE_TCHAR **argv = 0;
    this->orb_ = CORBA::ORB_init (argc, argv, this->orb_id_.in ());
  }

  if (this->exception_count_ == 1)
    {
      ACE_DEBUG ((LM_DEBUG, "forwarding client to the second server\n"));
      CORBA::Object_var first_forward =
        this->orb_->string_to_object (this->first_forward_str_.in ());

      // Notice that this is not a permanent forward.
      throw PortableInterceptor::ForwardRequest (first_forward.in ());
    }
  else if (this->exception_count_ == 2)
    {
      ACE_DEBUG ((LM_DEBUG, "forwarding client to the third server\n"));
      CORBA::Object_var second_forward =
        this->orb_->string_to_object (this->second_forward_str_.in ());

      // Notice that this is not a permanent forward.
      throw PortableInterceptor::ForwardRequest (second_forward.in ());
    }
  else if (this->exception_count_ == 3)
    {
      CORBA::Any_var ex = ri->received_exception ();

      CORBA::TypeCode_var tc;
      const char * id = 0;
      tc = ex->type ();
      id = tc->id ();

      if (ACE_OS_String::strcmp (id,
                                 "IDL:omg.org/CORBA/TRANSIENT:1.0") == 0)
          throw ::CORBA::TRANSIENT (CORBA::OMGVMCID | 2, CORBA::COMPLETED_NO);
    }
}
开发者ID:asdlei00,项目名称:ACE,代码行数:46,代码来源:Client_Request_Interceptor.cpp

示例8:

CORBA::Any*
CEC_Pull_Counting_Consumer::try_pull (CORBA::Boolean_out has_event)
{
  if (CORBA::is_nil (this->supplier_proxy_.in ()))
    {
      has_event = 0;
      return 0;
    }

  CORBA::Any_var event =
    this->supplier_proxy_->try_pull (has_event);

  if (has_event)
    this->event_count++;

  return event._retn ();
}
开发者ID:asdlei00,项目名称:ACE,代码行数:17,代码来源:Counting_Consumer.cpp

示例9: catch

void
TAO_CEC_Pull_Event::work (TAO_CEC_ProxyPullConsumer *consumer)
{
  CORBA::Boolean has_event = 0;
  CORBA::Any_var any;

  try
    {
      any = consumer->try_pull_from_supplier (has_event);
    }
  catch (const CORBA::Exception&)
    {
      // Ignore all exceptions
      return;
    }

  if (has_event)
    {
      this->consumer_admin_->push (any.in ());
    }
}
开发者ID:asdlei00,项目名称:ACE,代码行数:21,代码来源:CEC_Reactive_Pulling_Strategy.cpp

示例10: INTERNAL

CORBA::Boolean
TAO_DynEnum_i::equal (DynamicAny::DynAny_ptr rhs)
{
  CORBA::TypeCode_var tc = rhs->type ();

  CORBA::Boolean equivalent = tc->equivalent (this->type_.in ());

  if (!equivalent)
    {
      return false;
    }

  CORBA::Any_var any = rhs->to_any ();

  TAO::Any_Impl *impl = any->impl ();
  CORBA::ULong value;

  if (impl->encoded ())
    {
      TAO::Unknown_IDL_Type * const unk =
        dynamic_cast<TAO::Unknown_IDL_Type *> (impl);

      if (!unk)
        throw CORBA::INTERNAL ();

      // We don't want unk's rd_ptr to move, in case we are shared by
      // another Any, so we use this to copy the state, not the buffer.
      TAO_InputCDR for_reading (unk->_tao_get_cdr ());
      for_reading.read_ulong (value);
    }
  else
    {
      TAO_OutputCDR out;
      impl->marshal_value (out);
      TAO_InputCDR in (out);
      in.read_ulong (value);
    }

  return value == this->value_;
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:40,代码来源:DynEnum_i.cpp

示例11: element

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;
    }
}
开发者ID:binary42,项目名称:OCI,代码行数:38,代码来源:Log_Constraint_Visitors.cpp

示例12: ForwardRequest

void
Server_Request_Interceptor::send_exception (
    PortableInterceptor::ServerRequestInfo_ptr ri)
{
  CORBA::Any_var exception = ri->sending_exception ();
  CORBA::TypeCode_var tc = exception->type ();
  const char *id = tc->id ();

  CORBA::OBJECT_NOT_EXIST nonexist_exception;

  if (ACE_OS::strcmp (id, nonexist_exception._rep_id ()) == 0)
    {
      ACE_DEBUG ((LM_DEBUG,
                  "SERVER (%P|%t) OBJ_NOT_EXIST exception caught for request %d\n"
                  "SERVER (%P|%t) will be forwarded to object 1\n"
                  "SERVER (%P|%t) via send_exception().\n",
                  this->request_count_ - 2));

      throw PortableInterceptor::ForwardRequest (this->obj_[0]);

    }

}
开发者ID:manut,项目名称:TAO,代码行数:23,代码来源:Server_Request_Interceptor.cpp

示例13: in_cdr

bool
TAO::TypeCode::Case_Enum_T<StringType,
                           TypeCodeType>::equal_label (::CORBA::ULong index,
                                                       ::CORBA::TypeCode_ptr tc) const
{
  CORBA::Any_var any = tc->member_label (index);
  TAO_OutputCDR out_cdr;

  if (! any->impl ()->marshal_value (out_cdr))
    {
      return false;
    }

  TAO_InputCDR in_cdr (out_cdr);
  CORBA::ULong tc_label = ACE_UINT32_MAX;

  if (! in_cdr.read_ulong (tc_label))
    {
      return false;
    }

  return (this->label_ == tc_label);
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:23,代码来源:TypeCode_Case_Enum_T.cpp

示例14: switch

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 ();
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:57,代码来源:test_i.cpp

示例15: if

  void
  Plugin_Configurator::deploy_plan (::Deployment::DeploymentPlan &plan)
  {
    DANCE_TRACE ("Plugin_Configurator::deploy_plan");

    DAnCE::Inst_Handler_Impl inst_handler;
    DAnCE::Interceptor_Handler_Impl interceptor_handler;
    DAnCE::Config_Handler_Impl config_handler;

    for (CORBA::ULong i = 0; i < plan.instance.length (); ++i)
      {
        if (plan.instance[i].implementationRef >= plan.implementation.length ())
          {
            DANCE_ERROR (DANCE_LOG_ERROR,
                         (LM_ERROR, DLINFO
                          ACE_TEXT ("Plugin_Configurator::deploy_plan - ")
                          ACE_TEXT ("Invalid implementationRef for instance <%C>\n"),
                          plan.instance[i].name.in ()));
            continue;
          }

        ::Deployment::MonolithicDeploymentDescription &mdd =
            plan.implementation[plan.instance[i].implementationRef];

        CORBA::String_var inst_type =
          DAnCE::Utility::get_instance_type (mdd.execParameter);

        if (ACE_OS::strcmp (inst_type.in (),
                            DAnCE::DANCE_INSTALLATIONHANDLER) == 0)
          {
            CORBA::Any_var any;
            inst_handler.install_instance (plan, i, any.out ());
          }
        else if (ACE_OS::strcmp (inst_type.in (),
                                 DAnCE::DANCE_DEPLOYMENTINTERCEPTOR) == 0)
          {
            CORBA::Any_var any;
            interceptor_handler.install_instance (plan, i, any.out ());
          }
        else if (ACE_OS::strcmp (inst_type.in (),
                                 DAnCE::DANCE_CONFIGPLUGIN) == 0)
          {
            CORBA::Any_var any;
            config_handler.install_instance (plan, i, any.out ());
          }
      }
  }
开发者ID:DOCGroup,项目名称:DAnCE,代码行数:47,代码来源:Plugin_Conf.cpp


注:本文中的corba::Any_var类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。