mirror of
https://github.com/zeromq/cppzmq.git
synced 2025-05-05 00:35:32 +02:00
Problem: Friendship between socket_t and context_t
Solution: Not needed since the void* can be obtained from the API of context_t
This commit is contained in:
parent
91fd0b5e0e
commit
ff23b4ce95
20
zmq.hpp
20
zmq.hpp
@ -480,8 +480,6 @@ class message_t
|
|||||||
|
|
||||||
class context_t
|
class context_t
|
||||||
{
|
{
|
||||||
friend class socket_t;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline context_t()
|
inline context_t()
|
||||||
{
|
{
|
||||||
@ -586,12 +584,18 @@ class socket_t
|
|||||||
friend class monitor_t;
|
friend class monitor_t;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline socket_t(context_t &context_, int type_) { init(context_, type_); }
|
inline socket_t(context_t &context_, int type_)
|
||||||
|
: ptr(zmq_socket(static_cast<void*>(context_), type_))
|
||||||
|
, ctxptr(static_cast<void*>(context_))
|
||||||
|
{
|
||||||
|
if (ptr == ZMQ_NULLPTR)
|
||||||
|
throw error_t();
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef ZMQ_CPP11
|
#ifdef ZMQ_CPP11
|
||||||
inline socket_t(context_t &context_, socket_type type_)
|
inline socket_t(context_t &context_, socket_type type_)
|
||||||
|
: socket_t(context_, static_cast<int>(type_))
|
||||||
{
|
{
|
||||||
init(context_, static_cast<int>(type_));
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -756,14 +760,6 @@ class socket_t
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline void init(context_t &context_, int type_)
|
|
||||||
{
|
|
||||||
ctxptr = context_.ptr;
|
|
||||||
ptr = zmq_socket(context_.ptr, type_);
|
|
||||||
if (ptr == ZMQ_NULLPTR)
|
|
||||||
throw error_t();
|
|
||||||
}
|
|
||||||
|
|
||||||
void *ptr;
|
void *ptr;
|
||||||
void *ctxptr;
|
void *ctxptr;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user