Inheritance diagram for csp::ChannelBufferFactory< DATA_TYPE >:
Use this class if you want your process to use a channel buffer factory provided from outside your process, for example:
class BufferedPingPong : public CSProcess { private: ChannelBufferFactory<DATA_TYPE>* factory; protected: void run() { BufferedOne2OneChannel c(factory), d(factory); Run(InParallel (new Prefix<int>(d.reader(),c.writer(),0)) (new Id<int>(c.reader(),d.writer()) ); } public: inline explicit BufferedPingPong(ChannelBufferFactory<DATA_TYPE>* _factory) : factory(_factory) { } };
If you create a new ChannelBuffer, you will need to implement a factory for it. To do this, you may find the ChannelBufferFactoryImpl and SizedChannelBufferFactoryImpl classes useful
For more information, see the page on Channel Buffers and the section in the guide on Buffered Channels.
Public Member Functions | |
virtual ChannelBuffer< DATA_TYPE > * | createBuffer () const =0 |
Creates a new channel buffer. |
virtual ChannelBuffer<DATA_TYPE>* csp::ChannelBufferFactory< DATA_TYPE >::createBuffer | ( | ) | const [pure virtual] |
Creates a new channel buffer.
The returned channel buffer will be deleted by the channel using it, so it should be allocated using new (that is, allocated on the heap), and a pointer to it should not need to be retained by the factory.
Note that the method is const, this is important to remember when implementing a channel factory.
Implemented in csp::ChannelBufferFactoryImpl< DATA_TYPE, BUFFER_TYPE >, and csp::SizedChannelBufferFactoryImpl< DATA_TYPE, BUFFER_TYPE >.