39 #ifndef ORO_CORBA_CONVERSION_HPP 40 #define ORO_CORBA_CONVERSION_HPP 48 #include <tao/Version.h> 49 #if TAO_MAJOR_VERSION == 1 && TAO_MINOR_VERSION <= 4 51 #else // TAO 1.5 and higher 52 #include <tao/AnyTypeCode/Any.h> 54 #include <tao/CORBA_String.h> 57 #include <omniORB4/stringtypes.h> 60 #include "OrocosTypesC.h" 61 #include "../../Logger.hpp" 62 #include "../../internal/DataSourceTypeInfo.hpp" 103 static bool toStdType(StdType& tp,
const CorbaType& cb) {
127 static bool update(
const CORBA::Any& any, StdType tp) {
140 return new CORBA::Any();
160 template<
class Type,
class _CorbaType = Type>
174 static const Type&
get(
const Type& t) {
178 static bool toStdType(StdType& tp,
const CorbaType& cb) {
188 static bool update(
const CORBA::Any& any, StdType& _value) {
190 if ( any >>= temp ) {
198 CORBA::Any_ptr ret =
new CORBA::Any();
200 *ret <<= toAny( static_cast<CorbaType>(t) );
204 static bool updateAny(
const Type& t, CORBA::Any& any ) {
206 any <<= toAny( static_cast<CorbaType>(t) );
216 template<
class T,
class _Alloc>
224 static bool toStdType(StdType& tp,
const CorbaType& cb) {
226 tp.resize( cb.length() );
227 for (
size_t i = 0; i != cb.length(); ++i) {
235 cb.length( (CORBA::ULong)(tp.size()) );
236 for(
size_t i = 0; i != tp.size(); ++i)
244 static bool toStdType(StdType& tp,
const CORBA::Any& any) {
251 static CorbaType*
toAny(
const StdType& tp) {
257 static bool update(
const CORBA::Any& any, StdType& _value) {
259 if ( any >>= result ) {
266 CORBA::Any_ptr ret =
new CORBA::Any();
271 static bool updateAny( StdType
const& t, CORBA::Any& any ) {
282 template<
class T1,
class T2>
289 static bool toStdType(StdType& tp,
const CorbaType& cb) {
297 static CorbaType*
toAny(
const StdType& tp) {
303 static StdType
get(
const CorbaType* cb) {
309 static bool update(
const CORBA::Any& any, StdType& _value) {
311 if ( any >>= result ) {
318 CORBA::Any_ptr ret =
new CORBA::Any();
323 static bool updateAny( StdType
const& t, CORBA::Any& any ) {
334 template<
class T1,
class T2,
class _Compare,
class _Alloc>
339 typedef std::map<T1, T2, _Compare, _Alloc>
StdType;
341 static bool toStdType(StdType& tp,
const CorbaType& cb) {
345 for (
size_t i = 0; i != cb.length(); ++i) {
355 cb.length(tp.size());
356 typename StdType::const_iterator it = tp.begin();
358 for(
size_t i = 0; i != tp.size(); i++) {
368 static bool toStdType(StdType& tp,
const CORBA::Any& any) {
375 static CorbaType*
toAny(
const StdType& tp) {
381 static StdType
get(
const CorbaType* cb) {
387 static bool update(
const CORBA::Any& any, StdType& _value) {
389 if ( any >>= result ) {
396 CORBA::Any_ptr ret =
new CORBA::Any();
401 static bool updateAny( StdType
const& t, CORBA::Any& any ) {
static bool toCorbaType(CorbaType &cb, const StdType &tp)
static bool toStdType(StdType &tp, const CorbaType &cb)
CORBA::Any CorbaType
corba type
static bool updateAny(StdType tp, CORBA::Any &any)
Updates an CORBA::Any object from of a C++/IDL type.
This class converts a given application-specific type to a CORBA::Any object and vice versa...
static bool toCorbaType(CorbaType &cb, const StdType &tp)
static bool toStdType(StdType &tp, const CorbaType &cb)
static bool toCorbaType(CorbaType &cb, const StdType &tp)
static bool update(const CORBA::Any &any, StdType tp)
Updates tp with the contents of any.
static bool toStdType(StdType &tp, const CorbaType &cb)
RTT::corba::CAnySequence sequence
static bool toCorbaType(CorbaType &cb, const StdType &tp)
static CorbaType toAny(Type t)
static bool toStdType(StdType &tp, const CORBA::Any &any)
if T is a std::vector or a std::map the associated type is CORBA::Any
static CORBA::Any_ptr createAny(const Type &t)
static bool toCorbaType(CorbaType &cb, const StdType &tp)
Updates cb with the contents of tp.
static bool toStdType(StdType &tp, const CORBA::Any &any)
if T is a std::vector or a std::map the associated type is CORBA::Any
static bool updateAny(StdType const &t, CORBA::Any &any)
static const std::string & getType()
Return the qualified type.
static CORBA::Any_ptr createAny(const StdType &t)
static bool update(const CORBA::Any &any, StdType &_value)
static CorbaType * toAny(const StdType &tp)
RTT::corba::PairSeq sequence
Used for the conversion of types that are binary compatible between CORBA type and std C++ type...
static CORBA::Any_ptr createAny(const StdType &t)
RTT::corba::CAnySequence sequence
AnyConversion< T >::sequence CorbaType
static bool toStdType(StdType &tp, const CorbaType &cb)
static std::ostream & endl(std::ostream &__os)
std::pair< T1, T2 > StdType
static bool toStdType(StdType &tp, const CorbaType &cb)
Updates tp with the contents of cb.
static bool update(const CORBA::Any &any, StdType &_value)
sequence< any > CAnySequence
static bool toCorbaType(CORBA::Any &any, const StdType &tp)
RTT::corba::PairSeq CorbaType
static CORBA::Any_ptr createAny(const StdType &t)
RTT::corba::Pair CorbaType
static bool update(const CORBA::Any &any, StdType &_value)
static Logger & log()
As Instance(), but more userfriendly.
static bool updateAny(StdType const &t, CORBA::Any &any)
static CORBA::Any_ptr createAny(StdType tp)
Creates an CORBA::Any object out of a C++/IDL type.
std::map< T1, T2, _Compare, _Alloc > StdType
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
static Type & fromAny(Type &t)
static bool toCorbaType(CORBA::Any &any, const StdType &tp)
std::vector< T, _Alloc > StdType
static bool update(const CORBA::Any &any, StdType &_value)
RTT::corba::CAnySequence sequence
sequence of corba type (used to convert stl container)
static CorbaType * toAny(const StdType &tp)
static CorbaType * toAny(const StdType &tp)
static bool updateAny(StdType const &t, CORBA::Any &any)
static bool updateAny(const Type &t, CORBA::Any &any)