Skip to content

Commit

Permalink
default to msgq
Browse files Browse the repository at this point in the history
  • Loading branch information
pd0wm committed Nov 8, 2019
1 parent fbc4a4c commit a054864
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions messaging/messaging.cc
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
#include "messaging.hpp"
#include "impl_zmq.hpp"
#include "impl_msgq.hpp"

Context * Context::create(){
Context * c = new ZMQContext();
Context * c;
if (std::getenv("ZMQ")){
c = new ZMQContext();
} else {
c = new MSGQContext();
}
return c;
}

SubSocket * SubSocket::create(){
SubSocket * s = new ZMQSubSocket();
SubSocket * s;
if (std::getenv("ZMQ")){
s = new ZMQSubSocket();
} else {
s = new MSGQSubSocket();
}
return s;
}

Expand All @@ -26,7 +37,12 @@ SubSocket * SubSocket::create(Context * context, std::string endpoint, std::stri
}

PubSocket * PubSocket::create(){
PubSocket * s = new ZMQPubSocket();
PubSocket * s;
if (std::getenv("ZMQ")){
s = new ZMQPubSocket();
} else {
s = new MSGQPubSocket();
}
return s;
}

Expand All @@ -37,7 +53,12 @@ PubSocket * PubSocket::create(Context * context, std::string endpoint){
}

Poller * Poller::create(){
Poller * p = new ZMQPoller();
Poller * p;
if (std::getenv("ZMQ")){
p = new ZMQPoller();
} else {
p = new MSGQPoller();
}
return p;
}

Expand Down

0 comments on commit a054864

Please sign in to comment.