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


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

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


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

示例1: ToString

//-----------------------------------------------------------------------------//
std::string CCorbaErrorHelper::ToString(const CORBA::Exception& err)
{
	CORBA::Any tmp;
	tmp <<= err;
	CORBA::TypeCode_var tc = tmp.type();
	return std::string(tc->name());
}
开发者ID:AlexS2172,项目名称:IVRMstandard,代码行数:8,代码来源:CorbaErrorHelper.cpp

示例2: in_cdr

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

示例3: dump_value

bool UnionTypeCode::dump_value (TIDorb::core::cdr::CDRInputStream& input,
                                ostream& output) const
{
  CORBA::Any discriminator;
  discriminator.delegate().read_value(input, m_discriminator_type, true);

  output << "[VALUE]{union " << m_name << " discriminator: ";

  discriminator.delegate().dump(output);

  CORBA::Long index = search_member_index(discriminator);
  if (index == -1) {
    return true;	// default constructed union
  }

  if ((index < 0) || (index >= m_members->length())) {
    throw CORBA::MARSHAL();
  }

  TypeCodeImpl* tc = (TypeCodeImpl*)((CORBA::TypeCode_ptr)(*m_members)[index].type);

  if(index == m_default_used)
    output << " /default/ ";

  output << ((*m_members)[index]).name << " -> " ;

  if (!tc->dump_value(input, output))
    return false;

  output << '}';

  return true;
}
开发者ID:AlvaroVega,项目名称:TIDorbC,代码行数:33,代码来源:UnionTypeCode.C

示例4: in

void
TAO_ConstantDef_i::value_i (const CORBA::Any &value)
{
  CORBA::TypeCode_var my_tc =
    this->type_i ();

  CORBA::TypeCode_var val_tc = value.type ();

  CORBA::Boolean const equal_tc =
    my_tc.in ()->equal (val_tc.in ());

  if (!equal_tc)
    {
      return;
    }

  ACE_Message_Block *mb = 0;
  TAO::Any_Impl *impl = value.impl ();

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

      mb = unk->_tao_get_cdr ().steal_contents ();
    }
  else
    {
      TAO_OutputCDR out;
      impl->marshal_value (out);
      TAO_InputCDR in (out);
      mb = in.steal_contents ();
    }
  ACE_Auto_Ptr<ACE_Message_Block> safe (mb);

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

  switch (kind)
  {
    // The data for these types will be aligned to an 8-byte
    // boundary, while the rd_ptr may not.
    case CORBA::tk_double:
    case CORBA::tk_ulonglong:
    case CORBA::tk_longlong:
    case CORBA::tk_longdouble:
      mb->rd_ptr (ACE_ptr_align_binary (mb->rd_ptr (),
                                        ACE_CDR::MAX_ALIGNMENT));
      break;
    default:
      break;
  }

  mb->crunch ();
  this->repo_->config ()->set_binary_value (this->section_key_,
                                            "value",
                                            mb->base (),
                                            mb->length ());
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:58,代码来源:ConstantDef_i.cpp

示例5: compareAnys

// compareAnys function compares both Any type inputs
// returns FIRST_BIGGER if the first argument is bigger
// returns SECOND_BIGGER is the second argument is bigger
// and BOTH_EQUAL if they are equal
Service_impl::AnyComparisonType Service_impl::compareAnys (CORBA::Any& first,
                                                         CORBA::Any& second)
{
    CORBA::TypeCode_var tc1 = first.type ();
    CORBA::TypeCode_var tc2 = second.type ();

    switch (tc1->kind ()) {
    case CORBA::tk_ulong: {
        CORBA::ULong frst, scnd;
        first >>= frst;
        second >>= scnd;

        if (frst > scnd) {
            return FIRST_BIGGER;
        } else if (frst == scnd) {
            return BOTH_EQUAL;
        } else {
            return SECOND_BIGGER;
        }
    }

    case CORBA::tk_long: {
        CORBA::Long frst, scnd;
        first >>= frst;
        second >>= scnd;

        if (frst > scnd) {
            return FIRST_BIGGER;
        } else if (frst == scnd) {
            return BOTH_EQUAL;
        } else {
            return SECOND_BIGGER;
        }
    }

    case CORBA::tk_short: {
        CORBA::Short frst, scnd;
        first >>= frst;
        second >>= scnd;

        if (frst > scnd) {
            return FIRST_BIGGER;
        } else if (frst == scnd) {
            return BOTH_EQUAL;
        } else {
            return SECOND_BIGGER;
        }
    }

    default:
        return UNKNOWN;
    }

    return UNKNOWN;
}
开发者ID:VenturaSolutionsInc,项目名称:framework-core,代码行数:59,代码来源:Service_impl.cpp

