Quick Links: |
#include <balb_reservationguard.h>
Public Member Functions | |
ReservationGuard (TYPE *rateController, bsls::Types::Uint64 numUnits) | |
~ReservationGuard () | |
void | cancelReserved (bsls::Types::Uint64 numUnits) |
void | submitReserved (bsls::Types::Uint64 numUnits) |
TYPE * | ptr () const |
bsls::Types::Uint64 | unitsReserved () const |
This class template implements a proctor for reserving and cancelling units in a rate controlling object.
This class:
For terminology see bsldoc_glossary
.
See Component balb_reservationguard
balb::ReservationGuard< TYPE >::ReservationGuard | ( | TYPE * | rateController, | |
bsls::Types::Uint64 | numUnits | |||
) |
Create a ReservationGuard
object guarding the specified rateController
and reserving the specified numUnits
.
balb::ReservationGuard< TYPE >::~ReservationGuard | ( | ) |
Destroy this object. Invoke the cancelReserved
method for the remaining remaining units reserved by this proctor.
void balb::ReservationGuard< TYPE >::cancelReserved | ( | bsls::Types::Uint64 | numUnits | ) |
Cancel the specified numUnits
from the reserve units guarded by this object. Subtract the numUnits
from unitsReserved
and invoke the cancelReserved
method on the guarded object for numUnits
. After this operation, the number of reserved units guarded by this object will be reduced by numUnits
. The behavior is undefined unless numUnits <= unitsReserved()
.
void balb::ReservationGuard< TYPE >::submitReserved | ( | bsls::Types::Uint64 | numUnits | ) |
Submit the specified numUnits
from the reserve units guarded by this object. After this operation, the number of reserved units guarded by this object will be reduced by numUnits
. The behavior is undefined unless numUnits <= unitsReserved()
.
TYPE* balb::ReservationGuard< TYPE >::ptr | ( | ) | const |
Return a pointer to the rate controlling object used by this object.
bsls::Types::Uint64 balb::ReservationGuard< TYPE >::unitsReserved | ( | ) | const |
Return the number of units reserved by this object.