summaryrefslogtreecommitdiff
path: root/src/zmq.cpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2010-12-06 22:57:29 +0100
committerMartin Sustrik <sustrik@250bpm.com>2010-12-06 22:57:29 +0100
commit8d6cafe06696e17afff03adf4b33bd504b55e277 (patch)
treef84d638376281ae1e7e0ef2d1f1ab909d3f9130a /src/zmq.cpp
parentec61751e17fe4ceb62cc16750b12df6056c5962a (diff)
All devices conflated into a single implementation.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src/zmq.cpp')
-rw-r--r--src/zmq.cpp24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/zmq.cpp b/src/zmq.cpp
index 6a1d396..c9fae28 100644
--- a/src/zmq.cpp
+++ b/src/zmq.cpp
@@ -39,9 +39,7 @@
#include <stdlib.h>
#include <new>
-#include "forwarder.hpp"
-#include "queue.hpp"
-#include "streamer.hpp"
+#include "device.hpp"
#include "socket_base.hpp"
#include "msg_content.hpp"
#include "stdint.hpp"
@@ -685,19 +683,15 @@ int zmq_device (int device_, void *insocket_, void *outsocket_)
errno = EFAULT;
return -1;
}
- switch (device_) {
- case ZMQ_FORWARDER:
- return zmq::forwarder ((zmq::socket_base_t*) insocket_,
- (zmq::socket_base_t*) outsocket_);
- case ZMQ_QUEUE:
- return zmq::queue ((zmq::socket_base_t*) insocket_,
- (zmq::socket_base_t*) outsocket_);
- case ZMQ_STREAMER:
- return zmq::streamer ((zmq::socket_base_t*) insocket_,
- (zmq::socket_base_t*) outsocket_);
- default:
- return EINVAL;
+
+ if (device_ != ZMQ_FORWARDER && device_ != ZMQ_QUEUE &&
+ device_ != ZMQ_STREAMER) {
+ errno = EINVAL;
+ return -1;
}
+
+ return zmq::device ((zmq::socket_base_t*) insocket_,
+ (zmq::socket_base_t*) outsocket_);
}
////////////////////////////////////////////////////////////////////////////////