File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,6 +58,16 @@ class SalesData final
5858 uint_type m_sold = 0 ;
5959 uint_type m_revenue = 0 ;
6060
61+ public:
62+ void inc_sold (uint_type s) noexcept
63+ {
64+ m_sold += s;
65+ }
66+
67+ void inc_revenue (currency_type r) noexcept
68+ {
69+ m_revenue += r;
70+ }
6171public:
6272 string_view_type id () const noexcept
6373 {
Original file line number Diff line number Diff line change 99
1010BEGIN_NAMESPACE (cpp_study)
1111
12+ using zmq_context_type = zmq::context_t;
13+ using zmq_socket_type = zmq::socket_t ;
14+ using zmq_message_type = zmq::message_t ;
15+
1216template <int thread_num = 1 >
1317class ZmqContext final
1418{
19+ #if 0
1520public:
1621 using zmq_context_type = zmq::context_t;
1722 using zmq_socket_type = zmq::socket_t;
1823 using zmq_message_type = zmq::message_t;
24+ #endif
1925public:
2026 static
2127 zmq_context_type& context ()
@@ -24,9 +30,15 @@ class ZmqContext final
2430 return ctx;
2531 }
2632public:
27- zmq_socket_type socket (int mode) const
33+ zmq_socket_type socket (int mode, size_t hwm = 1000 ) const
2834 {
29- return zmq_socket_type (context (), mode);
35+ zmq_socket_type sock (context (), mode);
36+
37+ sock.setsockopt (
38+ mode == ZMQ_PULL ? ZMQ_RCVHWM : ZMQ_SNDHWM,
39+ hwm);
40+
41+ return sock;
3042 }
3143};
3244
Original file line number Diff line number Diff line change 99#include " cpplang.hpp"
1010#include " SalesData.hpp"
1111#include " SpinLock.hpp"
12+ #include " Zmq.hpp"
1213
1314int main ()
1415{
You can’t perform that action at this time.
0 commit comments