Kanzi Connect  3.9.8
Kanzi Connect C++ API
kanzi::connect::CreditFlowControl Class Reference

Credit based flow control logic for both ends of the link. More...

#include <creditflowcontrol.hpp>

Public Member Functions

void add (int amount=1)
 Adds a credit, used on both sizes of connection to inform used/received credits. More...
 
 CreditFlowControl (int credits=-1, int creditReturnInterval=-1)
 Constructor. More...
 
bool getProductionCredit ()
 Gets a credit for production, used on producer/sender side. More...
 
int getReturnableCredits ()
 Retrieves the amount of credits that can be returned. More...
 
void initialize (int credits, int creditReturnInterval=-1)
 Initialize the object with provided credit information. More...
 
bool isEnabled () const
 State of credit system. More...
 
void restart ()
 Restores the object into state it had after construction/latest initialize() call. More...
 
void uninitialize ()
 Uninitializes the flow control. isEnabled() will return false after calling this method. More...
 

Detailed Description

Credit based flow control logic for both ends of the link.

Constructor & Destructor Documentation

◆ CreditFlowControl()

kanzi::connect::CreditFlowControl::CreditFlowControl ( int  credits = -1,
int  creditReturnInterval = -1 
)
explicit

Constructor.

Parameters
creditsthe initial amount of credits available.
creditReturnIntervalhow often should credits be returned. meaningfull only on client side.

Member Function Documentation

◆ add()

void kanzi::connect::CreditFlowControl::add ( int  amount = 1)

Adds a credit, used on both sizes of connection to inform used/received credits.

Parameters
amountthe amount of credits bring back.

◆ getProductionCredit()

bool kanzi::connect::CreditFlowControl::getProductionCredit ( )

Gets a credit for production, used on producer/sender side.

Returns
true if at least one credit was available or credit system disabled.

◆ getReturnableCredits()

int kanzi::connect::CreditFlowControl::getReturnableCredits ( )

Retrieves the amount of credits that can be returned.

Returns
the credit amount. 0 if nothing to return at the moment.

◆ initialize()

void kanzi::connect::CreditFlowControl::initialize ( int  credits,
int  creditReturnInterval = -1 
)

Initialize the object with provided credit information.

Parameters
creditsthe initial amount of credits available.
creditReturnIntervalhow often should credits be returned. meaningfull only on client side.

◆ isEnabled()

bool kanzi::connect::CreditFlowControl::isEnabled ( ) const

State of credit system.

Returns
true if credit system is enabled.

◆ restart()

void kanzi::connect::CreditFlowControl::restart ( )

Restores the object into state it had after construction/latest initialize() call.

calling uninitialize() will render restarting impossible.

◆ uninitialize()

void kanzi::connect::CreditFlowControl::uninitialize ( )

Uninitializes the flow control. isEnabled() will return false after calling this method.


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