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

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

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

Detailed Description

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

Writes a given value to a channel a specified number of times.

When the process has completed the specified number of writes, it simply finishes. It does not poison the channel. If you want to poison the channel afterwards, consider using something like this:

            Run( InSequenceOneThread(new WriterProcess<int>(out,21,7)) (new ChannelPoisoner(out)) );

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

 WriterProcess (const Chanout< DATA_TYPE > &_out, const DATA_TYPE &value, int _times=1)
 Constructs the 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::WriterProcess< DATA_TYPE >::WriterProcess ( const Chanout< DATA_TYPE > &  _out,
const DATA_TYPE &  value,
int  _times = 1 
) [inline]

Constructs the process.

Parameters:
_out The channel to write to
value The value to write to the channel
_times The number of times to write the value to the channel. Defaults to one.


Member Function Documentation

template<typename DATA_TYPE>
void csp::common::WriterProcess< 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