number-of-recent-calls 1.0.0
Number of Recent Calls
Loading...
Searching...
No Matches
RecentCounter Class Reference
Collaboration diagram for RecentCounter:

Public Member Functions

 RecentCounter ()
 
int ping (int t)
 

Private Attributes

queue< int > recents
 

Detailed Description

Definition at line 5 of file main.cpp.

Constructor & Destructor Documentation

◆ RecentCounter()

RecentCounter::RecentCounter ( )
inline

Definition at line 10 of file main.cpp.

10: recents() {}
queue< int > recents
Definition main.cpp:8

Member Function Documentation

◆ ping()

int RecentCounter::ping ( int  t)
inline

Definition at line 12 of file main.cpp.

13 {
14 recents.push(t);
15 while (!recents.empty() && recents.front() < t - 3000)
16 recents.pop();
17 return recents.size();
18 }

References recents.

Referenced by main().

Field Documentation

◆ recents

queue<int> RecentCounter::recents
private

Definition at line 8 of file main.cpp.

Referenced by ping().


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