36 lines
725 B
C++
36 lines
725 B
C++
/*
|
|
* Author:
|
|
* Sven Czarnian <devel@svcz.de>
|
|
* Brief:
|
|
* Implements the zmq context manager
|
|
* Copyright:
|
|
* 2021 Sven Czarnian
|
|
* License:
|
|
* GNU General Public License v3 (GPLv3)
|
|
*/
|
|
|
|
#include "ZmqContext.h"
|
|
|
|
using namespace aman;
|
|
|
|
ZmqContext::ZmqContext() : m_context() { }
|
|
|
|
void ZmqContext::initialize() {
|
|
if (nullptr == this->m_context)
|
|
this->m_context = std::make_unique<zmq::context_t>(2);
|
|
}
|
|
|
|
void ZmqContext::deinitialize() {
|
|
if (nullptr != this->m_context)
|
|
this->m_context = std::unique_ptr<zmq::context_t>();
|
|
}
|
|
|
|
zmq::context_t& ZmqContext::context() {
|
|
return *this->m_context;
|
|
}
|
|
|
|
ZmqContext& ZmqContext::instance() {
|
|
static ZmqContext __instance;
|
|
return __instance;
|
|
}
|