38 #include <gtest/gtest.h> 63 namespace message_traits
68 static const char*
value() {
return "MsgMD5Sum"; }
69 static const char*
value(
const Msg&) {
return "MsgMD5Sum"; }
75 static const char*
value() {
return "roscpp/MsgDataType"; }
76 static const char*
value(
const Msg&) {
return "roscpp/MsgDataType"; }
82 static const char*
value() {
return ""; }
83 static const char*
value(
const Msg&) {
return ""; }
87 namespace serialization
92 template<
typename Stream>
98 template<
typename Stream>
130 namespace message_traits
135 static const char*
value() {
return "MsgMD5Sum"; }
136 static const char*
value(
const Msg2&) {
return "MsgMD5Sum"; }
142 static const char*
value() {
return "roscpp/MsgDataType"; }
143 static const char*
value(
const Msg2&) {
return "roscpp/MsgDataType"; }
149 static const char*
value() {
return ""; }
154 namespace serialization
159 template<
typename Stream>
165 template<
typename Stream>
184 TEST(IntraprocessSubscriptions, noCopy)
209 EXPECT_EQ(g_msg.get(), msg.get());
210 EXPECT_FALSE(g_msg->serialized);
211 EXPECT_FALSE(g_msg->deserialized);
215 TEST(IntraprocessSubscriptions, differentRTTI)
240 EXPECT_NE((
void*)g_msg.get(), (
void*)msg.get());
241 EXPECT_TRUE(msg->serialized);
242 EXPECT_TRUE(g_msg->deserialized);
253 TEST(IntraprocessSubscriptions, noCopyAndDifferentRTTI)
271 while (!g_msg || !g_msg2)
278 EXPECT_NE((
void*)g_msg.get(), (
void*)msg.get());
279 EXPECT_TRUE(msg->serialized);
280 EXPECT_TRUE(g_msg->deserialized);
283 EXPECT_EQ(g_msg2.get(), msg.get());
284 EXPECT_TRUE(g_msg2->serialized);
285 EXPECT_FALSE(g_msg2->deserialized);
288 int main(
int argc,
char** argv)
290 testing::InitGoogleTest(&argc, argv);
291 ros::init(argc, argv,
"intraprocess_subscriptions");
295 return RUN_ALL_TESTS();
static const char * value(const Msg &)
TEST(IntraprocessSubscriptions, noCopy)
static const char * value()
static const char * value()
void publish(const boost::shared_ptr< M > &message) const
static void write(Stream &, const Msg &v)
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
static const char * value(const Msg2 &)
static const char * value()
static const char * value()
static uint32_t serializedLength(const Msg2 &)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
static const char * value(const Msg &)
int main(int argc, char **argv)
static const char * value(const Msg2 &)
boost::shared_ptr< Msg const > MsgConstPtr
void messageCallback2(const Msg2ConstPtr &msg)
uint32_t g_msg_constructor
void messageCallback(const MsgConstPtr &msg)
static const char * value(const Msg &)
static const char * value()
static const char * value(const Msg2 &)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
static void read(Stream &, Msg &v)
static uint32_t serializedLength(const Msg &)
static const char * value()
uint32_t getNumSubscribers() const
static void write(Stream &, const Msg2 &v)
ROSCPP_DECL void spinOnce()
boost::shared_ptr< Msg2 const > Msg2ConstPtr
static void read(Stream &, Msg2 &v)
uint32_t g_msg2_constructor