idle_detect  0.8.3.0
Provides overall idle detection for a linux computer
Public Member Functions | Public Attributes | Private Attributes | List of all members
EventDetect::InputEventRecorders::EventRecorder Class Reference

The EventRecorder class formalizes the event recorder instance and is instantiated for each event recorder thread. These instantiations are wrapped by shared_ptr objects and the shared_ptrs stored in the m_event_recorder_ptrs vector. This is essentially a very specialized thread pool. More...

#include <event_detect.h>

Public Member Functions

 EventRecorder (fs::path event_device_path)
 Parameterized constructor. More...
 
fs::path GetEventDevicePath () const
 Gets the event device path. More...
 
int64_t GetEventCount () const
 Returns the current event count tallied by the recorder. More...
 
void EventActivityRecorderThread ()
 Method to run in the instantiated recorder thread.
 

Public Attributes

std::thread m_event_recorder_thread
 Holds the actual event recorder thread.
 

Private Attributes

std::mutex mtx_event_recorder
 This is the mutex member that provides lock control for the individual event recorder.
 
fs::path m_event_device_path
 Holds the event device path of the monitored device.
 
std::atomic< int64_t > m_event_count
 Atomic that holds the current event tally for the monitored device.
 

Detailed Description

The EventRecorder class formalizes the event recorder instance and is instantiated for each event recorder thread. These instantiations are wrapped by shared_ptr objects and the shared_ptrs stored in the m_event_recorder_ptrs vector. This is essentially a very specialized thread pool.

Constructor & Destructor Documentation

◆ EventRecorder()

InputEventRecorders::EventRecorder::EventRecorder ( fs::path  event_device_path)
explicit

Parameterized constructor.

Parameters
Requiredparameter for construction: event_device_path

Member Function Documentation

◆ GetEventCount()

int64_t InputEventRecorders::EventRecorder::GetEventCount ( ) const

Returns the current event count tallied by the recorder.

Returns

◆ GetEventDevicePath()

fs::path InputEventRecorders::EventRecorder::GetEventDevicePath ( ) const

Gets the event device path.

Returns a read only fs::path of the input event device path associated with the recorder. No locking is needed as this can only be changed on construction.

Returns
A copy of the m_event_device_path. A copy is returned to avoid holding the mtx_event_recorder lock for an extended period.
fs::path

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