Commit Graph

50 Commits

Author SHA1 Message Date
Teebonne
6020e1ab36
ZMQ_NOTHROW for compatibility 2022-10-15 16:04:08 +01:00
Teebonne
fa0f112ac6
Fixes warning
This type of function should not throw, adding noexcept
2022-10-14 01:02:54 +01:00
Teebonne
dc151e2ba6
Disambiguation from other max functions
Otherwise it creates an error on some environments
2022-10-10 11:19:49 +01:00
Geir Henning Eikeland
14f304f987 Add == and != operators for multipart_t
Closes #512
2021-09-11 22:31:42 +02:00
Dominic van Berkel
b65dde8725
Add support for socket_ref to multipart_t ctor/send/recv (#487)
* Add support for socket_ref to multipart_t ctor/send/recv

Fixes #448
2021-04-27 16:41:21 +02:00
Simon Giesecke
c591113bb7
Merge pull request #460 from gummif/gfa/if-warn
Problem: if constexpr warnings on MSVC
2021-01-15 10:28:53 +01:00
Gudmundur Adalsteinsson
a7889af4bf Problem: if constexpr warnings on MSVC
Solution: Use if constexpr where possible in C++17
2020-11-26 20:55:04 +00:00
Gudmundur Adalsteinsson
486b7226cb Problem: conversion warnings
Solution: Silence them with casts
2020-11-26 20:54:09 +00:00
Gudmundur Adalsteinsson
d237615a25 Problem: Active poller double add mutates handler
Solution: Check if socket already added before storing.
2020-09-06 13:46:08 +00:00
Gudmundur Adalsteinsson
8b64a341ac Add requirement that the handler is non-null in active_poller 2020-05-24 22:38:35 +00:00
Simon Giesecke
b495021ac8
Merge pull request #404 from gummif/gfa/encoding-endian
Problem: No endian check in encoding
2020-05-15 11:58:04 +02:00
Collin H. Reed
0bba33d91c Address Grammatical Error in multipart_t:str()
Fixes grammatical error in multipart_t:str() function.
2020-05-11 13:20:06 +00:00
Gudmundur Adalsteinsson
acd7104992 Problem: Missing reference to rfc
Solution: Add link
2020-04-24 20:27:28 +00:00
Gudmundur Adalsteinsson
4784b74c37 Problem: No endian check in encoding
Solution: Always write message part sizes
using network order.
2020-04-18 13:59:42 +00:00
Brett Viren
10431084bb
Problem: lack conversion message_t and multipart_t (#391)
Solution: add encode/decode methods to multipart_t giving a codec compatible with the CZMQ equivalent.
2020-03-20 10:59:15 +01:00
Gudmundur Adalsteinsson
5ecbf86bcf Problem: send_multipart fails on old gcc versions
Solution: remove template type checks if there is only partial C++11 support
2020-03-07 13:22:01 +00:00
Simon Giesecke
b6c79eb0c8 Reformat all files with clang-format 2020-01-28 11:11:31 +01:00
Gudmundur Adalsteinsson
30fdfe0287 Simplify code by trusting the compiler 2019-12-07 12:06:15 +00:00
Gudmundur Adalsteinsson
93e3090eb3 Problem: Missing recv multipart to fixed buffers
Solution: Add recv_multipart_n function
2019-12-05 20:02:38 +00:00
Gudmundur Adalsteinsson
0ef29c1b30 Problem: Detail namespace used in API
Solution: Move types into zmq namespace
2019-11-12 19:54:28 +00:00
Gudmundur Adalsteinsson
d4d3ce3e90 Suppport for raw arrays in send_multipart 2019-11-06 08:15:37 +00:00
Gudmundur Adalsteinsson
5cc7793ef5 Improve algorithms and documentation 2019-11-05 20:33:55 +00:00
Gudmundur Adalsteinsson
505edeb336 Problem: Handling multipart messages is complex
Solution: Add generic algorithms for sending and receiving multipart
messages.
2019-10-26 19:59:46 +00:00
Philip Top
563d2355a0 Switch zmq_addon.hpp to include zmq.hpp using "zmq.hpp" instead of <zmq.hpp> This allows it to look in the current directory for the header file. This enables the ability to have cppzmq as a subdirectory of an included folder vs needing to have the cppzmq on the include search path, and makes it less likely the wrong version would get included if more than one zmq.hpp header happened to be available. 2019-10-16 05:56:24 -07:00
Gudmundur Adalsteinsson
0458f7d16c Problem: Type-safety of poller_t and active_poller_t can be improved (#318)
Problem: Type-safety of poller_t and active_poller_t can be improved
2019-05-15 08:35:12 +02:00
Gudmundur Adalsteinsson
88cee88d08 Change recv and send to return optional types 2019-05-10 14:22:04 +00:00
Gudmundur Adalsteinsson
3d4be814e8 Problem: send/recv functions lack type-safety
Solution: Add functions taking buffers and enum class flags
2019-05-05 22:05:47 +00:00
Gudmundur Adalsteinsson
c6a3529cd1 Problem: No type-safe alternatives when polling or needing a reference to a socket
Solution: Introduce a socket_ref that is a non-owning nullable reference to a socket
2019-04-19 22:10:26 +00:00
Gudmundur Adalsteinsson
83b91c8b7e Problem: Missing swap functions
Solution: Implement for socket_t, context_t, message_t and poller_t
Additionally remove dependency on <functional> by refactoring poller_t
and remove unused <unordered_map> include.
2019-04-03 13:23:17 +00:00
tangfu
5af24314c3 add front and back (#269)
* add front and back

i'll get the last message in some situations,but have to do like this :
```
multimsg msgs;
auto msg = msgs[msgs.size() - 1];
func(msg.size());
auto *msg = msgs.end() - 1;
```
but, std::queue have some method 'front' and 'back'. so maybe i can simply do this ? :
```
multimsg msgs;
auto msg = msgs.back();
```

* add test for front and back
2018-10-17 08:41:21 +01:00
Pawel Kurdybacha
ff3c221516 Problem: whitespace style too restrictive.
For header only library like cppzmq, whitespace style inherited from
libzmq is too restrictive.

Solution: relaxing whitespace before parens from always to in control
statements only, increased max column width from 80 to 85 and removing
requirement of whitespace after template keyword.
2018-05-12 17:28:28 +01:00
Giesecke
65ae6b33fd Problem: poller_t::wait_all and active_poller_t::wait declare int return type but actually return an element count
Solution: change return type to size_t, remove a redundant if in consequence
2018-05-12 09:18:46 +02:00
Pawel Kurdybacha
cd72eef3fd Problem: zmq_addon.hpp not follow clang-format 2018-05-11 20:32:23 +01:00
Simon Giesecke
3251d05636 Problem: creation of poller_events is unnecessarily complex
Solution: simplify code
2018-05-11 11:35:11 +02:00
Simon Giesecke
f700e5d6b0 Problem: deprecation warning in multipart_t
Solution: use non-deprecated operator!= instead
2018-05-11 11:33:54 +02:00
Simon Giesecke
882f5e844c Problem: extra abstraction layer type poller_t is in zmq.hpp
Solution: move to zmq_addon.hpp, rename to active_poller_t, and rename base_poller_t to poller_t
2018-05-11 11:33:53 +02:00
Simon Giesecke
dc996cd2ec Problem: zmq_addon header contains tests (with a syntax error)
Solution: convert to googletest based test, and fix syntax error
2018-05-11 11:33:53 +02:00
Giuseppe Corbelli
f945a7d032 Added an operator<<(std::ostream) to easily print out multipart_t contents using already defined str() method.
Added some comments to mark the end of preprocessor instructions / class def / namespace def
2018-03-07 14:11:41 +01:00
Martl
a475c54529 changed peektyp() to const 2017-08-17 21:56:16 +02:00
Martl
e6dd71e544 fixed peektyp check and return value 2017-08-17 21:03:36 +02:00
Luca Boccassi
d9f0f016c0 Problem: copyright years out of date
Solution: update them
List the ZeroMQ community as a shorthand for the full list of authors
as it can be found via git log
2017-07-31 14:30:55 +01:00
Vincent Tellier
0ffe2f4974 Added peekstr and peektyp methods
These methods peeks a part and return a copy of its value as a string or the specified type.
2017-06-07 09:54:37 +02:00
laplaceyang
aac1c8ac50 fix warning unused but set variable 2016-12-29 22:57:17 +08:00
laplaceyang
5cd848273a add iterator 2016-12-08 22:03:13 +08:00
laplaceyang
3483416e5a addd operator[] and at function 2016-12-08 20:46:52 +08:00
laplaceyang
72f53c8fdd lack of head file 2016-12-08 11:03:25 +08:00
Rolf Timmermans
e138b74cde Constructor for std::exception does not take string argument. 2016-10-28 14:53:22 +02:00
Harald Nøkland
da1b5e3e23 Add comments, optimize some functions, add static asserts
Add comments to all functions. Optimize move constructor and move assigment operator, remove size check inside pop/remove/peek. Static assert in pushtyp/addtyp/poptyp in order to avoid pitfall with std::string (pushstr/addstr/popstr should be used for that). Add sanity check for poptyp, size of message must match desired type.
2016-10-23 00:27:12 +02:00
Elliot Saba
93af23a58e Enable passing flags in to send() and recv() 2016-08-14 16:46:43 -07:00
Harald Nøkland
e7c2093581 Class for multipart messaging
This class handles multipart messaging. It is the C++ equivalent of zmsg.h, which is part of CZMQ (the high-level C binding). Furthermore, it is a major improvement compared to zmsg.hpp, which is part of the examples in the ØMQ Guide. Unnecessary copying is avoided by using move semantics to efficiently add/remove parts.
2016-04-06 14:20:10 +02:00