Skip to content

Commit

Permalink
corba: moved CORBA_PORTS_DISABLE_SIGNAL checks from headers to implem…
Browse files Browse the repository at this point in the history
…entation

Signed-off-by: Johannes Meyer <[email protected]>
  • Loading branch information
meyerj committed Dec 15, 2015
1 parent 3ef27b9 commit 2f34384
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 11 deletions.
2 changes: 1 addition & 1 deletion rtt/transports/corba/CorbaLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ namespace RTT {

virtual base::ChannelElementBase* buildDataStorage(ConnPolicy const& policy) const { return 0; }

virtual CRemoteChannelElement_i* createChannelElement_i(DataFlowInterface*, ::PortableServer::POA* poa, bool) const {
virtual CRemoteChannelElement_i* createChannelElement_i(DataFlowInterface*, ::PortableServer::POA* poa, bool, bool) const {
Logger::In in("CorbaFallBackProtocol");
log(Error) << "Could create Channel : data type not known to CORBA Transport." <<Logger::endl;
return 0;
Expand Down
4 changes: 2 additions & 2 deletions rtt/transports/corba/CorbaTemplateProtocol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ namespace RTT
*/
typedef typename Property<T>::DataSourceType PropertyType;

CRemoteChannelElement_i* createChannelElement_i(DataFlowInterface* sender,PortableServer::POA_ptr poa, bool is_pull) const
{ return new RemoteChannelElement<T>(*this, sender, poa, is_pull); }
CRemoteChannelElement_i* createChannelElement_i(DataFlowInterface* sender,PortableServer::POA_ptr poa, bool is_pull, bool is_signalling) const
{ return new RemoteChannelElement<T>(*this, sender, poa, is_pull, is_signalling); }

/**
* Create an transportable object for a \a protocol which contains the value of \a source.
Expand Down
2 changes: 1 addition & 1 deletion rtt/transports/corba/CorbaTypeTransporter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ namespace RTT {
* @param poa The POA to manage the server code.
* @return the created CChannelElement_i.
*/
virtual CRemoteChannelElement_i* createChannelElement_i(DataFlowInterface* sender, ::PortableServer::POA* poa, bool is_pull) const = 0;
virtual CRemoteChannelElement_i* createChannelElement_i(DataFlowInterface* sender, ::PortableServer::POA* poa, bool is_pull, bool is_signalling) const = 0;

/**
* The CORBA transport does not support creating 'CORBA' streams.
Expand Down
14 changes: 12 additions & 2 deletions rtt/transports/corba/DataFlowI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,13 @@ CChannelElement_ptr CDataFlowInterface_i::buildChannelOutput(
ConnPolicy policy2 = toRTT(corba_policy);

ChannelElementBase::shared_ptr end = type_info->buildChannelOutput(*port);
#ifndef CORBA_PORTS_DISABLE_SIGNAL
bool is_signalling = true;
#else
bool is_signalling = false;
#endif
CRemoteChannelElement_i* this_element =
transporter->createChannelElement_i(mdf, mpoa, corba_policy.pull);
transporter->createChannelElement_i(mdf, mpoa, corba_policy.pull, is_signalling);
this_element->setCDataFlowInterface(this);

/*
Expand Down Expand Up @@ -480,7 +485,12 @@ CChannelElement_ptr CDataFlowInterface_i::buildChannelInput(

// The channel element that exposes our channel in CORBA
CRemoteChannelElement_i* this_element;
PortableServer::ServantBase_var servant = this_element = transporter->createChannelElement_i(mdf, mpoa, corba_policy.pull);
#ifndef CORBA_PORTS_DISABLE_SIGNAL
bool is_signalling = true;
#else
bool is_signalling = false;
#endif
PortableServer::ServantBase_var servant = this_element = transporter->createChannelElement_i(mdf, mpoa, corba_policy.pull, is_signalling);
this_element->setCDataFlowInterface(this);

// Attach the corba channel element first (so OOB is after corba).
Expand Down
14 changes: 10 additions & 4 deletions rtt/transports/corba/RemoteChannelElement.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,22 @@ namespace RTT {

PortableServer::ObjectId_var oid;

/**
* If signalling is false, no remoteSignal() calls will be forwarded to remote channel elements.
*/
bool signalling;

public:
/**
* Create a channel element for remote data exchange.
* @param transport The type specific object that will be used to marshal the data.
* @param poa The POA that manages the underlying CRemoteChannelElement_i.
*/
RemoteChannelElement(CorbaTypeTransporter const& transport, DataFlowInterface* sender, PortableServer::POA_ptr poa, bool is_pull)
RemoteChannelElement(CorbaTypeTransporter const& transport, DataFlowInterface* sender, PortableServer::POA_ptr poa, bool is_pull, bool is_signalling)
: CRemoteChannelElement_i(transport, poa)
, valid(true), pull(is_pull)
, msender(sender)
, signalling(is_signalling)
{
// Big note about cleanup: The RTT will dispose this object through
// the ChannelElement<T> refcounting. So we only need to inform the
Expand Down Expand Up @@ -138,9 +144,9 @@ namespace RTT {
if ( pull ) {
try
{
#ifndef CORBA_PORTS_DISABLE_SIGNAL
remote_side->remoteSignal();
#endif
if (signalling) {
remote_side->remoteSignal();
}
}
#ifdef CORBA_IS_OMNIORB
catch(CORBA::SystemException& e)
Expand Down
7 changes: 6 additions & 1 deletion rtt/transports/corba/RemotePorts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,14 @@ RTT::base::ChannelElementBase::shared_ptr RemoteInputPort::buildRemoteChannelOut

// Input side is now ok and waiting for us to complete. We build our corba channel element too
// and connect it to the remote side and vice versa.
#ifndef CORBA_PORTS_DISABLE_SIGNAL
bool is_signalling = true;
#else
bool is_signalling = false;
#endif
CRemoteChannelElement_i* local =
static_cast<CorbaTypeTransporter*>(type->getProtocol(ORO_CORBA_PROTOCOL_ID))
->createChannelElement_i(output_port.getInterface(), mpoa, policy.pull);
->createChannelElement_i(output_port.getInterface(), mpoa, policy.pull, is_signalling);

CRemoteChannelElement_var proxy = local->_this();
local->setRemoteSide(remote);
Expand Down

0 comments on commit 2f34384

Please sign in to comment.