It seems that there is a bug in libzmq 4.2.0 cmake configs that prevents
linking to it without installing.
Solution: disable libzmq 4.2.0 for cmake builds
libzmq build with default settings now which build all the tests and
performance tools. This is not required for cppzmq build and slows down
it only.
Solution: disable tests build for libzmq and make it release only.
There is no need to install libzmq into the system.
Out of source build can be used later to build cppzmq.
Solution: remove install steps and rely more on cmake to handle
directory creation.
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.
Solution: copy .clang-format from `libzmq` as a starting point.
There is no need to follow exactly what libzmq does but it seems
reasonable starting point. It would be good to stick to one style as
there is a lot of activity and good ideas lately.
Solution: Constructor logic moved to the same place where cleanup is and
marking constructor `default`. Init/cleanup code is in one pleace making
it easier to read/maintain.
Latest modification to the poller made move constructor and move
assigment operator not complete. In order to prevent that in the future
poller should be default movable. Unique pointer has been used to
manager zmq_poller. That makes code simpler and safer now.
* Problem: poller can segfault when modified from registred handler.
It is possible that a user would like to add/remove sockets from
handlers. As handlers and poll items might be removed while not
being processed yet - we have a segfault situation.
Provided unit test `remove_from_handler` demonstrates the problem.
Solution: Modify internal poll item data structure only after processing
of events is finished.
Please not that events processing path performance remains the same when there are
no modification (add/remove) to the poller (no rebuild) - main real use case.
As an effect of changes `size()` method has been removed as it does not
represent any meaningful information anymore. There are active and pending
(waiting for rebuild) poll items so two different sizes. User can
easily track on their side number of registered sockets if original size
information is needed.
`wait` method returns number of processed sockets now. It might be
useful information to a user for no extra cost.
Building and installing cppzmq brings googletest build artifacts to the
installation destination as well. For example someone building cppzmq
with:
```
cmake -DCMAKE_INSTALL_PREFIX=mydest .
cmake --build --target install
```
gets googletest headers and libraries in `mydest`.
Solution: remove googletest from install target
We have a deprecated method `add` in poller that contradicts purpose of a draft
API where it can change without deprecation period.
Solution: remove the method so we do not to maintain it anymore.