csp::common::Prefix< DATA_TYPE > Class Template Reference

Inheritance diagram for csp::common::Prefix< DATA_TYPE >:

csp::CSProcess csp::ThreadCSProcess boost::noncopyable List of all members.

Detailed Description

template<typename DATA_TYPE>
class csp::common::Prefix< DATA_TYPE >

A process that forwards an item of data to another channel, but starts by sending a supplied initial value.

This process first sends out its initial value, and then repeatedly: reads a value from its input channel, then writes it on its output channel. That is, it sends out its initial value on its output channel, then behaves as Id.

To use this process, you will need to include <cppcsp/common/basic.h>

DATA_TYPE Requirements

DATA_TYPE must have a copy constructor, and must meet the requirements of the channels it is being used with.


Public Member Functions

 Prefix (const Chanin< DATA_TYPE > &_in, const Chanout< DATA_TYPE > &_out, const DATA_TYPE &initialValue, const int _times=1)
 Constructs the Prefix process.

Protected Member Functions

void run ()
 You must implement this function to provide the code for your process.


Constructor & Destructor Documentation

template<typename DATA_TYPE>
csp::common::Prefix< DATA_TYPE >::Prefix ( const Chanin< DATA_TYPE > &  _in,
const Chanout< DATA_TYPE > &  _out,
const DATA_TYPE &  initialValue,
const int  _times = 1 
) [inline]

Constructs the Prefix process.

Parameters:
_in The input channel
_out The output channel
initialValue The value to prefix to (send first on) the channel
_times The number of times to send the prefixed value. Defaults to one.


Member Function Documentation

template<typename DATA_TYPE>
void csp::common::Prefix< DATA_TYPE >::run (  )  [inline, protected, virtual]

You must implement this function to provide the code for your process.

When the run method finishes, the process will terminate.

You should not let an uncaught exception cause the end of this function. If it derives from std::exception, it will be caught (although this behaviour should not be relied upon) but otherwise undefined behaviour will result.

Implements csp::ThreadCSProcess.


Generated on Mon Aug 20 12:24:29 2007 for C++CSP2 by  doxygen 1.4.7