Pipe

This class represents pipe objects. A set of filters can be placed into a pipe, and information flows through the pipe until it reaches the end, where the output is collected for retrieval. If you're familiar with the Unix shell environment, this design will sound quite familiar.

struct Pipe {}

Constructors

this
this(Filter f1, Filter f2, Filter f3, Filter f4)

Construct a Pipe of up to four filters. The filters are set up in the same order as the arguments.

this
this(Filter[] filters)

Construct a Pipe from a list of filters

Destructor

~this
~this()
Undocumented in source.

Members

Aliases

message_id
alias message_id = size_t
Undocumented in source.

Functions

append
void append(Filter filter)

Insert a new filter at the back of the pipe

defaultMsg
size_t defaultMsg()
discardNext
size_t discardNext(size_t n)

Discard the next N bytes of the data

endMsg
void endMsg()

End the current message.

endOfData
bool endOfData()

Test whether this pipe has any data that can be read from.

getBytesRead
size_t getBytesRead()
getBytesRead
size_t getBytesRead(message_id msg)
messageCount
message_id messageCount()

Get the number of messages the are in this pipe.

peek
size_t peek(ubyte* output, size_t length, size_t offset, message_id msg)

Read from the default message but do not modify the internal offset. Consecutive calls to peek() will return portions of the message starting at the same position.

peek
size_t peek(ubyte[] output, size_t offset, message_id msg)

Read from the specified message but do not modify the internal offset. Consecutive calls to peek() will return portions of the message starting at the same position.

peek
size_t peek(ubyte output, size_t offset, message_id msg)

Read a single ubyte from the specified message but do not modify the internal offset. Consecutive calls to peek() will return portions of the message starting at the same position.

peekByte
size_t peekByte(ubyte output)

Peek at one ubyte.

pop
void pop()

Remove the first filter at the front of the pipe.

prepend
void prepend(Filter filter)

Insert a new filter at the front of the pipe

processMsg
void processMsg(const(ubyte)* input, size_t length)

Perform startMsg(), write() and endMsg() sequentially.

processMsg
void processMsg(Vector!(ubyte, ALLOC) input)

Perform startMsg(), write() and endMsg() sequentially.

processMsg
void processMsg(RefCounted!(Vector!(ubyte, ALLOC), ALLOC) input)

Perform startMsg(), write() and endMsg() sequentially.

processMsg
void processMsg(string input)

Perform startMsg(), write() and endMsg() sequentially.

processMsg
void processMsg(DataSource input)

Perform startMsg(), write() and endMsg() sequentially.

read
size_t read(ubyte* output, size_t length)

Read the default message from the pipe. Moves the internal offset so that every call to read will return a new portion of the message.

read
size_t read(ubyte* output, size_t length, message_id msg)

Read a specified message from the pipe. Moves the internal offset so that every call to read will return a new portion of the message.

read
size_t read(ubyte[] output, message_id msg)

Read a specified message from the pipe. Moves the internal offset so that every call to read will return a new portion of the message.

read
size_t read(ubyte output, message_id msg)

Read a single ubyte from the pipe. Moves the internal offset so that every call to read will return a new portion of the message.

readAll
SecureVector!ubyte readAll(message_id msg)

Read the full contents of the pipe.

readByte
size_t readByte(ubyte output)

Read one ubyte.

remaining
size_t remaining(message_id msg)

Find out how many bytes are ready to read.

reset
void reset()

Reset this pipe to an empty pipe.

setDefaultMsg
void setDefaultMsg(message_id msg)

Set the default message

startMsg
void startMsg()

Start a new message in the pipe. A potential other message in this pipe must be closed with endMsg() before this function may be called.

toString
string toString(message_id msg)

Read the full contents of the pipe.

write
void write(const(ubyte)* input, size_t length)

Write input to the pipe, i.e. to its first filter.

write
void write(RefCounted!(Vector!(T, ALLOC), ALLOC) input)

Write input to the pipe, i.e. to its first filter.

write
void write(Vector!(T, ALLOC) input)

Write input to the pipe, i.e. to its first filter.

write
void write(string input)

Write input to the pipe, i.e. to its first filter.

write
void write(DataSource source)

Write input to the pipe, i.e. to its first filter.

write
void write(ubyte input)

Write input to the pipe, i.e. to its first filter.

write
void write(ubyte[] input)

Write input to the pipe, i.e. to its first filter.

Static variables

DEFAULT_MESSAGE
message_id DEFAULT_MESSAGE;

A meta-id for the default message (set with set_defaultMsg)

LAST_MESSAGE
message_id LAST_MESSAGE;

A meta-id for whatever the last message is

Meta