本文整理汇总了C++中corba::TypeCode_var::content_type方法的典型用法代码示例。如果您正苦于以下问题:C++ TypeCode_var::content_type方法的具体用法?C++ TypeCode_var::content_type怎么用?C++ TypeCode_var::content_type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corba::TypeCode_var
的用法示例。
在下文中一共展示了TypeCode_var::content_type方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
// Get the length from the (possibly aliased) typecode.
CORBA::ULong
TAO_DynArray_i::get_tc_length (CORBA::TypeCode_ptr tc)
{
CORBA::TypeCode_var tctmp = CORBA::TypeCode::_duplicate (tc);
CORBA::TCKind kind = tctmp->kind ();
while (kind == CORBA::tk_alias)
{
tctmp = tctmp->content_type ();
kind = tctmp->kind ();
}
return tctmp->length ();
}
示例2: string
//----------------------------------------------------------------------
std::string
AnyAide::getId(const CORBA::Any& any)
{
CORBA::TCKind kind = getRealType(any);
//great - the identifier is already provided
if ((kind==CORBA::tk_objref) ||
(kind==CORBA::tk_struct) ||
(kind==CORBA::tk_union) ||
(kind==CORBA::tk_enum) ||
(kind==CORBA::tk_except))
{
//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 std::string(tc->id());
}
else if(kind==CORBA::tk_null)
{
return nullType_m;
}
else if(kind==CORBA::tk_string)
{
return stringType_m;
}
else if(kind==CORBA::tk_double)
{
return doubleType_m;
}
else if(kind==CORBA::tk_long)
{
return longType_m;
}
else if(kind==CORBA::tk_ulong)
{
return uLongType_m;
}
else if(kind==CORBA::tk_longlong)
{
return longLongType_m;
}
else if(kind==CORBA::tk_ulonglong)
{
return uLongLongType_m;
}
else if(kind==CORBA::tk_float)
{
return floatType_m;
}
//aliases can be ...
else if(kind==CORBA::tk_alias)
{
//first get a hold of the IFR id
CORBA::TypeCode_var tc;
//get the type from the any
tc = any.type();
return std::string(tc->id());
}
// after TAO 1.5.2 we have to handel seqence separatly
else if (kind==CORBA::tk_sequence)
{
//!!! here we play dirty !!!
// this solution does not work with seq of seq
// we can change it but first we have to change it on the places where seqences are used !!
CORBA::TypeCode_var tc;
//get the type from the any
tc = any.type();
//create another any with type of content type (long/double ..)
CORBA::Any a;
a._tao_set_typecode(tc->content_type());
// get recursivly the ID of contained type
std::string c = getId(a);
return std::string("IDL:alma/ACS/" + c + "Seq:1.0"); // very dirty but should be OK
}
//bad case
else
{
UnsupportedType except;
except.type = unknownType_m;
throw except;
}
}
示例3: in
bool
recursive_union_test ()
{
bool rc = true;
ACE_DEBUG ((LM_INFO,
"Executing recursive union test\n"));
ACE_DEBUG ((LM_INFO,
"* Simple marshaling -> demarshaling\n"));
{
CORBA::Any the_any, the_out_any;
static CORBA::Short const test_short = 23901;
Test::RecursiveUnion3 foo3;
foo3.a (test_short);
the_any <<= foo3;
TAO_OutputCDR out;
out << the_any;
out.consolidate ();
if (TAO_debug_level >= 2)
{
if (out.length () > 512)
{
ACE_HEX_DUMP ((LM_INFO, out.buffer (), 512, ACE_TEXT ("Encoded union (1):")));
ACE_HEX_DUMP ((LM_INFO, out.buffer ()+512, out.length ()-512, ACE_TEXT ("Encoded union (2):")));
}
else
{
ACE_HEX_DUMP ((LM_INFO, out.buffer (), out.length (), ACE_TEXT ("Encoded union:")));
}
}
TAO_InputCDR in(out);
if (TAO_debug_level >= 1)
ACE_DEBUG ((LM_INFO,
"> Extracting any\n"));
in >> the_out_any;
if (TAO_debug_level >= 1)
ACE_DEBUG ((LM_INFO,
"> Extracted any\n"));
}
// Any's typecode out of scope
if (TAO_debug_level >= 1)
ACE_DEBUG ((LM_INFO,
"> Any destructed\n"));
ACE_DEBUG ((LM_INFO,
"* Marshaling -> demarshaling with external reference\n"));
{
CORBA::TypeCode_var tc;
{
CORBA::Any the_any, the_out_any;
static CORBA::Short const test_short = 23901;
Test::RecursiveUnion3 foo3;
foo3.a (test_short);
the_any <<= foo3;
TAO_OutputCDR out;
out << the_any;
out.consolidate ();
if (TAO_debug_level >= 2)
{
if (out.length () > 512)
{
ACE_HEX_DUMP ((LM_INFO, out.buffer (), 512, ACE_TEXT ("Encoded union (1):")));
ACE_HEX_DUMP ((LM_INFO, out.buffer ()+512, out.length ()-512, ACE_TEXT ("Encoded union (2):")));
}
else
{
ACE_HEX_DUMP ((LM_INFO, out.buffer (), out.length (), ACE_TEXT ("Encoded union:")));
}
}
TAO_InputCDR in(out);
if (TAO_debug_level >= 1)
ACE_DEBUG ((LM_INFO,
"> Extracting any\n"));
in >> the_out_any;
tc = the_out_any._tao_get_typecode ()->member_type (1); // union case type -> alias
tc = tc->content_type (); // alias content type -> sequence
tc = tc->content_type (); // sequence content type -> recursive struct
//.........这里部分代码省略.........
示例4: 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 ());
//.........这里部分代码省略.........