示例6:

static ostream &
operator<< (ostream & os, const CORBA::Exception & e)
{
    CORBA::Any tmp;
    tmp <<= e;
    CORBA::TypeCode_var tc = tmp.type ();
    const char * p = tc->name ();
    if (*p != '\0')
        os << p;
    else
        os << tc->id ();
    return os;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:13,代码来源:server.cpp

示例7:

CORBA::Long UnionTypeCode::search_member_index
    (const CORBA::Any& discriminator) const
{
  CORBA::ULong length = m_members->length();

  CORBA::Any* disc;

  for (CORBA::ULong i = 0; i < length; i++) {
    disc = &(((*m_members)[i]).label);
    if( discriminator.delegate() == disc->delegate())
      return i;
  }

  return m_default_used;

}
开发者ID:AlvaroVega,项目名称:TIDorbC,代码行数:16,代码来源:UnionTypeCode.C

示例8:

void operator<<=(::CORBA::Any& _a, standardInterfaces::complexFloat_ptr* _op)
{
  _a.PR_insert(standardInterfaces::_tc_complexFloat,
               _0RL_standardInterfaces_mcomplexFloat_marshal_fn,
               _0RL_standardInterfaces_mcomplexFloat_destructor_fn,
               (*_op)->_PR_getobj());
  *_op = standardInterfaces::complexFloat::_nil();
}
开发者ID:nzneer,项目名称:ossie-june,代码行数:8,代码来源:complexFloatDynSK.cpp

示例9: switch

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);
    }
}
开发者ID:svn2github,项目名称:ACE-Middleware,代码行数:45,代码来源:IFR_Client_Adapter_Impl.cpp

示例10:

void
TAO_DynAny_i::init (const CORBA::Any& any)
{
  this->type_ = any.type ();
  this->check_typecode (this->type_.in ());

  this->init_common ();

  this->any_ = any;
}
开发者ID:milan-mpathix,项目名称:ATCD,代码行数:10,代码来源:DynAny_i.cpp

示例11:

CORBA::Any *
TAO_RequestInfo_Util::make_any (CORBA::Boolean tk_void_any)
{
  CORBA::Any *any = 0;
  ACE_NEW_THROW_EX (any,
                    CORBA::Any,
                    CORBA::NO_MEMORY (
                      CORBA::SystemException::_tao_minor_code (
                        0,
                        ENOMEM),
                      CORBA::COMPLETED_NO));

  if (tk_void_any)
    {
      any->_tao_set_typecode (CORBA::_tc_void);
    }

  return any;
}
开发者ID:CCJY,项目名称:ATCD,代码行数:19,代码来源:RequestInfo_Util.cpp

示例12: key

int
TAO_Log_Constraint_Visitor::visit_identifier (ETCL_Identifier *ident)
{
  int return_value = -1;
  const char *name = ident->value ();
  ACE_CString key (name, 0, false);

  CORBA::Any any;

  if (this->property_lookup_.find (key, any) == 0)
    {
      if (any.impl() != 0)
        {
          this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (&any));
          return_value = 0;
        }
    }

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

示例13:

//----------------------------------------------------------------------
CORBA::TCKind
AnyAide::getRealType(const CORBA::Any& any)
{
    //have to create an _var type because this is actually a CORBA object
    CORBA::TypeCode_var tc;
    //get the type from the any
    tc = any.type();

    //return the kind...simple enough.
    return tc->kind();
}
开发者ID:ACS-Community,项目名称:ACS,代码行数:12,代码来源:acsutilAnyAide.cpp

示例14: return

CORBA::Boolean
operator<< (TAO_OutputCDR &cdr, const CORBA::Any &any)
{
  TAO::Any_Impl *impl = any.impl ();

  if (impl != 0)
    {
      return impl->marshal (cdr);
    }

  return (cdr << CORBA::_tc_null);
}
开发者ID:esohns,项目名称:ATCD,代码行数:12,代码来源:Any.cpp

示例15: skip_value

bool UnionTypeCode::skip_value (TIDorb::core::cdr::CDRInputStream& input) const
{
  CORBA::Any discriminator;

  discriminator.delegate().read_value(input, m_discriminator_type, true);

  CORBA::Long index = search_member_index(discriminator);

  if (index == -1) {
    return true;	// default constructed union
  }

  if ((index < 0) || (index >= m_members->length())) {
    throw CORBA::MARSHAL();
  }
  TypeCodeImpl* tc = (TypeCodeImpl*)((CORBA::TypeCode_ptr)(*m_members)[index].type);

  tc->skip_value(input);

  return true;
}
开发者ID:AlvaroVega,项目名称:TIDorbC,代码行数:21,代码来源:UnionTypeCode.C


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