Connect++ 0.5.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 44 of file Interval.hpp.

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

Member Function Documentation

◆ tick()

bool Interval::tick ( )
inline

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

Definition at line 52 of file Interval.hpp.

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

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: