commit 526a4adc3102ba0ec72ca1135cecf669e42d1f76 Author: Peter Soetens Date: Thu Jun 18 12:12:21 2009 +0200 Fixed up the spurious Failed to create... void CORBA errors. void is now an 'officially registred' type for both local and CORBA typed communication. diff --git a/src/DataSource.cpp b/src/DataSource.cpp index d0bc429..a6677bc 100644 --- a/src/DataSource.cpp +++ b/src/DataSource.cpp @@ -190,9 +190,10 @@ namespace RTT const std::string& DataSourceTypeInfo::getType() { return tname; } const std::string& DataSourceTypeInfo::getQualifier() { return DataSourceTypeInfo::noqual; } const TypeInfo* DataSourceTypeInfo::getTypeInfo() { - return DataSourceTypeInfo::getTypeInfo(); + if (!TypeInfoObject) + return DataSourceTypeInfo::getTypeInfo(); + return TypeInfoObject; } - } } diff --git a/src/RealTimeToolkit.cpp b/src/RealTimeToolkit.cpp index fc1ebd5..4ac280d 100644 --- a/src/RealTimeToolkit.cpp +++ b/src/RealTimeToolkit.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -128,6 +129,7 @@ namespace RTT ti->addType( new TemplateTypeInfo("uint") ); ti->addType( new TemplateTypeInfo("double") ); ti->addType( new BoolTypeInfo() ); + ti->addType( new TypeInfoName("void")); #ifndef ORO_EMBEDDED ti->addType( new TemplateTypeInfo("PropertyBag") ); diff --git a/src/TypeInfoName.hpp b/src/TypeInfoName.hpp index 264b2f7..a182a42 100644 --- a/src/TypeInfoName.hpp +++ b/src/TypeInfoName.hpp @@ -165,7 +165,6 @@ namespace RTT Logger::log() << Logger::Warning << "Overriding TypeInfo for '" << detail::DataSourceTypeInfo::value_type_info::TypeInfoObject->getTypeName() << "'." << Logger::endl; - delete detail::DataSourceTypeInfo::value_type_info::TypeInfoObject; } detail::DataSourceTypeInfo::value_type_info::TypeInfoObject = this; } diff --git a/src/corba/CorbaLib.cpp b/src/corba/CorbaLib.cpp index d24c2eb..08f4e10 100644 --- a/src/corba/CorbaLib.cpp +++ b/src/corba/CorbaLib.cpp @@ -52,10 +52,15 @@ namespace RTT { class CorbaFallBackProtocol : public TypeTransporter { + bool warn; + public: + CorbaFallBackProtocol(bool do_warn = true) : warn(do_warn) {} virtual void* createBlob(DataSourceBase::shared_ptr source) const { - Logger::In in("CorbaFallBackProtocol"); - log(Error) << "Failing Corba::Any creation of type "<< source->getTypeName()<<"." <getTypeName()<<"' : data type not known to CORBA Transport." <getTypeName()<<"." <getTypeName()<<"' with received data : data type not known to CORBA Transport." <getName() <getName() <( data ); return new Corba::CorbaDataObjectProxy("CorbaProxy", cp->getDataChannel()); } virtual DataSourceBase* dataProxy( void* data ) const { - log(Warning) << "Can not create a proxy for data connection." <(data); return new Corba::CorbaDataObjectProxy("CorbaProxy", ae ); } @@ -132,24 +143,30 @@ namespace RTT { * Used to setup a Corba Data Flow. */ virtual BufferBase* bufferProxy( PortInterface* data ) const { - log(Warning) << "Can not create a proxy for buffer connection of remote port "<getName() <getName() <( data ); return new Corba::CorbaBufferProxy( cp->getBufferChannel() ); } virtual BufferBase* bufferProxy( void* data ) const { - log(Warning) << "Can not create a proxy for buffer connection." <(data); return new Corba::CorbaBufferProxy( buf ); } virtual void* bufferServer( BufferBase::shared_ptr source, void* arg) const { - // arg is POA ! - log(Warning) << "Can not create a useful server for an unknown data type." << endlog(); - RTT_Corba_BufferChannel_i* cbuf = new RTT_Corba_BufferChannel_i( source ); - // activate servant: - return cbuf->_this(); + // arg is POA ! + if (warn) { + log(Warning) << "Can not create a useful server for an unknown data type." << endlog(); + } + RTT_Corba_BufferChannel_i* cbuf = new RTT_Corba_BufferChannel_i( source ); + // activate servant: + return cbuf->_this(); } /** @@ -159,7 +176,9 @@ namespace RTT { */ virtual DataSourceBase* narrowDataSource(DataSourceBase* dsb) { - log(Warning) << "Corba: Do not know how to narrow to " << dsb->getTypeName() << endlog(); + if (warn) { + log(Warning) << "Corba: Do not know how to narrow to " << dsb->getTypeName() << endlog(); + } return 0; } @@ -170,7 +189,9 @@ namespace RTT { */ virtual DataSourceBase* narrowAssignableDataSource(DataSourceBase* dsb) { - log(Warning) << "Corba: Do not know how to narrow to " << dsb->getTypeName() << endlog(); + if (warn) { + log(Warning) << "Corba: Do not know how to narrow to " << dsb->getTypeName() << endlog(); + } return 0; } @@ -200,6 +221,8 @@ namespace RTT { return ti->addProtocol(ORO_CORBA_PROTOCOL_ID, new CorbaTemplateProtocol() ); if ( name == "array" ) return ti->addProtocol(ORO_CORBA_PROTOCOL_ID, new CorbaTemplateProtocol< std::vector >() ); + if ( name == "void" ) + return ti->addProtocol(ORO_CORBA_PROTOCOL_ID, new CorbaFallBackProtocol(false)); // warn=false return false; }