Alphabetic Class Index   |   Class Inheritance Tree Index   |   Tool Index

Class: PacketPipe

This is a base class.

Description:
This is a base class for a whole range of classes for processing CCSDSPacket objects. The idea is to construct a number of modules, each doing a different thing to the packets and to hook them together like plumbing.

This class does nothing to the packets, but provides the functionality for connecting modules together and for pushing packets into or pulling them out of a chain of pipes.

This class overrides a number of operators to provide convenient syntax. Typical usage is to create a number of PacketPipe (or some subclass) objects and then connect them together like this "pipe1 | pipe2 | pipe3". Then if you have a pointer to a CCSDS packet "p", you may push it into the pipe chain like this: "pipe1 << p". Such a packet will first be operated on by pipe1, then by pipe2, etc. Alternately, you may pull a packet out of a pipe like this: "pipe3 >> p". Most types of pipes support both push in and pull out, though sometimes one is more natuaral or effient than the other.

Packets are passed between pipes by reference, and a NULL pointer is used to signal the end of the stream of packets.

Data Fields
publicstatic const intALL_UNIQUE
protectedPacketPipe*source
protectedPacketPipe*sink

Constructors / Destructor
public PacketPipe()
Constructor.

Methods
public virtual int hints()
Return a set of bit flags giving information about the packet stream leaving this pipe. This method just queries the packet stream hints upstream. Subclasses should override this method if they impose some conditions on the stream.
public virtual void hints(int)
public virtual void connectToSource(PacketPipe& source)
These connect and dissconnect methods should not be used in general. Instead, a pair of pipes should be connected using the "|" operator.
public virtual void connectToSink(PacketPipe& sink)
public virtual void disconnectFromSource()
public virtual void disconnectFromSink()
public virtual void pushIn(CCSDSPacket* p)
Push one packet into the pipe. This method is called by the "<<" operator. For this base class, this method just pushes the packet into the next pipe downstream if there is one. Subclasses may override this method or operateOnPacket() to do something more interesting.
public virtual CCSDSPacket* pullOut()
Pull a packet out of the pipe. This method is called by the ">>" operator. For this base class, it just pulls a packet from the upstream pipe If there is one. If there isn't, it delivers a NULL pointer indicating end-of-stream. Subclasses may override this method or operateOnPacket() to do something more interesting.
public virtual void pump()
Pull packets from the source and deliver them to the sink until no packets are left. This method is useful, e.g. if you have a PacketReader at one end of a chain and a PacketWriter at the other end. Then you can call the pump() method on some intermediate pipe to process all the packets in some input file.
protected virtual CCSDSPacket* operateOnPacket(CCSDSPacket* p)

Operators
public PacketPipe& PacketPipe& | PacketPipe&
Operator for connecting two pipes. Returns a pointer to the sink pipe so that many of these may be chained together.
public PacketPipe& PacketPipe& >> CCSDSPacket* &
Operator for pulling a packet out of a pipe. See the PullOut() method.
public PacketPipe& PacketPipe& << CCSDSPacket*
Operator for pushing a packet into a pipe. See the PushIn() method.


Alphabetic Class Index   |   Class Inheritance Tree Index   |   Tool Index