GDAL

Public Member Functions | List of all members
gdal::viewshed::NotifyQueue< T > Class Template Reference

This is a thread-safe queue. More...

`#include <notifyqueue.h>`

## Public Member Functions
| ~NotifyQueue ()
| Destructor.
void | push (T &&t)
| Push an object on the queue and notify readers. More...
bool | pop (T &t)
| Get an item from the queue. More...
void | done ()
| When we're done putting things in the queue, set the end condition.
void | stop ()
| Unblock all readers regardless of queue state.
bool | isDone ()
| Determine if the queue was emptied completely. More...
bool | isStopped ()
| Determine if the queue was stopped. More...
size_t | size () const
| Get the current size of the queue. More...

## Detailed Description

template<class T>
class gdal::viewshed::NotifyQueue< T >

This is a thread-safe queue.

Things placed in the queue must be move-constructible. Readers will wait until there is something in the queue or the queue is empty or stopped. If the queue is stopped (error), it will never be in the done state. If in the done state (all writers have finished), it will never be in the error state.

## Member Function Documentation

## ◆ isDone()

template<class T >

bool gdal::viewshed::NotifyQueue< T >::isDone | ( |  | ) |
| inline

Determine if the queue was emptied completely.

Call after pop() returns false to check queue state.

Returns
  Whether the queue was emptied completely.

## ◆ isStopped()

template<class T >

bool gdal::viewshed::NotifyQueue< T >::isStopped | ( |  | ) |
| inline

Determine if the queue was stopped.

Call after pop() returns false to check queue state.

Returns
  Whether the queue was stopped.

## ◆ pop()

template<class T >

bool gdal::viewshed::NotifyQueue< T >::pop | ( | T & | t | ) |
| inline

Get an item from the queue.

Parameters

  t | Reference to an item to to which a queued item will be moved.

Returns
  True if an item was popped. False otherwise. Use isStopped() or isDone() to determine the state if you care when false is returned.

## ◆ push()

template<class T >

void gdal::viewshed::NotifyQueue< T >::push | ( | T && | t | ) |
| inline

Push an object on the queue and notify readers.

Parameters

  t | Object to be moved onto the queue.

## ◆ size()

template<class T >

size_t gdal::viewshed::NotifyQueue< T >::size | ( |  | ) | const
| inline

Get the current size of the queue.

Returns
  Current queue size.

The documentation for this class was generated from the following file:

- notifyqueue.h