forked from zeromq/zeromq.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathincoming_msg.h
40 lines (30 loc) · 805 Bytes
/
incoming_msg.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* Copyright (c) 2017-2019 Rolf Timmermans */
#pragma once
#include "prefix.h"
namespace zmq {
class IncomingMsg {
public:
IncomingMsg();
~IncomingMsg();
IncomingMsg(const IncomingMsg&) = delete;
IncomingMsg& operator=(const IncomingMsg&) = delete;
Napi::Value IntoBuffer(const Napi::Env& env);
inline operator zmq_msg_t*() {
return *ref;
}
private:
class Reference {
zmq_msg_t msg;
public:
Reference();
~Reference();
inline operator zmq_msg_t*() {
return &msg;
}
};
Reference* ref = nullptr;
bool moved = false;
};
}
static_assert(!std::is_copy_constructible<zmq::IncomingMsg>::value, "not copyable");
static_assert(!std::is_move_constructible<zmq::IncomingMsg>::value, "not movable");