Toolbox snapshot
The Reactive C++ Toolbox
Loading...
Searching...
No Matches
Public Member Functions | List of all members
toolbox::net::RateWindow Class Reference

RateWindow maintains a sliding window of second time buckets for the specified interval. More...

#include <toolbox/net/RateLimit.hpp>

Public Member Functions

template<typename intervalT = Seconds>
 RateWindow (intervalT interval)
 
 ~RateWindow ()
 
 RateWindow (const RateWindow &)
 
RateWindowoperator= (const RateWindow &)
 
 RateWindow (RateWindow &&) noexcept
 
RateWindowoperator= (RateWindow &&) noexcept
 
std::size_t count () const noexcept
 
void add (MonoTime time, std::size_t count=1) noexcept
 

Detailed Description

RateWindow maintains a sliding window of second time buckets for the specified interval.

Definition at line 60 of file RateLimit.hpp.

Constructor & Destructor Documentation

◆ RateWindow() [1/3]

template<typename intervalT = Seconds>
toolbox::net::RateWindow::RateWindow ( intervalT  interval)
inlineexplicit

Definition at line 63 of file RateLimit.hpp.

◆ ~RateWindow()

toolbox::net::RateWindow::~RateWindow ( )
default

◆ RateWindow() [2/3]

toolbox::net::RateWindow::RateWindow ( const RateWindow )
default

◆ RateWindow() [3/3]

toolbox::net::RateWindow::RateWindow ( RateWindow &&  )
defaultnoexcept

Member Function Documentation

◆ operator=() [1/2]

RateWindow & toolbox::net::RateWindow::operator= ( const RateWindow )
default

◆ operator=() [2/2]

RateWindow & toolbox::net::RateWindow::operator= ( RateWindow &&  )
defaultnoexcept

◆ count()

std::size_t toolbox::net::RateWindow::count ( ) const
inlinenoexcept

Definition at line 78 of file RateLimit.hpp.

◆ add()

void toolbox::net::RateWindow::add ( MonoTime  time,
std::size_t  count = 1 
)
noexcept

Add count to time bucket. This function assumes a monotonically increasing clock.

Definition at line 54 of file RateLimit.cpp.


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