class Pipe

kernel buffering between processes and/or threads. More...

Definition#include <file.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Members

Protected Members


Detailed Description

The Pipe uses system kernel buffering to hold data being passed either between two execution contexts within the same process, or between different processes. Unlike thread's "Buffer", Pipe uses system descriptors and kernel memory. Under Posix, the size of the pipe and associated kernel memory is always a fixed constant as defined by _PC_PIPE_BUF. The APE "pipe" class primarily deals with "atomic" transfers of fixed sized objects through pipes. Pipes may pass data arbitrarily and can also be used through the "pipestream" class.

The "Pipe" class is not meant to be a true "public" class, but as a builder class for deriving other classes.

inline int getSize (void)
[protected]

Get the object size for atomic operations.

Returns: size of atomic operations.

inline void endSender (void)
[protected]

Sender is often used for implementing a fork()'d message port between processes. By stopping the sender, the current pipe can then only be used for receiving, and the sender is presumed to be in the other half of a fork()'d process.

See also: endReceiver

inline void endReceiver (void)
[protected]

Receiver is often used for implementing a fork()'d message port between processes. By stopping the receiver, the current pipe can then only be used for sending, and the receiver is presumed to be in the other half of a fork()'d process.

See also: endSender

Pipe (int size = 512, int count = 1)
[protected]

Create a kernel pipe descriptor set using pipe(). On systems which allow the pipe kernel buffer to be defined, a size for aligned atomic transfers can be set, as well as the number of atomic objects the kernel will buffer. On Posix systems, these options are ignored.

Parameters:
objsizeof atomic objects to send.
countof atomic objects to kernel buffer.

~Pipe ()
[protected]

Destroy the pipe and kernel descriptor resources.

Pipe (const Pipe &orig)
[protected]

Create a pipe as a duplicate of an existing pipe.

Parameters:
origpipe to duplicate.

bool operator! ()

Used to see if the pipe has any open entities.

inline int Recv (void *addr)

Perform an object atomic transfer of data from a pipe.

Parameters:
addrpointer to store read data.
lennumber of bytes to read.

Returns: number of bytes actually read if successful.

inline int Send (void *addr)

Perform an object atomic transfer of data to a pipe.

Parameters:
addrpointer to write data from.
lennumber of butes to write.

Returns: number of bytes written if successful.