mirror of
https://github.com/zeromq/cppzmq.git
synced 2024-12-14 02:57:48 +01:00
Merge pull request #235 from Tulon/master
Add message_t::routing_id() and set_routing_id()
This commit is contained in:
commit
7023764834
@ -118,3 +118,12 @@ TEST(message, equality_non_equal_lhs_empty)
|
|||||||
const zmq::message_t msg_b("Hi", 2);
|
const zmq::message_t msg_b("Hi", 2);
|
||||||
ASSERT_NE(msg_a, msg_b);
|
ASSERT_NE(msg_a, msg_b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(ZMQ_BUILD_DRAFT_API) && ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 0)
|
||||||
|
TEST(message, routing_id_persists)
|
||||||
|
{
|
||||||
|
zmq::message_t msg;
|
||||||
|
msg.set_routing_id(123);
|
||||||
|
ASSERT_EQ(123u, msg.routing_id());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
15
zmq.hpp
15
zmq.hpp
@ -396,6 +396,21 @@ class message_t
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(ZMQ_BUILD_DRAFT_API) && ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 0)
|
||||||
|
inline uint32_t routing_id() const
|
||||||
|
{
|
||||||
|
return zmq_msg_routing_id(const_cast<zmq_msg_t*>(&msg));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void set_routing_id(uint32_t routing_id)
|
||||||
|
{
|
||||||
|
int rc = zmq_msg_set_routing_id(&msg, routing_id);
|
||||||
|
if (rc != 0)
|
||||||
|
throw error_t();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Dump content to string. Ascii chars are readable, the rest is printed as hex.
|
/** Dump content to string. Ascii chars are readable, the rest is printed as hex.
|
||||||
* Probably ridiculously slow.
|
* Probably ridiculously slow.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user