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

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

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

Detailed Description

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

Reads a single value from a channel into a given (by pointer) location.

This process is a little similar to ReaderProcess. ReaderProcess reads multiple values and discards the results. ReadOnceProcess reads a singe value into a given location. It is particularly useful for doing multiple parallel reads.

When the process has completed the single read, 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 ReadOnceProcess<int>(in,&n)) (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

 ReadOnceProcess (const Chanin< DATA_TYPE > &_in, DATA_TYPE *_result)
 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::ReadOnceProcess< DATA_TYPE >::ReadOnceProcess ( const Chanin< DATA_TYPE > &  _in,
DATA_TYPE *  _result 
) [inline, explicit]

Constructs the process.

Parameters:
_in The channel to read from
_result The location to read the value into


Member Function Documentation

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