nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
nanommo::TokenBucket Class Reference

#include <token_bucket.h>

Public Member Functions

 TokenBucket (int size, std::chrono::steady_clock::duration refill)
bool Take (std::chrono::steady_clock::time_point now)
 Takes a token out, if the bucket has one at this time.

Detailed Description

Lets up to size through at once, and then one each refill, like a bucket of tokens that fills up again over time, where each one let through takes a token out.

Definition at line 11 of file token_bucket.h.

Constructor & Destructor Documentation

◆ TokenBucket()

nanommo::TokenBucket::TokenBucket ( int size,
std::chrono::steady_clock::duration refill )

Definition at line 8 of file token_bucket.cc.

Member Function Documentation

◆ Take()

bool nanommo::TokenBucket::Take ( std::chrono::steady_clock::time_point now)

Takes a token out, if the bucket has one at this time.

Definition at line 11 of file token_bucket.cc.


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