コード例 #1
0
ファイル: acsncSupplierImpl.cpp プロジェクト: jbarriosc/ACS
//-----------------------------------------------------------------------------
void
Supplier::populateHeader(const CORBA::Any &any)
{
    if (any.type()->kind()!=CORBA::tk_sequence)
	{
	setEventType(any.type()->name());
	}
    else
	{
	std::string etName= acsnc::SEQUENCE_EVENT_TYPE_PREFIX; //_SequenceOf_
	CORBA::Any a;
	a._tao_set_typecode(any.type()->content_type());
	etName+=a.type()->name();
	setEventType(etName.c_str());
	}
    populateHeader(event_m);
    event_m.filterable_data[0].value = any;
}
コード例 #2
0
ファイル: RequestInfo_Util.cpp プロジェクト: CCJY/ATCD
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;
}
コード例 #3
0
ファイル: acsutilAnyAide.cpp プロジェクト: ACS-Community/ACS
//----------------------------------------------------------------------
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;
	}
}