A channel.
More...
#include <channel.hpp>
|
| | channel (std::size_t capacity) |
| | Creates a channel.
|
| |
|
| ~channel () |
| | Destroys the JSON parser.
|
| |
| void | insert (element element_) |
| | Inserts an element.
|
| |
| void | insert (std::exception_ptr &&p_exception) |
| | Inserts an exception.
|
| |
| const element & | peek () const |
| | Returns the front element.
|
| |
| void | take () |
| | Takes an element.
|
| |
| bool | closed () const |
| | Returns true the channel is closed.
|
| |
|
void | close () |
| | Closes the channel.
|
| |
◆ channel()
| tetengo::json::channel::channel |
( |
std::size_t | capacity | ) |
|
|
explicit |
Creates a channel.
- Parameters
-
| capacity | A capacity. Must be greater than 0. |
- Exceptions
-
| std::invalid_argument | When capacity is 0. |
◆ closed()
| bool tetengo::json::channel::closed |
( |
| ) |
const |
|
nodiscard |
Returns true the channel is closed.
- Return values
-
| true | When the channel is closed. |
| false | Otherwise. |
◆ insert() [1/2]
| void tetengo::json::channel::insert |
( |
element | element_ | ) |
|
Inserts an element.
The element inserted after a close() call are just discarded.
- Parameters
-
◆ insert() [2/2]
| void tetengo::json::channel::insert |
( |
std::exception_ptr && | p_exception | ) |
|
Inserts an exception.
The exception inserted after a close() call are just discarded.
- Parameters
-
| p_exception | An exception pointer. |
◆ peek()
| const element & tetengo::json::channel::peek |
( |
| ) |
const |
|
nodiscard |
Returns the front element.
- Returns
- The front element.
- Exceptions
-
◆ take()
| void tetengo::json::channel::take |
( |
| ) |
|
Takes an element.
- Exceptions
-
| std::logic_error | When the channel is already closed. |
The documentation for this class was generated from the following file: