Image Component Library (ICL)
Public Member Functions | Private Attributes | List of all members
icl::utils::FPSLimiter Class Reference

An fps limiter can be used to limit online applications FPS. More...

#include <FPSLimiter.h>

Inheritance diagram for icl::utils::FPSLimiter:
icl::utils::FPSEstimator

Public Member Functions

 FPSLimiter (float maxFPS, int fpsEstimationInterval=10)
 creates new FPSLimiter instance with given parameter More...
 
virtual ~FPSLimiter ()
 virtual destructor More...
 
void setMaxFPS (float maxFPS)
 sets max fps value More...
 
float getMaxFPS () const
 returns max fps value More...
 
float wait () const
 waits as long as necessary to reached desired FPS rate More...
 
virtual void tic () const
 as FPSEstimator::tic(), but with preceding wait()-call More...
 
virtual float getFPSVal () const
 as FPSEstimator::getFPSVal(), but with preceding wait()-call More...
 
virtual std::string getFPSString (const std::string &fmt="%3.4f fps", int bufferSize=30) const
 as FPSEstimator::getFpsString, but with preceding wait()-call More...
 
virtual void showFPS (const std::string &text="") const
 as FPSEstimator::showPPS, but with preceding wait()-call More...
 
- Public Member Functions inherited from icl::utils::FPSEstimator
 FPSEstimator (int n=2)
 Constructor. More...
 
virtual ~FPSEstimator ()
 virtual destructor More...
 
void reset (int n)
 Sets a new averaging interval. More...
 

Private Attributes

float m_maxFPS
 
Time m_lastTime
 
bool m_waitOff
 

Detailed Description

An fps limiter can be used to limit online applications FPS.

Constructor & Destructor Documentation

◆ FPSLimiter()

icl::utils::FPSLimiter::FPSLimiter ( float  maxFPS,
int  fpsEstimationInterval = 10 
)

creates new FPSLimiter instance with given parameter

◆ ~FPSLimiter()

virtual icl::utils::FPSLimiter::~FPSLimiter ( )
inlinevirtual

virtual destructor

Member Function Documentation

◆ getFPSString()

virtual std::string icl::utils::FPSLimiter::getFPSString ( const std::string &  fmt = "%3.4f fps",
int  bufferSize = 30 
) const
virtual

as FPSEstimator::getFpsString, but with preceding wait()-call

Reimplemented from icl::utils::FPSEstimator.

◆ getFPSVal()

virtual float icl::utils::FPSLimiter::getFPSVal ( ) const
virtual

as FPSEstimator::getFPSVal(), but with preceding wait()-call

Reimplemented from icl::utils::FPSEstimator.

◆ getMaxFPS()

float icl::utils::FPSLimiter::getMaxFPS ( ) const
inline

returns max fps value

◆ setMaxFPS()

void icl::utils::FPSLimiter::setMaxFPS ( float  maxFPS)
inline

sets max fps value

◆ showFPS()

virtual void icl::utils::FPSLimiter::showFPS ( const std::string &  text = "") const
virtual

as FPSEstimator::showPPS, but with preceding wait()-call

Reimplemented from icl::utils::FPSEstimator.

◆ tic()

virtual void icl::utils::FPSLimiter::tic ( ) const
virtual

as FPSEstimator::tic(), but with preceding wait()-call

Reimplemented from icl::utils::FPSEstimator.

◆ wait()

float icl::utils::FPSLimiter::wait ( ) const

waits as long as necessary to reached desired FPS rate

returns time actually waited (in microseconds)

Member Data Documentation

◆ m_lastTime

Time icl::utils::FPSLimiter::m_lastTime
mutableprivate

◆ m_maxFPS

float icl::utils::FPSLimiter::m_maxFPS
private

◆ m_waitOff

bool icl::utils::FPSLimiter::m_waitOff
mutableprivate

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