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

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

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

Detailed Description

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

Reads values from a channel a specified number of times.

Nothing is done with the values; it is as if they vanish. Therefore this process is only really for absorbing values you don't want from a channel. It is also used for testing C++CSP2.

When the process has completed the specified number of reads, 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 ReaderProcess<int>(in,7)) (new ChannelPoisoner(in)) );

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

DATA_TYPE Requirements

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


Public Member Functions

 ReaderProcess (const Chanin< DATA_TYPE > &_in, 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::ReaderProcess< DATA_TYPE >::ReaderProcess ( const Chanin< DATA_TYPE > &  _in,
int  _times = 1 
) [inline, explicit]

Constructs the process.

Parameters:
_in The channel to read from
_times The number of times to read from the channel. Defaults to one.


Member Function Documentation

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