Skip to content

Commit

Permalink
Squash merge remote branch 'nzmqt/master' into devel/logging-zeromq
Browse files Browse the repository at this point in the history
    Merged from commit 7aa70b52d743aa894213ac3268f0d12cab8d0345 on
    git://github.com/jonnydee/nzmqt.git

nzmqt is released under simplified BSD license
  • Loading branch information
Beirdo committed Apr 23, 2012
1 parent 1d315f8 commit ea54752
Show file tree
Hide file tree
Showing 17 changed files with 2,039 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mythtv/external/nzmqt/.hgignore
@@ -0,0 +1,7 @@
syntax: glob
Debug
Release
**.user
**.orig
**.DS_Store

8 changes: 8 additions & 0 deletions mythtv/external/nzmqt/CHANGELOG.txt
@@ -0,0 +1,8 @@
Release 0.7
-----------
* Introduced enumeration types for several ZMQ constants for type-safety.
* Added a new polling based implementation that works for all ZMQ communication protocols.
* Dropped support for REQ-REP protocol for old 'QSocketNotifier' based implementation.
* Added some more convenience methods to 'ZMQSocket' class.
* Old and new socket implementations now emit a signal with a received message as parameter.

25 changes: 25 additions & 0 deletions mythtv/external/nzmqt/COPYING.txt
@@ -0,0 +1,25 @@
Copyright 2011-2012 Johann Duscher. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list
of conditions and the following disclaimer in the documentation and/or other materials
provided with the distribution.

THIS SOFTWARE IS PROVIDED BY JOHANN DUSCHER ''AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The views and conclusions contained in the software and documentation are those of the
authors and should not be interpreted as representing official policies, either expressed
or implied, of Johann Duscher.
25 changes: 25 additions & 0 deletions mythtv/external/nzmqt/LICENSE.header
@@ -0,0 +1,25 @@
// Copyright 2011-2012 Johann Duscher. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY JOHANN DUSCHER ''AS IS'' AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// The views and conclusions contained in the software and documentation are those of the
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Johann Duscher.
83 changes: 83 additions & 0 deletions mythtv/external/nzmqt/README.markdown
@@ -0,0 +1,83 @@
nzmqt - A lightweight C++ [Qt][] binding for [ZeroMQ][]
======================================================

nzmqt is a re-implementation of the approach taken by the [zeromqt][] library. The idea
is to integrate ZeroMQ into the Qt event loop, mapping ZeroMQ message events onto
Qt signals. The original implementation also provides a Qt-like API
which allows to represent messages as QByteArray instances. While I took this idea
and the original implementation as a source of information, I've done a completely
new implementation. Not only in order to get rid of some short comings, but also
because I wanted to be sure I can use the code in my projects without problems,
because until now zeromqt's author hasn't officially released his work under a certain
(open source) license. Consequently, nzmqt is released to the public under the
simplified BSD license. So you can use the code in your projects without any fear.

While zeromqt works fine for non-multi-part messages, it doesn't support multi-part
messages yet. Also, a lot of code duplicates code of ZeroMQ's standard C++ binding.
But this requires to take care of both implementations. So in contrast to the original
implementation, nzmqt reuses as much code of ZeroMQ's original C++ binding as possible
by using inheritance. Additionally, several things have been changed from a user's
perspective. In summary, nzmqt contains the following changes compared to zeromqt:

* The implementation is a complete re-write in the sense that it doesn't duplicate code
of ZeroMQ's official C++ binding anymore. Instead, it builds upon existing code
through inheritance and, hence, it will likely benefit from future bugfixes and
enhancements targeted at ZeroMQ's C++ binding.
* All classes are placed into a separate namespace 'nzmqt'.
* This version now also supports ZeroMQ's multi-part messages.
* The initial support for using Qt's way of handling errors using error codes
has been dropped. Instead, this code only throws exception originally thrown
by ZeroMQ's official C++ API. Note that although it looks like 'ZMQException'
is a new custom exception class there is no custom exception class, but only
a simple typedef which places the original exception class into the new
namespace giving it a new name.
* As with ZeroMQ's C++ binding all classes are contained within a singe header
file which makes integrating this Qt binding very easy.
* There is no 'ZmqContext' singleton anymore. Instead you can create your
own instance of a concrete subclass of 'ZMQContext' yourself.
* The socket class 'ZMQSocket' now also inherits from QObject, so you can
add it as a child to any QObject parent as you know it from Qt.
* The code is officially licensed under the simplified BSD license.
* Not only PUB-SUB, but also REQ-REP and PUSH-PULL are supported.

Status
------

See the [official bug tracker](https://github.com/jonnydee/nzmqt/issues "https://github.com/jonnydee/nzmqt/issues").

Usage
-----

As ZeroMQ's C++ binding this Qt binding only consists of a single C++ header file
which you need to include in your project.

Consequently, using 'nzmqt' in a Qt project is as simple as adding that single header
file to your project's .pro file as follows (assumed you use QT Creator).

HEADERS += nzmqt/nzmqt.hpp

If not already done, you also need to link against ZeroMQ library:

LIBS += -lzmq

Of course, you need to make sure the header file as well as the ZeroMQ library
can be found by your compiler/linker.

As nzmqt uses C++ exceptions for error handling so you will need to catch them
by overriding QCoreApplication::notify() method. The included sample will
show you how this can be done.

Included Samples
----------------

Currently, there are samples showing PUB-SUB, REQ-REP and PUSH-PULL protocol with multi-part
messages in action. They also show how to deal with exceptions in Qt.

More Information
----------------

[nzmqt](https://github.com/jonnydee/nzmqt "https://github.com/jonnydee/nzmqt")

[Qt]: http://qt.nokia.com/ "Qt"
[ZeroMQ]: http://zeromq.com/ "ZeroMQ"
[zeromqt]: https://github.com/wttw/zeromqt "zeromqt"

0 comments on commit ea54752

Please sign in to comment.