All Projects → zeromq → Cppzmq

zeromq / Cppzmq

Licence: mit
Header-only C++ binding for libzmq

Projects that are alternatives of or similar to Cppzmq

Nteract
📘 The interactive computing suite for you! ✨
Stars: ✭ 5,713 (+446.7%)
Mutual labels:  zeromq
Swiftyform
iOS framework for creating forms
Stars: ✭ 907 (-13.21%)
Mutual labels:  binding
Godot Python
Python support for Godot 🐍🐍🐍
Stars: ✭ 944 (-9.67%)
Mutual labels:  binding
Cimgui
c-api for imgui (https://github.com/ocornut/imgui) Look at: https://github.com/cimgui for other widgets
Stars: ✭ 707 (-32.34%)
Mutual labels:  binding
Bluezero
Middleware for distributed applications
Stars: ✭ 17 (-98.37%)
Mutual labels:  zeromq
Eve Live
EVELive provides real-time pricing data for the MMORPG EVE Online
Stars: ✭ 8 (-99.23%)
Mutual labels:  zeromq
Qtsharp
Mono/.NET bindings for Qt
Stars: ✭ 532 (-49.09%)
Mutual labels:  binding
Eclipse Smarthome Bluetooth Binding
Eclipse SmartHome Bluetooth Binding
Stars: ✭ 44 (-95.79%)
Mutual labels:  binding
Vuex Mappers
Component agnostic Vuex mappers
Stars: ✭ 19 (-98.18%)
Mutual labels:  binding
Ruby Apt Pkg
Ruby interface to apt-pkg
Stars: ✭ 15 (-98.56%)
Mutual labels:  binding
Go Duktape
Duktape JavaScript engine bindings for Go
Stars: ✭ 747 (-28.52%)
Mutual labels:  binding
Vital Development
Stars: ✭ 16 (-98.47%)
Mutual labels:  zeromq
Mruby Actor
A actor library for distributed mruby
Stars: ✭ 11 (-98.95%)
Mutual labels:  zeromq
Leveldown
Pure C++ Node.js LevelDB binding. An abstract-leveldown compliant store.
Stars: ✭ 678 (-35.12%)
Mutual labels:  binding
Eventing
Open source specification and implementation of Knative event binding and delivery
Stars: ✭ 980 (-6.22%)
Mutual labels:  binding
Imgui Sfml
Dear ImGui binding for use with SFML
Stars: ✭ 596 (-42.97%)
Mutual labels:  binding
Glbind
Single file OpenGL API loader.
Stars: ✭ 23 (-97.8%)
Mutual labels:  binding
Zeromq Ng
⚡️ Next-generation Node.js bindings to the ZeroMQ library
Stars: ✭ 45 (-95.69%)
Mutual labels:  zeromq
Zeroeq
Cross-platform C++ library for fast binary and REST messaging
Stars: ✭ 35 (-96.65%)
Mutual labels:  zeromq
Libzmq
ZeroMQ core engine in C++, implements ZMTP/3.1
Stars: ✭ 7,418 (+609.86%)
Mutual labels:  zeromq

Travis-CI Status Appveyor Status Coverage Status License

Introduction & Design Goals

cppzmq is a C++ binding for libzmq. It has the following design goals:

  • cppzmq maps the libzmq C API to C++ concepts. In particular:
    • it is type-safe (the libzmq C API exposes various class-like concepts as void*)
    • it provides exception-based error handling (the libzmq C API provides errno-based error handling)
    • it provides RAII-style classes that automate resource management (the libzmq C API requires the user to take care to free resources explicitly)
  • cppzmq is a light-weight, header-only binding. You only need to include the header file zmq.hpp (and maybe zmq_addon.hpp) to use it.
  • zmq.hpp is meant to contain direct mappings of the abstractions provided by the libzmq C API, while zmq_addon.hpp provides additional higher-level abstractions.

There are other C++ bindings for ZeroMQ with different design goals. In particular, none of the following bindings are header-only:

  • zmqpp is a high-level binding to libzmq.
  • czmqpp is a binding based on the high-level czmq API.
  • fbzmq is a binding that integrates with Apache Thrift and provides higher-level abstractions in addition. It requires C++14.

Supported platforms

  • Only a subset of the platforms that are supported by libzmq itself are supported. Some features already require a compiler supporting C++11. In the future, probably all features will require C++11. To build and run the tests, CMake and Catch are required.
  • Any libzmq 4.x version is expected to work. DRAFT features may only work for the most recent tested version. Currently explicitly tested libzmq versions are
    • 4.2.0 (without DRAFT API)
    • 4.2.5 (without DRAFT API)
    • 4.3.1 (with and without DRAFT API)
  • Platforms with full support (i.e. CI executing build and tests)
    • Ubuntu 14.04 x64 (with gcc 4.8.4) (without DRAFT API only)
    • Ubuntu 14.04 x64 (with gcc 7.3.0)
    • Visual Studio 2015 x86
    • Visual Studio 2017 x86
    • OSX (with clang xcode9.1) (without DRAFT API)
  • Additional platforms that are known to work:
    • We have no current reports on additional platforms that are known to work yet. Please add your platform here. If CI can be provided for them with a cloud-based CI service working with GitHub, you are invited to add CI, and make it possible to be included in the list above.
  • Additional platforms that probably work:
    • Any platform supported by libzmq that provides a sufficiently recent gcc (4.8.1 or newer) or clang (3.4.1 or newer)
    • Visual Studio 2012+ x86/x64

Examples

These examples require at least C++11.

#include <zmq.hpp>

int main()
{
    zmq::context_t ctx;
    zmq::socket_t sock(ctx, zmq::socket_type::push);
    sock.bind("inproc://test");
    sock.send(zmq::str_buffer("Hello, world"), zmq::send_flags::dontwait);
}

This a more complex example where we send and receive multi-part messages over TCP with a wildcard port.

#include <iostream>
#include <zmq_addon.hpp>

int main()
{
    zmq::context_t ctx;
    zmq::socket_t sock1(ctx, zmq::socket_type::push);
    zmq::socket_t sock2(ctx, zmq::socket_type::pull);
    sock1.bind("tcp://127.0.0.1:*");
    const std::string last_endpoint =
        sock1.get(zmq::sockopt::last_endpoint);
    std::cout << "Connecting to "
              << last_endpoint << std::endl;
    sock2.connect(last_endpoint);

    std::array<zmq::const_buffer, 2> send_msgs = {
        zmq::str_buffer("foo"),
        zmq::str_buffer("bar!")
    };
    if (!zmq::send_multipart(sock1, send_msgs))
        return 1;

    std::vector<zmq::message_t> recv_msgs;
    const auto ret = zmq::recv_multipart(
        sock2, std::back_inserter(recv_msgs));
    if (!ret)
        return 1;
    std::cout << "Got " << *ret
              << " messages" << std::endl;
    return 0;
}

See the examples directory for more examples. When the project is compiled with tests enabled, each example gets compiled to an executable.

Compatibility Guidelines

The users of cppzmq are expected to follow the guidelines below to ensure not to break when upgrading cppzmq to newer versions (non-exhaustive list):

  • Do not depend on any macros defined in cppzmq unless explicitly declared public here.

The following macros may be used by consumers of cppzmq: CPPZMQ_VERSION, CPPZMQ_VERSION_MAJOR, CPPZMQ_VERSION_MINOR, CPPZMQ_VERSION_PATCH.

Contribution policy

The contribution policy is at: http://rfc.zeromq.org/spec:22

Build instructions

Build steps:

  1. Build libzmq via cmake. This does an out of source build and installs the build files

    • download and unzip the lib, cd to directory
    • mkdir build
    • cd build
    • cmake ..
    • sudo make -j4 install
  2. Build cppzmq via cmake. This does an out of source build and installs the build files

    • download and unzip the lib, cd to directory
    • mkdir build
    • cd build
    • cmake ..
    • sudo make -j4 install

Using this:

A cmake find package scripts is provided for you to easily include this library. Add these lines in your CMakeLists.txt to include the headers and library files of cpp zmq (which will also include libzmq for you).

#find cppzmq wrapper, installed by make of cppzmq
find_package(cppzmq)
target_link_libraries(*Your Project Name* cppzmq)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].