Connect++ 0.4.0
A fast, readable connection prover for first-order logic.
Loading...
Searching...
No Matches
Interval Class Reference

Simple class to help you count intervals. More...

#include <Interval.hpp>

Public Member Functions

 Interval (size_t l)
 
bool tick ()
 

Private Attributes

size_t count
 
size_t limit
 

Detailed Description

Simple class to help you count intervals.

There is a count and a limit. Each tick increases the count, and returns true plus resets the count when you reach the limit. (Otherwise returns false.)

Definition at line 35 of file Interval.hpp.

Constructor & Destructor Documentation

◆ Interval()

Interval::Interval ( size_t l)
inline

Parameter sets the limit.

Definition at line 45 of file Interval.hpp.

45 : count(0), limit(0) {
46 if (l >= 0)
47 limit = l;
48 }

Member Function Documentation

◆ tick()

bool Interval::tick ( )
inline

Advance the count by one and indicate/reset when you reach the limit.

Definition at line 54 of file Interval.hpp.

54 {
55 count++;
56 if (count > limit) {
57 count = 0;
58 return true;
59 }
60 return false;
61 }

Member Data Documentation

◆ count

size_t Interval::count
private

Definition at line 37 of file Interval.hpp.

◆ limit

size_t Interval::limit
private

Definition at line 38 of file Interval.hpp.


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