Frame

An object that encapsulates a $(ZMQ) message frame.

This struct is a wrapper around a zmq_msg_t object. A default-initialized Frame is not a valid $(ZMQ) message frame; it should always be explicitly initialized upon construction using $(FREF _Frame.opCall). Alternatively, it may be initialized later with $(FREF _Frame.rebuild).

Frame msg1;                 // Invalid frame
auto msg2 = Frame();        // Empty frame
auto msg3 = Frame(1024);    // 1K frame
msg1.rebuild(2048);         // msg1 now has size 2K
msg2.rebuild(2048);         // ...and so does msg2

When a Frame object is destroyed, $(ZMQREF zmq_msg_close()) is called on the underlying zmq_msg_t.

A Frame cannot be copied by normal assignment; use $(FREF _Frame.copy) for this.

Destructor

~this
~this()

Releases the $(ZMQ) message frame when the Frame is destroyed.

Postblit

this(this)
this(this)
Undocumented in source.

Members

Aliases

FreeData
alias FreeData = void function(void*, void*) nothrow

The function pointer type for memory-freeing callback functions passed to $(LINK2 #Frame.opCall_data,Frame(ubyte[], _FreeData, void*)).

Functions

close
void close()

Releases the $(ZMQ) message frame.

copy
Frame copy()
copyTo
void copyTo(Frame dest)

Copies frame content to another message frame.

metadata
char[] metadata(char[] property)
metadataUnsafe
const(char)[] metadataUnsafe(char[] property)

Gets message metadata.

move
Frame move()
moveTo
void moveTo(Frame dest)

Moves frame content to another message frame.

rebuild
void rebuild()

Reinitializes the Frame object as an empty message.

rebuild
void rebuild(size_t size)

Reinitializes the Frame object to a specified size.

rebuild
void rebuild(ubyte[] data)
void rebuild(ubyte[] data, FreeData free, void* hint)

Reinitializes the Frame object from a supplied buffer.

Properties

data
ubyte[] data [@property getter]

Retrieves the message frame content.

handle
inout(zmq_msg_t)* handle [@property getter]

A pointer to the underlying zmq_msg_t.

more
bool more [@property getter]

Whether there are more message frames to retrieve.

sharedStorage
bool sharedStorage [@property getter]

Whether the message MAY share underlying storage with another copy.

size
size_t size [@property getter]

The message frame content size in bytes.

sourceFD
FD sourceFD [@property getter]

The file descriptor of the socket the message was read from.

Static functions

opCall
Frame opCall()

Initializes an empty $(ZMQ) message frame.

opCall
Frame opCall(size_t size)

$(ANCHOR Frame.opCall_size) Initializes a $(ZMQ) message frame of the specified _size.

opCall
Frame opCall(ubyte[] data)
Frame opCall(ubyte[] data, FreeData free, void* hint)

$(ANCHOR Frame.opCall_data) Initializes a $(ZMQ) message frame from a supplied buffer.

Meta