• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

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

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: analyze

void DynAnyAnalyzer::analyze (DynamicAny::DynAny_ptr da)
{
  CORBA::TypeCode_var tc = da->type ();

  CORBA::TCKind kind = tc->kind ();

  CORBA::TypeCode_var dup = CORBA::TypeCode::_duplicate (tc.in ());

  // strip aliases
  while (kind == CORBA::tk_alias)
    {
      dup = dup->content_type ();

      kind = dup->kind ();
    }

  switch (kind)
   {
     case CORBA::tk_struct:
      {
        DynamicAny::DynStruct_var ds
          = DynamicAny::DynStruct::_narrow (da);

        tab (level_);

        if (debug_)
          {
            ACE_DEBUG ((LM_DEBUG,
                      "STRUCT\n"));
          }

        if (da->seek (0) )
          {
            level_++;

            do
              {
                DynamicAny::DynAny_var cc =
                  ds->current_component ();

                DynamicAny::FieldName_var fn =
                  ds->current_member_name ();

                tab(level_);

                if (debug_)
                  {
                    ACE_DEBUG ((LM_DEBUG,
                              "Member = %C\n", fn.in ()));
                  }

                if (!CORBA::is_nil (cc.in ()))
                  {
                    this->analyze (cc.in ());
                  }

              } while (da->next ());

            level_--;
          }
      }
      break; // end tk_struct

    case CORBA::tk_sequence:
      {
        if (TAO_DynCommon::is_basic_type_seq (tc.in ()))
          {
            this->analyze_basic_seq (dup.in (), da);
          }
        else
          {
            DynamicAny::DynSequence_var ds =
              DynamicAny::DynSequence::_narrow (da);

            int i = 0;
            tab(level_);

            if (debug_)
              {
                ACE_DEBUG ((LM_DEBUG,
                            "SEQUENCE\n"));
              }

            if (ds->seek (0UL))
              {
                level_++;

                do
                  {
                    tab(level_);

                    if (debug_)
                      ACE_DEBUG ((LM_DEBUG,
                                  "[%d]\n", i));

                    DynamicAny::DynAny_var cc (ds->current_component ());

                    if (!CORBA::is_nil (cc.in ()))
                      {
                        analyze (cc.in ());
//.........这里部分代码省略.........
开发者ID:chenbk85,项目名称:ACE-Middleware,代码行数:101,代码来源:analyzer.cpp


示例17: ACE_TMAIN

// ------------------------------------------------------------
// Client
// ------------------------------------------------------------
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
  int error_count = 0;

  try
    {
      // Init the orb
      CORBA::ORB_var orb= CORBA::ORB_init (argc, argv);

      // Get IOR from command line (or file)
      if (parse_args (argc, argv) != 0)
        return 1;

      // The first arg should be the IOR
      CORBA::Object_var object =
        orb->string_to_object (ior);

      // Get the server
      simple_var server = simple::_narrow (object.in ());

      const char *bare_string = "Hello World";

      const char *any_string = "Any World";
      CORBA::Any inarg;
      inarg <<= any_string;
      CORBA::Any_var outarg;

      // Invoke the call.
      CORBA::String_var reply =
        server->op1 (bare_string,
                     inarg,
                     outarg.out ());

      const char *any_reply;
      outarg >>= any_reply;

      ACE_DEBUG ((LM_DEBUG,
                 "Client sent %C, got %C\n", bare_string, reply.in ()) );

      if (ACE_OS::strcmp (bare_string, reply.in ()) != 0)
        {
          ++error_count;
        }

      ACE_DEBUG ((LM_DEBUG,
                 "Client sent %C, got %C\n", any_string, any_reply) );

      if (ACE_OS::strcmp (any_string, any_reply) != 0)
        {
          ++error_count;
        }
#if defined (ACE_HAS_WCHAR)
      wchar_t *wide_string = ACE_OS::strdup(ACE_TEXT_ALWAYS_WCHAR(ACE_TEXT ("Wide String")));
      wchar_t *wide_reply = server->op2 (wide_string);
      ACE_DEBUG ((LM_DEBUG,
                  "sent %W, got %W\n", wide_string, wide_reply));

      ACE_OS::free (wide_string);
      CORBA::wstring_free (wide_reply);
#endif /* ACE_HAS_WCHAR */

      server->shutdown ();

      orb->destroy ();
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("Exception caught in client:");
      return 1;
    }

  return error_count;
}
开发者ID:chenbk85,项目名称:ACE-Middleware,代码行数:76,代码来源:client.cpp


示例18: ftr

void
ReplicaController::send_reply (
  PortableInterceptor::ServerRequestInfo_ptr ri)
{
  FT::FTRequestServiceContext_var ftr (
    extract_context (ri));


  ACE_DEBUG ((LM_DEBUG,
              "(%P|%t) Sending reply for %s with rid %i\n",
              ftr->client_id.in (),
              ftr->retention_id));


  // Prepare reply for logging.

  CORBA::Any_var result =
    ri->result ();

  TAO_OutputCDR cdr;
  result->impl ()->marshal_value (cdr);

  Dynamic::ParameterList_var pl =
    ri->arguments ();

  CORBA::ULong len = pl->length ();

  for (CORBA::ULong index = 0; index != len ; ++index)
  {
    //@@ No chance for PARAM_OUT
    if ((*pl)[index].mode == CORBA::PARAM_INOUT)
    {
      (*pl)[index].argument.impl ()->marshal_value (cdr);
    }
  }

  CORBA::OctetSeq_var reply;

  ACE_NEW (reply.out (), CORBA::OctetSeq (cdr.total_length ()));

  reply->length (cdr.total_length ());

  CORBA::Octet* buf = reply->get_buffer ();

  // @@ What if this throws an exception??  We don't have any way to
  // check whether this succeeded
  for (ACE_Message_Block const* mb = cdr.begin ();
       mb != 0;
       mb = mb->cont ())
  {
    ACE_OS::memcpy (buf, mb->rd_ptr (), mb->length ());
    buf += mb->length ();
  }

  // Logging the reply and state update.
  //

  // First send message to members.
  //
  {
    // Extract state update.

    CORBA::OctetSeq_var oid = ri->object_id ();
    PortableInterceptor::AdapterName_var an = ri->adapter_name ();

    CORBA::Any_var state = ri->get_slot (state_slot_id ());

    CORBA::TypeCode_var tc = state->type ();

    if (tc->kind () == CORBA::tk_null)
    {
      ACE_DEBUG ((LM_DEBUG, "Slot update is void\n"));

      PortableServer::POA_var poa = resolve_poa (an.in ());

      PortableServer::ServantBase_var servant =
        poa->id_to_servant (oid.in ());

      Checkpointable* target =
        dynamic_cast<Checkpointable*> (servant.in ());

      if (target)
      {
        CORBA::Any_var tmp = target->get_state ();

        if (tmp.ptr () != 0) state = tmp._retn ();
      }
    }

    TAO_OutputCDR cdr;

    cdr << oid.in ();
    cdr << an.in ();
    cdr << ftr->client_id.in ();
    cdr << ftr->retention_id;
    cdr << reply.in ();
    cdr << state.in ();

    size_t size = cdr.total_length ();

//.........这里部分代码省略.........
开发者ID:CCJY,项目名称:ATCD,代码行数:101,代码来源:ReplicaController.cpp


示例19: result

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


示例20: catch

int
TAO_Log_Constraint_Visitor::visit_in (
    ETCL_Binary_Expr *binary)
{
  int return_value = -1;
  ETCL_Constraint *lhs = binary->lhs ();

  // Determine if the left operand is contained in the right.

  if (lhs->accept (this) == 0)
    {
      TAO_ETCL_Literal_Constraint left;
      this->queue_.dequeue_head (left);

      ETCL_Constraint *rhs = binary->rhs ();

      if (rhs->accept (this) == 0)
        {
          TAO_ETCL_Literal_Constraint bag;
          this->queue_.dequeue_head (bag);

          if (bag.expr_type () == ETCL_COMPONENT)
            {
              CORBA::Any_ptr any_ptr = 0;
              ACE_NEW_RETURN (any_ptr,
                              CORBA::Any,
                              -1);

              CORBA::Any_var component = any_ptr;
              component->replace (bag);
              component->impl ()->_add_ref ();
              CORBA::TCKind kind = CORBA::tk_null;

              try
                {
                  CORBA::TypeCode_var tc = component->type ();
                  kind = TAO_DynAnyFactory::unalias (tc.in ());
                }
              catch (const CORBA::Exception&)
                {
                  return return_value;
                }

              CORBA::Boolean result = 0;

              switch (kind)
              {
                case CORBA::tk_sequence:
                  result = this->sequence_does_contain (&component.in (),
                                                        left);
                  break;
                case CORBA::tk_array:
                  result = this->array_does_contain (&component.in (),
                                                     left);
                  break;
                case CORBA::tk_struct:
                  result = this->struct_does_contain (&component.in (),
                                                      left);
                  break;
                case CORBA::tk_union:
                  result = this->union_does_contain (&component.in (),
                                                     left);
                  break;
                case CORBA::tk_any:
                  result = this->any_does_contain (&component.in (),
                                                   left);
                  break;
                default:
                  return return_value;
              }

              this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result));
              return_value = 0;
            }
        }
    }

  return return_value;
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:79,代码来源:Log_Constraint_Visitors.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ corba::ORB_ptr类代码示例发布时间:2022-05-31
下一篇:
C++ corba::Any类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap