9 #ifndef CPPSERVER_NANOMSG_MESSAGE_H 10 #define CPPSERVER_NANOMSG_MESSAGE_H 14 #include "errors/exceptions.h" 64 explicit operator
bool()
const {
return (_buffer ==
nullptr); }
67 uint8_t*
buffer() noexcept {
return _buffer; }
69 const uint8_t*
buffer() const noexcept {
return _buffer; }
71 size_t size() const noexcept {
return _size; }
73 int type() const noexcept {
return _type; }
85 std::string
string()
const {
return std::string((
const char*)_buffer, _size); }
89 { os << instance.
string();
return os; }
106 #endif // CPPSERVER_NANOMSG_MESSAGE_H void Reallocate(size_t size)
Reallocate the message size.
int type() const noexcept
Get the message type.
size_t size() const noexcept
Get the message size.
C++ Server project definitions.
std::string string() const
Convert the current message to a string.
Nanomsg C++ Library definition.
uint8_t * buffer() noexcept
Get the message buffer.
friend std::ostream & operator<<(std::ostream &os, const Message &instance)
Output instance into the given output stream.
Nanomsg message inline implementation.
Message()
Create an empty message.
void Clear()
Clear the message buffer.
const uint8_t * buffer() const noexcept
Get the constant message buffer.
void swap(Message &message) noexcept
Swap two instances.