Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "micros_rtt/oro/connection_factory.hpp"
00020
00021 namespace micros_rtt
00022 {
00023
00024 bool ConnFactory::createAndCheckConnection(ConnectionBasePtr publication,
00025 ConnectionBasePtr subscription, ChannelElementBase::shared_ptr channel_input)
00026 {
00027
00028 if ( publication->addConnection(channel_input) )
00029 {
00030 ROS_DEBUG("micros connection factory adds input_end of channel to publication:%s.", publication->getTopic().c_str());
00031
00032 if ( subscription->channelReady( channel_input->getOutputEndPoint() ) == false )
00033 {
00034 ROS_WARN("micros connection factory checks channel ready failed, subscription:%s", subscription->getTopic().c_str());
00035 return false;
00036 }
00037 return true;
00038 }
00039
00040 return false;
00041 }
00042
00043 bool ConnFactory::createAndCheckStream(ConnectionBasePtr connection,
00044 ChannelElementBase::shared_ptr chan, bool is_sender)
00045 {
00046 if (is_sender)
00047 {
00048 if ( connection->addMQConnection(chan) )
00049 {
00050 ROS_DEBUG("micros connection factory adds input_end of stream to publication:%s.", connection->getTopic().c_str());
00051 return true;
00052 }
00053
00054 ROS_WARN("micros connection factory fail to add input_end of stream to publication:%s.", connection->getTopic().c_str());
00055 return false;
00056 }
00057 else
00058 {
00059 if ( connection->mqChannelReady( chan->getOutputEndPoint() ) == true )
00060 {
00061 ROS_DEBUG("micros connection factory adds output_end of stream to subscription:%s.", connection->getTopic().c_str());
00062 return true;
00063 }
00064
00065 chan = 0;
00066 ROS_WARN("micros connection factory fail to add output_end of stream to subscription:%s.", connection->getTopic().c_str());
00067 return false;
00068 }
00069 }
00070
00071 }