Microsimulation API: ssim::pqueue Class Reference

Microsimulation API

Public Member Functions | Private Types | Private Attributes | List of all members
ssim::pqueue Class Reference
Collaboration diagram for ssim::pqueue:
[legend]

## Public Member Functions
| pqueue (bool smaller=true)
void | pushElement (pqueueElement element)
void | push (double priority, SEXP event)
pqueueElement | popElement ()
List | pop ()
bool | empty ()
void | clear ()
void | cancel (Rcpp::Function predicate)
template<class F >
void | for_each (F f, bool remake=false)
virtual | ~pqueue ()=default

## Private Types
using | size_type = std::vector< pqueueElement >::size_type

## Private Attributes
std::vector< pqueueElement > | _elements
pqueueElementComparator | _compare
long | _entryOrder
bool | _anyCancelled

## Detailed Description

Definition at line 25 of file pqueue.cpp.

## Member Typedef Documentation

## ◆ size_type

using ssim::pqueue::size_type = std::vector<pqueueElement>::size_type
| private

Definition at line 31 of file pqueue.cpp.

## Constructor & Destructor Documentation

## ◆ pqueue()

ssim::pqueue::pqueue | ( | bool | smaller = `true` | ) |
| inlineexplicit

Definition at line 33 of file pqueue.cpp.

## ◆ ~pqueue()

virtual ssim::pqueue::~pqueue | ( |  | ) |
| virtualdefault

## Member Function Documentation

## ◆ cancel()

void ssim::pqueue::cancel | ( | Rcpp::Function | predicate | ) |
| inline

Cancel any events that satisfy a predicate (which is an R function).

Definition at line 106 of file pqueue.cpp.

## ◆ clear()

void ssim::pqueue::clear | ( |  | ) |
| inline

Clear the priority queue

Definition at line 100 of file pqueue.cpp.

## ◆ empty()

bool ssim::pqueue::empty | ( |  | ) |
| inline

Check whether the priority queue is either empty or has only inactive events

Definition at line 88 of file pqueue.cpp.

## ◆ for_each()

template<class F >

void ssim::pqueue::for_each | ( | F | f,
|  | bool | remake = `false`
| ) |  |
| inline

General method to apply a function f() to each element Use remake=true if f() may change the order in the priority queue.

Definition at line 119 of file pqueue.cpp.

## ◆ pop()

List ssim::pqueue::pop | ( |  | ) |
| inline

Pop an active event from the priority queue.

Definition at line 81 of file pqueue.cpp.

## ◆ popElement()

pqueueElement ssim::pqueue::popElement | ( |  | ) |
| inline

Pop an elements from the priority queue (that is, get the next element) Ignores whether an element is active or not.

Definition at line 58 of file pqueue.cpp.

## ◆ push()

void ssim::pqueue::push | ( | double | priority,
|  | SEXP | event
| ) |  |
| inline

Definition at line 46 of file pqueue.cpp.

## ◆ pushElement()

void ssim::pqueue::pushElement | ( | pqueueElement | element | ) |
| inline

Push an elements to the priority queue

Definition at line 41 of file pqueue.cpp.

## Member Data Documentation

## ◆ _anyCancelled

bool ssim::pqueue::_anyCancelled
| private

Definition at line 30 of file pqueue.cpp.

## ◆ _compare

pqueueElementComparator ssim::pqueue::_compare
| private

Definition at line 28 of file pqueue.cpp.

## ◆ _elements

std::vector<pqueueElement> ssim::pqueue::_elements
| private

Definition at line 27 of file pqueue.cpp.

## ◆ _entryOrder

long ssim::pqueue::_entryOrder
| private

Definition at line 29 of file pqueue.cpp.

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

- /home/marcle/src/R/microsimulation/src/pqueue.cpp