zmqpp  4.1.2
C++ bindings for 0mq (libzmq)
frame.hpp
Go to the documentation of this file.
1 /*
2  * This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5  *
6  * This file is part of zmqpp.
7  * Copyright (c) 2011-2015 Contributors as noted in the AUTHORS file.
8  */
9 
17 #ifndef ZMQPP_MESSAGE_FRAME_HPP_
18 #define ZMQPP_MESSAGE_FRAME_HPP_
19 
20 #include <zmq.h>
21 
22 #include "compatibility.hpp"
23 
24 namespace zmqpp {
25 
34 {
35 public:
36  frame();
37  frame(size_t const size);
38  frame(void const* part, size_t const size);
39  frame(void* part, size_t const size, zmq_free_fn *ffn, void *hint);
40 
41  ~frame();
42 
43  bool is_sent() const { return _sent; }
44  void const* data() const { return zmq_msg_data( const_cast<zmq_msg_t*>(&_msg) ); }
45  size_t size() const { return zmq_msg_size( const_cast<zmq_msg_t*>(&_msg) ); }
46 
47  void mark_sent() { _sent = true; }
48  zmq_msg_t& msg() { return _msg; }
49 
50  // Move operators
51  frame(frame&& other);
52  frame& operator=(frame&& other);
53 
54  frame copy() const;
55 
56 private:
57  zmq_msg_t _msg;
58  bool _sent;
59 
60  // Disable implicit copy support, code must request a copy to clone
63 };
64 
65 } // namespace zmqpp
66 
67 #endif /* ZMQPP_MESSAGE_FRAME_HPP_ */
an internal frame wrapper for a single zmq message
Definition: frame.hpp:34
zmq_msg_t & msg()
Definition: frame.hpp:48
void const * data() const
Definition: frame.hpp:44
size_t size() const
Definition: frame.hpp:45
bool _sent
Definition: frame.hpp:58
frame & operator=(frame const &) NOEXCEPT ZMQPP_EXPLICITLY_DELETED
void mark_sent()
Definition: frame.hpp:47
bool is_sent() const
Definition: frame.hpp:43
frame(frame const &) NOEXCEPT ZMQPP_EXPLICITLY_DELETED
zmq_msg_t _msg
Definition: frame.hpp:57
#define NOEXCEPT
Definition: compatibility.hpp:122
#define ZMQPP_EXPORT
Definition: compatibility.hpp:39
#define ZMQPP_EXPLICITLY_DELETED
Definition: compatibility.hpp:107
C++ wrapper around zmq.
Definition: actor.cpp:30