55 lines
1.3 KiB
C
55 lines
1.3 KiB
C
|
|
#ifndef ALARMEVENTUTILS_H
|
||
|
|
#define ALARMEVENTUTILS_H
|
||
|
|
|
||
|
|
#include "alarmEventGlobal.h"
|
||
|
|
|
||
|
|
class AlarmEventDataFilter
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
AlarmEventDataFilter();
|
||
|
|
|
||
|
|
void setTimeRange(const QDateTime& start, const QDateTime& end) {m_startTime = start; m_endTime = end;}
|
||
|
|
void setStationFilter(const QString& station) {m_station = station;}
|
||
|
|
void setBayFilter(const QString& bay) {m_bay = bay;}
|
||
|
|
void setTypeFilter(int type) {m_type = type;}
|
||
|
|
void setSeverityFilter(const QString& severity) {m_severity = severity;}
|
||
|
|
void setDescriptionFilter(const QString& description) {m_description = description;}
|
||
|
|
void setConfirmStatusFilter(int status) {m_status = status;}
|
||
|
|
|
||
|
|
bool matches(const EventData& event);
|
||
|
|
void clear();
|
||
|
|
QVector<EventData> apply(const QVector<EventData>& events);
|
||
|
|
|
||
|
|
private:
|
||
|
|
bool isEmpty();
|
||
|
|
|
||
|
|
QDateTime m_startTime;
|
||
|
|
QDateTime m_endTime;
|
||
|
|
QString m_station;
|
||
|
|
QString m_bay;
|
||
|
|
int m_type;
|
||
|
|
QString m_severity;
|
||
|
|
QString m_description;
|
||
|
|
int m_status;
|
||
|
|
};
|
||
|
|
|
||
|
|
class AlarmEventCache
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
AlarmEventCache();
|
||
|
|
|
||
|
|
void setMaxSize(int maxSize);
|
||
|
|
int getMaxSize() const {return m_maxSize;}
|
||
|
|
|
||
|
|
void addEvent(const EventData& event);
|
||
|
|
void clear();
|
||
|
|
|
||
|
|
private:
|
||
|
|
void trimToSize();
|
||
|
|
|
||
|
|
int m_maxSize;
|
||
|
|
QVector<EventData> m_events;
|
||
|
|
};
|
||
|
|
|
||
|
|
#endif
|