|
Discman
|
The Producer interface. More...
#include <producer.h>
Public Member Functions | |
| T | next (const Consumer< T > *const consumer) |
| When a Producer has multiple Consumers, each Consumer must call this overloaded version of next(). | |
| void | register_consumer (const Consumer< T > *const consumer) |
| Use this method to maintain state associated with a particular Consumer. The state can be used to retrieve the right datum for the Consumer. | |
| virtual T | next ()=0 |
| When a producer has a single Consumer, that Consumer may simply call this version of next() to retrieve the next datum. When a Producer has multiple Consumers, this method must take into account the _current_consumer. | |
Protected Member Functions | |
| Consumer< T > * | current_consumer () const |
| Getter for _current_consumer. | |
Private Attributes | |
| Consumer< T > * | _current_consumer = nullptr |
| The Consumer that will receive the datum returned by next(). | |
The Producer interface.
| T | The data type produced. |
Definition at line 16 of file producer.h.
Getter for _current_consumer.
Definition at line 52 of file producer.h.
|
pure virtual |
|
inline |
Use this method to maintain state associated with a particular Consumer. The state can be used to retrieve the right datum for the Consumer.
| [in] | consumer | The Consumer to register. |
Definition at line 27 of file producer.h.
The Consumer that will receive the datum returned by next().
Definition at line 38 of file producer.h.