Method | Description | |
---|---|---|
RemoveTokens ( int amount ) : bool |
Remove a given number of tokens from the bucket
|
|
RemoveTokens ( int amount, bool &dripSucceeded ) : bool |
Remove a given number of tokens from the bucket
|
|
TokenBucket ( |
Default constructor
|
Method | Description | |
---|---|---|
Drip ( ) : bool |
Add tokens to the bucket over time. The number of tokens added each call depends on the length of time that has passed since the last call to Drip
|
public RemoveTokens ( int amount ) : bool | ||
amount | int | Number of tokens to remove from the bucket |
return | bool |
public RemoveTokens ( int amount, bool &dripSucceeded ) : bool | ||
amount | int | Number of tokens to remove from the bucket |
dripSucceeded | bool | True if tokens were added to the bucket /// during this call, otherwise false |
return | bool |
public TokenBucket ( |
||
parent | Parent bucket if this is a child bucket, or /// null if this is a root bucket | |
maxBurst | int | Maximum size of the bucket in bytes, or /// zero if this bucket has no maximum capacity |
dripRate | int | Rate that the bucket fills, in bytes per /// second. If zero, the bucket always remains full |
return | System |