File tree Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -126,4 +126,11 @@ TEST(message, routing_id_persists)
126
126
msg.set_routing_id (123 );
127
127
ASSERT_EQ (123u , msg.routing_id ());
128
128
}
129
+
130
+ TEST (message, group_persists)
131
+ {
132
+ zmq::message_t msg;
133
+ msg.set_group (" mygroup" );
134
+ ASSERT_STREQ (" mygroup" , msg.group ());
135
+ }
129
136
#endif
Original file line number Diff line number Diff line change @@ -409,6 +409,18 @@ class message_t
409
409
if (rc != 0 )
410
410
throw error_t ();
411
411
}
412
+
413
+ inline const char * group () const
414
+ {
415
+ return zmq_msg_group (const_cast <zmq_msg_t *>(&msg));
416
+ }
417
+
418
+ inline void set_group (const char * group)
419
+ {
420
+ int rc = zmq_msg_set_group (&msg, group);
421
+ if (rc != 0 )
422
+ throw error_t ();
423
+ }
412
424
#endif
413
425
414
426
/* * Dump content to string. Ascii chars are readable, the rest is printed as hex.
@@ -546,9 +558,11 @@ enum class socket_type : int
546
558
xsub = ZMQ_XSUB,
547
559
push = ZMQ_PUSH,
548
560
pull = ZMQ_PULL,
549
- #ifdef ZMQ_BUILD_DRAFT_API
561
+ #if defined( ZMQ_BUILD_DRAFT_API) && ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 0)
550
562
server = ZMQ_SERVER,
551
563
client = ZMQ_CLIENT,
564
+ radio = ZMQ_RADIO,
565
+ dish = ZMQ_DISH,
552
566
#endif
553
567
#if ZMQ_VERSION_MAJOR >= 4
554
568
stream = ZMQ_STREAM,
@@ -715,6 +729,22 @@ class socket_t
715
729
throw error_t ();
716
730
}
717
731
732
+ #if defined(ZMQ_BUILD_DRAFT_API) && ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 0)
733
+ inline void join (const char * group)
734
+ {
735
+ int rc = zmq_join (ptr, group);
736
+ if (rc != 0 )
737
+ throw error_t ();
738
+ }
739
+
740
+ inline void leave (const char * group)
741
+ {
742
+ int rc = zmq_leave (ptr, group);
743
+ if (rc != 0 )
744
+ throw error_t ();
745
+ }
746
+ #endif
747
+
718
748
private:
719
749
inline void init (context_t &context_, int type_)
720
750
{
You can’t perform that action at this time.
0 commit comments