WIP: somethings wrong.. #19
@ -1,14 +1,14 @@
|
|||||||
#include "../events/Event.h"
|
#include "Event.h"
|
||||||
namespace EVENT {
|
namespace EVENT {
|
||||||
EventId_t getEventId(Event event) {
|
EventId_t getEventId(Event event) {
|
||||||
return (event & 0xFFFF);
|
return (event & 0xFFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
EventSeverity_t getSeverity(Event event) {
|
EventSeverity_t getSeverity(Event event) {
|
||||||
return ((event >> 16) & 0xFF);
|
return ((event >> 16) & 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
Event makeEvent(EventId_t eventId, EventSeverity_t eventSeverity) {
|
Event makeEvent(EventId_t eventId, EventSeverity_t eventSeverity) {
|
||||||
return (eventSeverity << 16) + (eventId & 0xFFFF);
|
return (eventSeverity << 16) + (eventId & 0xFFFF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,45 +1,44 @@
|
|||||||
#ifndef FRAMEWORK_EVENTS_EVENT_H_
|
#ifndef EVENTOBJECT_EVENT_H_
|
||||||
#define FRAMEWORK_EVENTS_EVENT_H_
|
#define EVENTOBJECT_EVENT_H_
|
||||||
|
|
||||||
#include <cstdint>
|
#include <stdint.h>
|
||||||
#include "../events/fwSubsystemIdRanges.h"
|
#include "fwSubsystemIdRanges.h"
|
||||||
//could be move to more suitable location
|
//could be move to more suitable location
|
||||||
#include <subsystemIdRanges.h>
|
#include <config/tmtc/subsystemIdRanges.h>
|
||||||
|
|
||||||
typedef uint16_t EventId_t;
|
typedef uint16_t EventId_t;
|
||||||
typedef uint8_t EventSeverity_t;
|
typedef uint8_t EventSeverity_t;
|
||||||
|
|
||||||
#define MAKE_EVENT(id, severity) (((severity)<<16)+(SUBSYSTEM_ID*100)+(id))
|
#define MAKE_EVENT(id, severity) (((severity)<<16)+(SUBSYSTEM_ID*100)+(id))
|
||||||
|
|
||||||
typedef uint32_t Event;
|
typedef uint32_t Event;
|
||||||
|
|
||||||
namespace EVENT {
|
namespace EVENT {
|
||||||
EventId_t getEventId(Event event);
|
EventId_t getEventId(Event event);
|
||||||
|
|
||||||
EventSeverity_t getSeverity(Event event);
|
EventSeverity_t getSeverity(Event event);
|
||||||
|
|
||||||
Event makeEvent(EventId_t eventId, EventSeverity_t eventSeverity);
|
Event makeEvent(EventId_t eventId, EventSeverity_t eventSeverity);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
namespace SEVERITY {
|
||||||
namespace SEVERITY {
|
static const EventSeverity_t INFO = 1;
|
||||||
static const EventSeverity_t INFO = 1;
|
static const EventSeverity_t LOW = 2;
|
||||||
static const EventSeverity_t LOW = 2;
|
static const EventSeverity_t MEDIUM = 3;
|
||||||
static const EventSeverity_t MEDIUM = 3;
|
static const EventSeverity_t HIGH = 4;
|
||||||
static const EventSeverity_t HIGH = 4;
|
}
|
||||||
}
|
|
||||||
|
//Unfortunately, this does not work nicely because of the inability to define static classes in headers.
|
||||||
//Unfortunately, this does not work nicely because of the inability to define static classes in headers.
|
//struct Event {
|
||||||
//struct Event {
|
// Event(uint8_t domain, uint8_t counter, EventSeverity_t severity) :
|
||||||
// Event(uint8_t domain, uint8_t counter, EventSeverity_t severity) :
|
// id(domain*100+counter), severity(severity) {
|
||||||
// id(domain*100+counter), severity(severity) {
|
// }
|
||||||
// }
|
// EventId_t id;
|
||||||
// EventId_t id;
|
// EventSeverity_t severity;
|
||||||
// EventSeverity_t severity;
|
// static const EventSeverity_t INFO = 1;
|
||||||
// static const EventSeverity_t INFO = 1;
|
// static const EventSeverity_t LOW = 2;
|
||||||
// static const EventSeverity_t LOW = 2;
|
// static const EventSeverity_t MEDIUM = 3;
|
||||||
// static const EventSeverity_t MEDIUM = 3;
|
// static const EventSeverity_t HIGH = 4;
|
||||||
// static const EventSeverity_t HIGH = 4;
|
//};
|
||||||
//};
|
|
||||||
|
#endif /* EVENTOBJECT_EVENT_H_ */
|
||||||
#endif /* FRAMEWORK_EVENTS_EVENT_H_ */
|
|
||||||
|
@ -1,166 +1,162 @@
|
|||||||
#include "../events/EventManager.h"
|
#include "EventManager.h"
|
||||||
#include "../events/EventMessage.h"
|
#include "EventMessage.h"
|
||||||
#include "../serviceinterface/ServiceInterfaceStream.h"
|
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||||
#include "../ipc/QueueFactory.h"
|
#include "../ipc/QueueFactory.h"
|
||||||
#include "../ipc/MutexFactory.h"
|
#include "../ipc/MutexFactory.h"
|
||||||
|
|
||||||
|
|
||||||
const uint16_t EventManager::POOL_SIZES[N_POOLS] = {
|
const uint16_t EventManager::POOL_SIZES[N_POOLS] = {
|
||||||
sizeof(EventMatchTree::Node), sizeof(EventIdRangeMatcher),
|
sizeof(EventMatchTree::Node), sizeof(EventIdRangeMatcher),
|
||||||
sizeof(ReporterRangeMatcher) };
|
sizeof(ReporterRangeMatcher) };
|
||||||
// If one checks registerListener calls, there are around 40 (to max 50)
|
// If one checks registerListener calls, there are around 40 (to max 50)
|
||||||
// objects registering for certain events.
|
// objects registering for certain events.
|
||||||
// Each listener requires 1 or 2 EventIdMatcher and 1 or 2 ReportRangeMatcher.
|
// Each listener requires 1 or 2 EventIdMatcher and 1 or 2 ReportRangeMatcher.
|
||||||
// So a good guess is 75 to a max of 100 pools required for each, which fits well.
|
// So a good guess is 75 to a max of 100 pools required for each, which fits well.
|
||||||
// SHOULDDO: Shouldn't this be in the config folder and passed via ctor?
|
// SHOULDDO: Shouldn't this be in the config folder and passed via ctor?
|
||||||
const uint16_t EventManager::N_ELEMENTS[N_POOLS] = { 240, 120, 120 };
|
const uint16_t EventManager::N_ELEMENTS[N_POOLS] = { 240, 120, 120 };
|
||||||
|
|
||||||
EventManager::EventManager(object_id_t setObjectId) :
|
EventManager::EventManager(object_id_t setObjectId) :
|
||||||
SystemObject(setObjectId),
|
SystemObject(setObjectId),
|
||||||
factoryBackend(0, POOL_SIZES, N_ELEMENTS, false, true) {
|
factoryBackend(0, POOL_SIZES, N_ELEMENTS, false, true) {
|
||||||
mutex = MutexFactory::instance()->createMutex();
|
mutex = MutexFactory::instance()->createMutex();
|
||||||
eventReportQueue = QueueFactory::instance()->createMessageQueue(
|
eventReportQueue = QueueFactory::instance()->createMessageQueue(
|
||||||
MAX_EVENTS_PER_CYCLE, EventMessage::EVENT_MESSAGE_SIZE);
|
MAX_EVENTS_PER_CYCLE, EventMessage::EVENT_MESSAGE_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
EventManager::~EventManager() {
|
EventManager::~EventManager() {
|
||||||
QueueFactory::instance()->deleteMessageQueue(eventReportQueue);
|
QueueFactory::instance()->deleteMessageQueue(eventReportQueue);
|
||||||
MutexFactory::instance()->deleteMutex(mutex);
|
MutexFactory::instance()->deleteMutex(mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageQueueId_t EventManager::getEventReportQueue() {
|
MessageQueueId_t EventManager::getEventReportQueue() {
|
||||||
return eventReportQueue->getId();
|
return eventReportQueue->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t EventManager::performOperation(uint8_t opCode) {
|
ReturnValue_t EventManager::performOperation(uint8_t opCode) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
while (result == HasReturnvaluesIF::RETURN_OK) {
|
while (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
EventMessage message;
|
EventMessage message;
|
||||||
result = eventReportQueue->receiveMessage(&message);
|
result = eventReportQueue->receiveMessage(&message);
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printEvent(&message);
|
printEvent(&message);
|
||||||
#endif
|
#endif
|
||||||
notifyListeners(&message);
|
notifyListeners(&message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventManager::notifyListeners(EventMessage* message) {
|
void EventManager::notifyListeners(EventMessage* message) {
|
||||||
lockMutex();
|
lockMutex();
|
||||||
for (auto iter = listenerList.begin(); iter != listenerList.end(); ++iter) {
|
for (auto iter = listenerList.begin(); iter != listenerList.end(); ++iter) {
|
||||||
if (iter->second.match(message)) {
|
if (iter->second.match(message)) {
|
||||||
MessageQueueSenderIF::sendMessage(iter->first, message,
|
MessageQueueSenderIF::sendMessage(iter->first, message,
|
||||||
message->getSender());
|
message->getSender());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unlockMutex();
|
unlockMutex();
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t EventManager::registerListener(MessageQueueId_t listener,
|
ReturnValue_t EventManager::registerListener(MessageQueueId_t listener,
|
||||||
bool forwardAllButSelected) {
|
bool forwardAllButSelected) {
|
||||||
auto result = listenerList.insert(
|
auto result = listenerList.insert(
|
||||||
std::pair<MessageQueueId_t, EventMatchTree>(listener,
|
std::pair<MessageQueueId_t, EventMatchTree>(listener,
|
||||||
EventMatchTree(&factoryBackend, forwardAllButSelected)));
|
EventMatchTree(&factoryBackend, forwardAllButSelected)));
|
||||||
if (!result.second) {
|
if (!result.second) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t EventManager::subscribeToEvent(MessageQueueId_t listener,
|
ReturnValue_t EventManager::subscribeToEvent(MessageQueueId_t listener,
|
||||||
EventId_t event) {
|
EventId_t event) {
|
||||||
return subscribeToEventRange(listener, event);
|
return subscribeToEventRange(listener, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t EventManager::subscribeToAllEventsFrom(MessageQueueId_t listener,
|
ReturnValue_t EventManager::subscribeToAllEventsFrom(MessageQueueId_t listener,
|
||||||
object_id_t object) {
|
object_id_t object) {
|
||||||
return subscribeToEventRange(listener, 0, 0, true, object);
|
return subscribeToEventRange(listener, 0, 0, true, object);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t EventManager::subscribeToEventRange(MessageQueueId_t listener,
|
ReturnValue_t EventManager::subscribeToEventRange(MessageQueueId_t listener,
|
||||||
EventId_t idFrom, EventId_t idTo, bool idInverted,
|
EventId_t idFrom, EventId_t idTo, bool idInverted,
|
||||||
object_id_t reporterFrom, object_id_t reporterTo,
|
object_id_t reporterFrom, object_id_t reporterTo,
|
||||||
bool reporterInverted) {
|
bool reporterInverted) {
|
||||||
auto iter = listenerList.find(listener);
|
auto iter = listenerList.find(listener);
|
||||||
if (iter == listenerList.end()) {
|
if (iter == listenerList.end()) {
|
||||||
return LISTENER_NOT_FOUND;
|
return LISTENER_NOT_FOUND;
|
||||||
}
|
}
|
||||||
lockMutex();
|
lockMutex();
|
||||||
ReturnValue_t result = iter->second.addMatch(idFrom, idTo, idInverted,
|
ReturnValue_t result = iter->second.addMatch(idFrom, idTo, idInverted,
|
||||||
reporterFrom, reporterTo, reporterInverted);
|
reporterFrom, reporterTo, reporterInverted);
|
||||||
unlockMutex();
|
unlockMutex();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t EventManager::unsubscribeFromEventRange(MessageQueueId_t listener,
|
ReturnValue_t EventManager::unsubscribeFromEventRange(MessageQueueId_t listener,
|
||||||
EventId_t idFrom, EventId_t idTo, bool idInverted,
|
EventId_t idFrom, EventId_t idTo, bool idInverted,
|
||||||
object_id_t reporterFrom, object_id_t reporterTo,
|
object_id_t reporterFrom, object_id_t reporterTo,
|
||||||
bool reporterInverted) {
|
bool reporterInverted) {
|
||||||
auto iter = listenerList.find(listener);
|
auto iter = listenerList.find(listener);
|
||||||
if (iter == listenerList.end()) {
|
if (iter == listenerList.end()) {
|
||||||
return LISTENER_NOT_FOUND;
|
return LISTENER_NOT_FOUND;
|
||||||
}
|
}
|
||||||
lockMutex();
|
lockMutex();
|
||||||
ReturnValue_t result = iter->second.removeMatch(idFrom, idTo, idInverted,
|
ReturnValue_t result = iter->second.removeMatch(idFrom, idTo, idInverted,
|
||||||
reporterFrom, reporterTo, reporterInverted);
|
reporterFrom, reporterTo, reporterInverted);
|
||||||
unlockMutex();
|
unlockMutex();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
||||||
// forward declaration, should be implemented by mission
|
void EventManager::printEvent(EventMessage* message) {
|
||||||
extern const char* translateObject(object_id_t object);
|
const char *string = 0;
|
||||||
extern const char* translateEvents(Event event);
|
switch (message->getSeverity()) {
|
||||||
|
case SEVERITY::INFO:
|
||||||
void EventManager::printEvent(EventMessage* message) {
|
#ifdef DEBUG_INFO_EVENT
|
||||||
const char *string = 0;
|
string = translateObject(message->getReporter());
|
||||||
switch (message->getSeverity()) {
|
sif::info << "EVENT: ";
|
||||||
case SEVERITY::INFO:
|
if (string != 0) {
|
||||||
#ifdef DEBUG_INFO_EVENT
|
sif::info << string;
|
||||||
string = translateObject(message->getReporter());
|
} else {
|
||||||
sif::info << "EVENT: ";
|
sif::info << "0x" << std::hex << message->getReporter() << std::dec;
|
||||||
if (string != 0) {
|
}
|
||||||
sif::info << string;
|
sif::info << " reported " << translateEvents(message->getEvent()) << " ("
|
||||||
} else {
|
<< std::dec << message->getEventId() << std::hex << ") P1: 0x"
|
||||||
sif::info << "0x" << std::hex << message->getReporter() << std::dec;
|
<< message->getParameter1() << " P2: 0x"
|
||||||
}
|
<< message->getParameter2() << std::dec << std::endl;
|
||||||
sif::info << " reported " << translateEvents(message->getEvent()) << " ("
|
#endif
|
||||||
<< std::dec << message->getEventId() << std::hex << ") P1: 0x"
|
break;
|
||||||
<< message->getParameter1() << " P2: 0x"
|
default:
|
||||||
<< message->getParameter2() << std::dec << std::endl;
|
string = translateObject(message->getReporter());
|
||||||
#endif
|
sif::debug << "EventManager: ";
|
||||||
break;
|
if (string != 0) {
|
||||||
default:
|
sif::debug << string;
|
||||||
string = translateObject(message->getReporter());
|
}
|
||||||
sif::debug << "EventManager: ";
|
else {
|
||||||
if (string != 0) {
|
sif::debug << "0x" << std::hex << message->getReporter() << std::dec;
|
||||||
sif::debug << string;
|
}
|
||||||
}
|
sif::debug << " reported " << translateEvents(message->getEvent())
|
||||||
else {
|
<< " (" << std::dec << message->getEventId() << ") "
|
||||||
sif::debug << "0x" << std::hex << message->getReporter() << std::dec;
|
<< std::endl;
|
||||||
}
|
|
||||||
sif::debug << " reported " << translateEvents(message->getEvent())
|
sif::debug << std::hex << "P1 Hex: 0x" << message->getParameter1()
|
||||||
<< " (" << std::dec << message->getEventId() << ") "
|
<< ", P1 Dec: " << std::dec << message->getParameter1()
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
sif::debug << std::hex << "P2 Hex: 0x" << message->getParameter2()
|
||||||
sif::debug << std::hex << "P1 Hex: 0x" << message->getParameter1()
|
<< ", P2 Dec: " << std::dec << message->getParameter2()
|
||||||
<< ", P1 Dec: " << std::dec << message->getParameter1()
|
<< std::endl;
|
||||||
<< std::endl;
|
break;
|
||||||
sif::debug << std::hex << "P2 Hex: 0x" << message->getParameter2()
|
}
|
||||||
<< ", P2 Dec: " << std::dec << message->getParameter2()
|
}
|
||||||
<< std::endl;
|
#endif
|
||||||
break;
|
|
||||||
}
|
void EventManager::lockMutex() {
|
||||||
}
|
mutex->lockMutex(MutexIF::BLOCKING);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
void EventManager::lockMutex() {
|
void EventManager::unlockMutex() {
|
||||||
mutex->lockMutex(MutexIF::BLOCKING);
|
mutex->unlockMutex();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventManager::unlockMutex() {
|
|
||||||
mutex->unlockMutex();
|
|
||||||
}
|
|
||||||
|
@ -1,61 +1,67 @@
|
|||||||
#ifndef EVENTMANAGER_H_
|
#ifndef EVENTMANAGER_H_
|
||||||
#define EVENTMANAGER_H_
|
#define EVENTMANAGER_H_
|
||||||
|
|
||||||
#include "../events/eventmatching/EventMatchTree.h"
|
#include "eventmatching/EventMatchTree.h"
|
||||||
#include "../events/EventManagerIF.h"
|
#include "EventManagerIF.h"
|
||||||
#include "../objectmanager/SystemObject.h"
|
#include "../objectmanager/SystemObject.h"
|
||||||
#include "../storagemanager/LocalPool.h"
|
#include "../storagemanager/LocalPool.h"
|
||||||
#include "../tasks/ExecutableObjectIF.h"
|
#include "../tasks/ExecutableObjectIF.h"
|
||||||
#include "../ipc/MessageQueueIF.h"
|
#include "../ipc/MessageQueueIF.h"
|
||||||
#include "../ipc/MutexIF.h"
|
#include "../ipc/MutexIF.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
class EventManager: public EventManagerIF,
|
#ifdef DEBUG
|
||||||
public ExecutableObjectIF,
|
// forward declaration, should be implemented by mission
|
||||||
public SystemObject {
|
extern const char* translateObject(object_id_t object);
|
||||||
public:
|
extern const char* translateEvents(Event event);
|
||||||
static const uint16_t MAX_EVENTS_PER_CYCLE = 80;
|
#endif
|
||||||
|
|
||||||
EventManager(object_id_t setObjectId);
|
class EventManager: public EventManagerIF,
|
||||||
virtual ~EventManager();
|
public ExecutableObjectIF,
|
||||||
|
public SystemObject {
|
||||||
MessageQueueId_t getEventReportQueue();
|
public:
|
||||||
|
static const uint16_t MAX_EVENTS_PER_CYCLE = 80;
|
||||||
ReturnValue_t registerListener(MessageQueueId_t listener, bool forwardAllButSelected = false);
|
|
||||||
ReturnValue_t subscribeToEvent(MessageQueueId_t listener, EventId_t event);
|
EventManager(object_id_t setObjectId);
|
||||||
ReturnValue_t subscribeToAllEventsFrom(MessageQueueId_t listener,
|
virtual ~EventManager();
|
||||||
object_id_t object);
|
|
||||||
ReturnValue_t subscribeToEventRange(MessageQueueId_t listener,
|
MessageQueueId_t getEventReportQueue();
|
||||||
EventId_t idFrom = 0, EventId_t idTo = 0, bool idInverted = false,
|
|
||||||
object_id_t reporterFrom = 0, object_id_t reporterTo = 0,
|
ReturnValue_t registerListener(MessageQueueId_t listener, bool forwardAllButSelected = false);
|
||||||
bool reporterInverted = false);
|
ReturnValue_t subscribeToEvent(MessageQueueId_t listener, EventId_t event);
|
||||||
ReturnValue_t unsubscribeFromEventRange(MessageQueueId_t listener,
|
ReturnValue_t subscribeToAllEventsFrom(MessageQueueId_t listener,
|
||||||
EventId_t idFrom = 0, EventId_t idTo = 0, bool idInverted = false,
|
object_id_t object);
|
||||||
object_id_t reporterFrom = 0, object_id_t reporterTo = 0,
|
ReturnValue_t subscribeToEventRange(MessageQueueId_t listener,
|
||||||
bool reporterInverted = false);
|
EventId_t idFrom = 0, EventId_t idTo = 0, bool idInverted = false,
|
||||||
ReturnValue_t performOperation(uint8_t opCode);
|
object_id_t reporterFrom = 0, object_id_t reporterTo = 0,
|
||||||
protected:
|
bool reporterInverted = false);
|
||||||
|
ReturnValue_t unsubscribeFromEventRange(MessageQueueId_t listener,
|
||||||
MessageQueueIF* eventReportQueue = nullptr;
|
EventId_t idFrom = 0, EventId_t idTo = 0, bool idInverted = false,
|
||||||
|
object_id_t reporterFrom = 0, object_id_t reporterTo = 0,
|
||||||
std::map<MessageQueueId_t, EventMatchTree> listenerList;
|
bool reporterInverted = false);
|
||||||
|
ReturnValue_t performOperation(uint8_t opCode);
|
||||||
MutexIF* mutex = nullptr;
|
protected:
|
||||||
|
|
||||||
static const uint8_t N_POOLS = 3;
|
MessageQueueIF* eventReportQueue = nullptr;
|
||||||
LocalPool<N_POOLS> factoryBackend;
|
|
||||||
static const uint16_t POOL_SIZES[N_POOLS];
|
std::map<MessageQueueId_t, EventMatchTree> listenerList;
|
||||||
static const uint16_t N_ELEMENTS[N_POOLS];
|
|
||||||
|
MutexIF* mutex = nullptr;
|
||||||
void notifyListeners(EventMessage *message);
|
|
||||||
|
static const uint8_t N_POOLS = 3;
|
||||||
#ifdef DEBUG
|
LocalPool<N_POOLS> factoryBackend;
|
||||||
void printEvent(EventMessage *message);
|
static const uint16_t POOL_SIZES[N_POOLS];
|
||||||
#endif
|
static const uint16_t N_ELEMENTS[N_POOLS];
|
||||||
|
|
||||||
void lockMutex();
|
void notifyListeners(EventMessage *message);
|
||||||
|
|
||||||
void unlockMutex();
|
#ifdef DEBUG
|
||||||
};
|
void printEvent(EventMessage *message);
|
||||||
|
#endif
|
||||||
#endif /* EVENTMANAGER_H_ */
|
|
||||||
|
void lockMutex();
|
||||||
|
|
||||||
|
void unlockMutex();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* EVENTMANAGER_H_ */
|
||||||
|
@ -1,52 +1,52 @@
|
|||||||
#ifndef EVENTMANAGERIF_H_
|
#ifndef EVENTMANAGERIF_H_
|
||||||
#define EVENTMANAGERIF_H_
|
#define EVENTMANAGERIF_H_
|
||||||
|
|
||||||
#include "../events/eventmatching/eventmatching.h"
|
#include "eventmatching/eventmatching.h"
|
||||||
#include "../events/EventMessage.h"
|
#include "EventMessage.h"
|
||||||
#include "../objectmanager/ObjectManagerIF.h"
|
#include "../objectmanager/ObjectManagerIF.h"
|
||||||
#include "../ipc/MessageQueueSenderIF.h"
|
#include "../ipc/MessageQueueSenderIF.h"
|
||||||
|
|
||||||
class EventManagerIF {
|
class EventManagerIF {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static const uint8_t INTERFACE_ID = CLASS_ID::EVENT_MANAGER_IF;
|
static const uint8_t INTERFACE_ID = CLASS_ID::EVENT_MANAGER_IF;
|
||||||
static const ReturnValue_t LISTENER_NOT_FOUND = MAKE_RETURN_CODE(1);
|
static const ReturnValue_t LISTENER_NOT_FOUND = MAKE_RETURN_CODE(1);
|
||||||
virtual ~EventManagerIF() {
|
virtual ~EventManagerIF() {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual MessageQueueId_t getEventReportQueue() = 0;
|
virtual MessageQueueId_t getEventReportQueue() = 0;
|
||||||
|
|
||||||
virtual ReturnValue_t registerListener(MessageQueueId_t listener, bool forwardAllButSelected = false) = 0;
|
virtual ReturnValue_t registerListener(MessageQueueId_t listener, bool forwardAllButSelected = false) = 0;
|
||||||
virtual ReturnValue_t subscribeToEvent(MessageQueueId_t listener,
|
virtual ReturnValue_t subscribeToEvent(MessageQueueId_t listener,
|
||||||
EventId_t event) = 0;
|
EventId_t event) = 0;
|
||||||
virtual ReturnValue_t subscribeToAllEventsFrom(MessageQueueId_t listener,
|
virtual ReturnValue_t subscribeToAllEventsFrom(MessageQueueId_t listener,
|
||||||
object_id_t object) = 0;
|
object_id_t object) = 0;
|
||||||
virtual ReturnValue_t subscribeToEventRange(MessageQueueId_t listener,
|
virtual ReturnValue_t subscribeToEventRange(MessageQueueId_t listener,
|
||||||
EventId_t idFrom = 0, EventId_t idTo = 0, bool idInverted = false,
|
EventId_t idFrom = 0, EventId_t idTo = 0, bool idInverted = false,
|
||||||
object_id_t reporterFrom = 0, object_id_t reporterTo = 0,
|
object_id_t reporterFrom = 0, object_id_t reporterTo = 0,
|
||||||
bool reporterInverted = false) = 0;
|
bool reporterInverted = false) = 0;
|
||||||
virtual ReturnValue_t unsubscribeFromEventRange(MessageQueueId_t listener,
|
virtual ReturnValue_t unsubscribeFromEventRange(MessageQueueId_t listener,
|
||||||
EventId_t idFrom = 0, EventId_t idTo = 0, bool idInverted = false,
|
EventId_t idFrom = 0, EventId_t idTo = 0, bool idInverted = false,
|
||||||
object_id_t reporterFrom = 0, object_id_t reporterTo = 0,
|
object_id_t reporterFrom = 0, object_id_t reporterTo = 0,
|
||||||
bool reporterInverted = false) = 0;
|
bool reporterInverted = false) = 0;
|
||||||
|
|
||||||
static void triggerEvent(object_id_t reportingObject, Event event,
|
static void triggerEvent(object_id_t reportingObject, Event event,
|
||||||
uint32_t parameter1 = 0, uint32_t parameter2 = 0, MessageQueueId_t sentFrom = 0) {
|
uint32_t parameter1 = 0, uint32_t parameter2 = 0, MessageQueueId_t sentFrom = 0) {
|
||||||
EventMessage message(event, reportingObject, parameter1, parameter2);
|
EventMessage message(event, reportingObject, parameter1, parameter2);
|
||||||
triggerEvent(&message, sentFrom);
|
triggerEvent(&message, sentFrom);
|
||||||
}
|
}
|
||||||
static void triggerEvent(EventMessage* message, MessageQueueId_t sentFrom = 0) {
|
static void triggerEvent(EventMessage* message, MessageQueueId_t sentFrom = 0) {
|
||||||
static MessageQueueId_t eventmanagerQueue = 0;
|
static MessageQueueId_t eventmanagerQueue = 0;
|
||||||
if (eventmanagerQueue == 0) {
|
if (eventmanagerQueue == 0) {
|
||||||
EventManagerIF *eventmanager = objectManager->get<EventManagerIF>(
|
EventManagerIF *eventmanager = objectManager->get<EventManagerIF>(
|
||||||
objects::EVENT_MANAGER);
|
objects::EVENT_MANAGER);
|
||||||
if (eventmanager != NULL) {
|
if (eventmanager != NULL) {
|
||||||
eventmanagerQueue = eventmanager->getEventReportQueue();
|
eventmanagerQueue = eventmanager->getEventReportQueue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MessageQueueSenderIF::sendMessage(eventmanagerQueue, message, sentFrom);
|
MessageQueueSenderIF::sendMessage(eventmanagerQueue, message, sentFrom);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* EVENTMANAGERIF_H_ */
|
#endif /* EVENTMANAGERIF_H_ */
|
||||||
|
@ -1,114 +1,114 @@
|
|||||||
#include "../events/EventMessage.h"
|
#include "EventMessage.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
EventMessage::EventMessage() {
|
EventMessage::EventMessage() {
|
||||||
messageSize = EVENT_MESSAGE_SIZE;
|
messageSize = EVENT_MESSAGE_SIZE;
|
||||||
clearEventMessage();
|
clearEventMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
EventMessage::EventMessage(Event event, object_id_t reporter,
|
EventMessage::EventMessage(Event event, object_id_t reporter,
|
||||||
uint32_t parameter1, uint32_t parameter2) {
|
uint32_t parameter1, uint32_t parameter2) {
|
||||||
messageSize = EVENT_MESSAGE_SIZE;
|
messageSize = EVENT_MESSAGE_SIZE;
|
||||||
setMessageId(EVENT_MESSAGE);
|
setMessageId(EVENT_MESSAGE);
|
||||||
setEvent(event);
|
setEvent(event);
|
||||||
setReporter(reporter);
|
setReporter(reporter);
|
||||||
setParameter1(parameter1);
|
setParameter1(parameter1);
|
||||||
setParameter2(parameter2);
|
setParameter2(parameter2);
|
||||||
}
|
}
|
||||||
|
|
||||||
EventMessage::~EventMessage() {
|
EventMessage::~EventMessage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Event EventMessage::getEvent() {
|
Event EventMessage::getEvent() {
|
||||||
Event event;
|
Event event;
|
||||||
memcpy(&event, getData(), sizeof(Event));
|
memcpy(&event, getData(), sizeof(Event));
|
||||||
return (event & 0xFFFFFF);
|
return (event & 0xFFFFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventMessage::setEvent(Event event) {
|
void EventMessage::setEvent(Event event) {
|
||||||
Event tempEvent;
|
Event tempEvent;
|
||||||
memcpy(&tempEvent, getData(), sizeof(Event));
|
memcpy(&tempEvent, getData(), sizeof(Event));
|
||||||
tempEvent = (tempEvent & 0xFF000000) + (event & 0xFFFFFF);
|
tempEvent = (tempEvent & 0xFF000000) + (event & 0xFFFFFF);
|
||||||
memcpy(getData(), &tempEvent, sizeof(Event));
|
memcpy(getData(), &tempEvent, sizeof(Event));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t EventMessage::getMessageId() {
|
uint8_t EventMessage::getMessageId() {
|
||||||
Event event;
|
Event event;
|
||||||
memcpy(&event, getData(), sizeof(Event));
|
memcpy(&event, getData(), sizeof(Event));
|
||||||
return (event & 0xFF000000) >> 24;
|
return (event & 0xFF000000) >> 24;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventMessage::setMessageId(uint8_t id) {
|
void EventMessage::setMessageId(uint8_t id) {
|
||||||
Event event;
|
Event event;
|
||||||
memcpy(&event, getData(), sizeof(Event));
|
memcpy(&event, getData(), sizeof(Event));
|
||||||
event = (event & 0x00FFFFFF) + (id << 24);
|
event = (event & 0x00FFFFFF) + (id << 24);
|
||||||
memcpy(getData(), &event, sizeof(Event));
|
memcpy(getData(), &event, sizeof(Event));
|
||||||
}
|
}
|
||||||
|
|
||||||
EventSeverity_t EventMessage::getSeverity() {
|
EventSeverity_t EventMessage::getSeverity() {
|
||||||
Event event;
|
Event event;
|
||||||
memcpy(&event, getData(), sizeof(Event));
|
memcpy(&event, getData(), sizeof(Event));
|
||||||
return EVENT::getSeverity(event);
|
return EVENT::getSeverity(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventMessage::setSeverity(EventSeverity_t severity) {
|
void EventMessage::setSeverity(EventSeverity_t severity) {
|
||||||
Event event;
|
Event event;
|
||||||
memcpy(&event, getData(), sizeof(Event));
|
memcpy(&event, getData(), sizeof(Event));
|
||||||
event = (event & 0xFF00FFFF) + (severity << 16);
|
event = (event & 0xFF00FFFF) + (severity << 16);
|
||||||
memcpy(getData(), &event, sizeof(Event));
|
memcpy(getData(), &event, sizeof(Event));
|
||||||
}
|
}
|
||||||
|
|
||||||
EventId_t EventMessage::getEventId() {
|
EventId_t EventMessage::getEventId() {
|
||||||
Event event;
|
Event event;
|
||||||
memcpy(&event, getData(), sizeof(Event));
|
memcpy(&event, getData(), sizeof(Event));
|
||||||
return EVENT::getEventId(event);
|
return EVENT::getEventId(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventMessage::setEventId(EventId_t eventId) {
|
void EventMessage::setEventId(EventId_t eventId) {
|
||||||
Event event;
|
Event event;
|
||||||
memcpy(&event, getData(), sizeof(Event));
|
memcpy(&event, getData(), sizeof(Event));
|
||||||
event = (event & 0xFFFF0000) + eventId;
|
event = (event & 0xFFFF0000) + eventId;
|
||||||
memcpy(getData(), &event, sizeof(Event));
|
memcpy(getData(), &event, sizeof(Event));
|
||||||
}
|
}
|
||||||
|
|
||||||
object_id_t EventMessage::getReporter() {
|
object_id_t EventMessage::getReporter() {
|
||||||
object_id_t parameter;
|
object_id_t parameter;
|
||||||
memcpy(¶meter, getData() + sizeof(Event), sizeof(object_id_t));
|
memcpy(¶meter, getData() + sizeof(Event), sizeof(object_id_t));
|
||||||
return parameter;
|
return parameter;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventMessage::setReporter(object_id_t reporter) {
|
void EventMessage::setReporter(object_id_t reporter) {
|
||||||
memcpy(getData() + sizeof(Event), &reporter, sizeof(object_id_t));
|
memcpy(getData() + sizeof(Event), &reporter, sizeof(object_id_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t EventMessage::getParameter1() {
|
uint32_t EventMessage::getParameter1() {
|
||||||
uint32_t parameter;
|
uint32_t parameter;
|
||||||
memcpy(¶meter, getData() + sizeof(Event) + sizeof(object_id_t), 4);
|
memcpy(¶meter, getData() + sizeof(Event) + sizeof(object_id_t), 4);
|
||||||
return parameter;
|
return parameter;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventMessage::setParameter1(uint32_t parameter) {
|
void EventMessage::setParameter1(uint32_t parameter) {
|
||||||
memcpy(getData() + sizeof(Event) + sizeof(object_id_t), ¶meter, 4);
|
memcpy(getData() + sizeof(Event) + sizeof(object_id_t), ¶meter, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t EventMessage::getParameter2() {
|
uint32_t EventMessage::getParameter2() {
|
||||||
uint32_t parameter;
|
uint32_t parameter;
|
||||||
memcpy(¶meter, getData() + sizeof(Event) + sizeof(object_id_t) + 4, 4);
|
memcpy(¶meter, getData() + sizeof(Event) + sizeof(object_id_t) + 4, 4);
|
||||||
return parameter;
|
return parameter;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventMessage::setParameter2(uint32_t parameter) {
|
void EventMessage::setParameter2(uint32_t parameter) {
|
||||||
memcpy(getData() + sizeof(Event) + sizeof(object_id_t) + 4, ¶meter, 4);
|
memcpy(getData() + sizeof(Event) + sizeof(object_id_t) + 4, ¶meter, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventMessage::clearEventMessage() {
|
void EventMessage::clearEventMessage() {
|
||||||
setEvent(INVALID_EVENT);
|
setEvent(INVALID_EVENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EventMessage::isClearedEventMessage() {
|
bool EventMessage::isClearedEventMessage() {
|
||||||
return getEvent() == INVALID_EVENT;
|
return getEvent() == INVALID_EVENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t EventMessage::getMinimumMessageSize() {
|
size_t EventMessage::getMinimumMessageSize() {
|
||||||
return EVENT_MESSAGE_SIZE;
|
return EVENT_MESSAGE_SIZE;
|
||||||
}
|
}
|
||||||
|
@ -1,52 +1,52 @@
|
|||||||
#ifndef EVENTMESSAGE_H_
|
#ifndef EVENTMESSAGE_H_
|
||||||
#define EVENTMESSAGE_H_
|
#define EVENTMESSAGE_H_
|
||||||
|
|
||||||
#include "../events/Event.h"
|
#include "Event.h"
|
||||||
#include "../ipc/MessageQueueMessage.h"
|
#include "../ipc/MessageQueueMessage.h"
|
||||||
#include "../objectmanager/ObjectManagerIF.h"
|
#include "../objectmanager/ObjectManagerIF.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Passing on events through IPC.
|
* Passing on events through IPC.
|
||||||
* Event Id, severity and message type retrieval is a bit difficult.
|
* Event Id, severity and message type retrieval is a bit difficult.
|
||||||
*/
|
*/
|
||||||
class EventMessage: public MessageQueueMessage {
|
class EventMessage: public MessageQueueMessage {
|
||||||
public:
|
public:
|
||||||
static const uint8_t EVENT_MESSAGE = 0; //!< Normal event
|
static const uint8_t EVENT_MESSAGE = 0; //!< Normal event
|
||||||
static const uint8_t CONFIRMATION_REQUEST = 1; //!< Request to parent if event is caused by child or not.
|
static const uint8_t CONFIRMATION_REQUEST = 1; //!< Request to parent if event is caused by child or not.
|
||||||
static const uint8_t YOUR_FAULT = 2; //!< The fault was caused by child, parent believes it's ok.
|
static const uint8_t YOUR_FAULT = 2; //!< The fault was caused by child, parent believes it's ok.
|
||||||
static const uint8_t MY_FAULT = 3; //!< The fault was caused by the parent, child is ok.
|
static const uint8_t MY_FAULT = 3; //!< The fault was caused by the parent, child is ok.
|
||||||
//Add other messageIDs here if necessary.
|
//Add other messageIDs here if necessary.
|
||||||
static const uint8_t EVENT_MESSAGE_SIZE = HEADER_SIZE + sizeof(Event)
|
static const uint8_t EVENT_MESSAGE_SIZE = HEADER_SIZE + sizeof(Event)
|
||||||
+ 3 * sizeof(uint32_t);
|
+ 3 * sizeof(uint32_t);
|
||||||
|
|
||||||
EventMessage();
|
EventMessage();
|
||||||
// EventMessage(EventId_t event, EventSeverity_t severity,
|
// EventMessage(EventId_t event, EventSeverity_t severity,
|
||||||
// object_id_t reporter, uint32_t parameter1, uint32_t parameter2 = 0);
|
// object_id_t reporter, uint32_t parameter1, uint32_t parameter2 = 0);
|
||||||
EventMessage(Event event, object_id_t reporter, uint32_t parameter1,
|
EventMessage(Event event, object_id_t reporter, uint32_t parameter1,
|
||||||
uint32_t parameter2 = 0);
|
uint32_t parameter2 = 0);
|
||||||
virtual ~EventMessage();
|
virtual ~EventMessage();
|
||||||
Event getEvent();
|
Event getEvent();
|
||||||
void setEvent(Event event);
|
void setEvent(Event event);
|
||||||
uint8_t getMessageId();
|
uint8_t getMessageId();
|
||||||
void setMessageId(uint8_t id);
|
void setMessageId(uint8_t id);
|
||||||
EventSeverity_t getSeverity();
|
EventSeverity_t getSeverity();
|
||||||
void setSeverity(EventSeverity_t severity);
|
void setSeverity(EventSeverity_t severity);
|
||||||
EventId_t getEventId();
|
EventId_t getEventId();
|
||||||
void setEventId(EventId_t event);
|
void setEventId(EventId_t event);
|
||||||
object_id_t getReporter();
|
object_id_t getReporter();
|
||||||
void setReporter(object_id_t reporter);
|
void setReporter(object_id_t reporter);
|
||||||
uint32_t getParameter1();
|
uint32_t getParameter1();
|
||||||
void setParameter1(uint32_t parameter);
|
void setParameter1(uint32_t parameter);
|
||||||
uint32_t getParameter2();
|
uint32_t getParameter2();
|
||||||
void setParameter2(uint32_t parameter);
|
void setParameter2(uint32_t parameter);
|
||||||
|
|
||||||
void clearEventMessage();
|
void clearEventMessage();
|
||||||
bool isClearedEventMessage();
|
bool isClearedEventMessage();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static const Event INVALID_EVENT = 0;
|
static const Event INVALID_EVENT = 0;
|
||||||
virtual size_t getMinimumMessageSize();
|
virtual size_t getMinimumMessageSize();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* EVENTMESSAGE_H_ */
|
#endif /* EVENTMESSAGE_H_ */
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
#ifndef FRAMEWORK_EVENTS_EVENTREPORTINGPROXYIF_H_
|
#ifndef FRAMEWORK_EVENTS_EVENTREPORTINGPROXYIF_H_
|
||||||
#define FRAMEWORK_EVENTS_EVENTREPORTINGPROXYIF_H_
|
#define FRAMEWORK_EVENTS_EVENTREPORTINGPROXYIF_H_
|
||||||
|
|
||||||
#include "../events/Event.h"
|
#include "Event.h"
|
||||||
|
|
||||||
|
|
||||||
class EventReportingProxyIF {
|
class EventReportingProxyIF {
|
||||||
public:
|
public:
|
||||||
virtual ~EventReportingProxyIF() {
|
virtual ~EventReportingProxyIF() {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void forwardEvent(Event event, uint32_t parameter1 = 0, uint32_t parameter2 = 0) const = 0;
|
virtual void forwardEvent(Event event, uint32_t parameter1 = 0, uint32_t parameter2 = 0) const = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* FRAMEWORK_EVENTS_EVENTREPORTINGPROXYIF_H_ */
|
#endif /* FRAMEWORK_EVENTS_EVENTREPORTINGPROXYIF_H_ */
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
#include "../../events/eventmatching/EventIdRangeMatcher.h"
|
#include "EventIdRangeMatcher.h"
|
||||||
|
|
||||||
EventIdRangeMatcher::EventIdRangeMatcher(EventId_t lower, EventId_t upper,
|
EventIdRangeMatcher::EventIdRangeMatcher(EventId_t lower, EventId_t upper,
|
||||||
bool inverted) : EventRangeMatcherBase<EventId_t>(lower, upper, inverted) {
|
bool inverted) : EventRangeMatcherBase<EventId_t>(lower, upper, inverted) {
|
||||||
}
|
}
|
||||||
|
|
||||||
EventIdRangeMatcher::~EventIdRangeMatcher() {
|
EventIdRangeMatcher::~EventIdRangeMatcher() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EventIdRangeMatcher::match(EventMessage* message) {
|
bool EventIdRangeMatcher::match(EventMessage* message) {
|
||||||
return rangeMatcher.match(message->getEventId());
|
return rangeMatcher.match(message->getEventId());
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#ifndef FRAMEWORK_EVENTS_EVENTMATCHING_EVENTIDRANGEMATCHER_H_
|
#ifndef FRAMEWORK_EVENTS_EVENTMATCHING_EVENTIDRANGEMATCHER_H_
|
||||||
#define FRAMEWORK_EVENTS_EVENTMATCHING_EVENTIDRANGEMATCHER_H_
|
#define FRAMEWORK_EVENTS_EVENTMATCHING_EVENTIDRANGEMATCHER_H_
|
||||||
|
|
||||||
#include "../../events/eventmatching/EventRangeMatcherBase.h"
|
#include "EventRangeMatcherBase.h"
|
||||||
|
|
||||||
class EventIdRangeMatcher: public EventRangeMatcherBase<EventId_t> {
|
class EventIdRangeMatcher: public EventRangeMatcherBase<EventId_t> {
|
||||||
public:
|
public:
|
||||||
EventIdRangeMatcher(EventId_t lower, EventId_t upper, bool inverted);
|
EventIdRangeMatcher(EventId_t lower, EventId_t upper, bool inverted);
|
||||||
~EventIdRangeMatcher();
|
~EventIdRangeMatcher();
|
||||||
bool match(EventMessage* message);
|
bool match(EventMessage* message);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FRAMEWORK_EVENTS_EVENTMATCHING_EVENTIDRANGEMATCHER_H_ */
|
#endif /* FRAMEWORK_EVENTS_EVENTMATCHING_EVENTIDRANGEMATCHER_H_ */
|
||||||
|
@ -1,149 +1,149 @@
|
|||||||
#include "../../events/eventmatching/EventIdRangeMatcher.h"
|
#include "EventIdRangeMatcher.h"
|
||||||
#include "../../events/eventmatching/EventMatchTree.h"
|
#include "EventMatchTree.h"
|
||||||
#include "../../events/eventmatching/ReporterRangeMatcher.h"
|
#include "ReporterRangeMatcher.h"
|
||||||
#include "../../events/eventmatching/SeverityRangeMatcher.h"
|
#include "SeverityRangeMatcher.h"
|
||||||
|
|
||||||
EventMatchTree::EventMatchTree(StorageManagerIF* storageBackend,
|
EventMatchTree::EventMatchTree(StorageManagerIF* storageBackend,
|
||||||
bool invertedMatch) :
|
bool invertedMatch) :
|
||||||
MatchTree<EventMessage*>(end(), 1), factory(storageBackend), invertedMatch(
|
MatchTree<EventMessage*>(end(), 1), factory(storageBackend), invertedMatch(
|
||||||
invertedMatch) {
|
invertedMatch) {
|
||||||
}
|
}
|
||||||
|
|
||||||
EventMatchTree::~EventMatchTree() {
|
EventMatchTree::~EventMatchTree() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EventMatchTree::match(EventMessage* number) {
|
bool EventMatchTree::match(EventMessage* number) {
|
||||||
if (invertedMatch) {
|
if (invertedMatch) {
|
||||||
return !MatchTree<EventMessage*>::match(number);
|
return !MatchTree<EventMessage*>::match(number);
|
||||||
} else {
|
} else {
|
||||||
return MatchTree<EventMessage*>::match(number);
|
return MatchTree<EventMessage*>::match(number);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t EventMatchTree::addMatch(EventId_t idFrom, EventId_t idTo,
|
ReturnValue_t EventMatchTree::addMatch(EventId_t idFrom, EventId_t idTo,
|
||||||
bool idInverted, object_id_t reporterFrom, object_id_t reporterTo,
|
bool idInverted, object_id_t reporterFrom, object_id_t reporterTo,
|
||||||
bool reporterInverted) {
|
bool reporterInverted) {
|
||||||
if (idFrom == 0) {
|
if (idFrom == 0) {
|
||||||
//Assuming all events shall be forwarded.
|
//Assuming all events shall be forwarded.
|
||||||
idTo = 0;
|
idTo = 0;
|
||||||
idInverted = true;
|
idInverted = true;
|
||||||
}
|
}
|
||||||
if (idTo == 0) {
|
if (idTo == 0) {
|
||||||
idTo = idFrom;
|
idTo = idFrom;
|
||||||
}
|
}
|
||||||
iterator lastTest;
|
iterator lastTest;
|
||||||
ReturnValue_t result = findOrInsertRangeMatcher<EventId_t,
|
ReturnValue_t result = findOrInsertRangeMatcher<EventId_t,
|
||||||
EventIdRangeMatcher>(begin(), idFrom, idTo, idInverted, &lastTest);
|
EventIdRangeMatcher>(begin(), idFrom, idTo, idInverted, &lastTest);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (reporterFrom == 0) {
|
if (reporterFrom == 0) {
|
||||||
//No need to add another AND branch
|
//No need to add another AND branch
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
if (reporterTo == 0) {
|
if (reporterTo == 0) {
|
||||||
reporterTo = reporterFrom;
|
reporterTo = reporterFrom;
|
||||||
}
|
}
|
||||||
return findOrInsertRangeMatcher<object_id_t, ReporterRangeMatcher>(
|
return findOrInsertRangeMatcher<object_id_t, ReporterRangeMatcher>(
|
||||||
lastTest.left(), reporterFrom, reporterTo, reporterInverted,
|
lastTest.left(), reporterFrom, reporterTo, reporterInverted,
|
||||||
&lastTest);
|
&lastTest);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t EventMatchTree::removeMatch(EventId_t idFrom, EventId_t idTo,
|
ReturnValue_t EventMatchTree::removeMatch(EventId_t idFrom, EventId_t idTo,
|
||||||
bool idInverted, object_id_t reporterFrom, object_id_t reporterTo,
|
bool idInverted, object_id_t reporterFrom, object_id_t reporterTo,
|
||||||
bool reporterInverted) {
|
bool reporterInverted) {
|
||||||
|
|
||||||
iterator foundElement;
|
iterator foundElement;
|
||||||
|
|
||||||
if (idFrom == 0) {
|
if (idFrom == 0) {
|
||||||
//Assuming a "forward all events" request.
|
//Assuming a "forward all events" request.
|
||||||
idTo = 0;
|
idTo = 0;
|
||||||
idInverted = true;
|
idInverted = true;
|
||||||
}
|
}
|
||||||
if (idTo == 0) {
|
if (idTo == 0) {
|
||||||
idTo = idFrom;
|
idTo = idFrom;
|
||||||
}
|
}
|
||||||
foundElement = findRangeMatcher<EventId_t, EventIdRangeMatcher>(begin(),
|
foundElement = findRangeMatcher<EventId_t, EventIdRangeMatcher>(begin(),
|
||||||
idFrom, idTo, idInverted);
|
idFrom, idTo, idInverted);
|
||||||
if (foundElement == end()) {
|
if (foundElement == end()) {
|
||||||
return NO_MATCH; //Can't tell if too detailed or just not found.
|
return NO_MATCH; //Can't tell if too detailed or just not found.
|
||||||
}
|
}
|
||||||
if (reporterFrom == 0) {
|
if (reporterFrom == 0) {
|
||||||
if (foundElement.left() == end()) {
|
if (foundElement.left() == end()) {
|
||||||
return removeElementAndReconnectChildren(foundElement);
|
return removeElementAndReconnectChildren(foundElement);
|
||||||
} else {
|
} else {
|
||||||
return TOO_GENERAL_REQUEST;
|
return TOO_GENERAL_REQUEST;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (reporterTo == 0) {
|
if (reporterTo == 0) {
|
||||||
reporterTo = reporterFrom;
|
reporterTo = reporterFrom;
|
||||||
}
|
}
|
||||||
foundElement = findRangeMatcher<object_id_t, ReporterRangeMatcher>(
|
foundElement = findRangeMatcher<object_id_t, ReporterRangeMatcher>(
|
||||||
foundElement.left(), reporterFrom, reporterTo, reporterInverted);
|
foundElement.left(), reporterFrom, reporterTo, reporterInverted);
|
||||||
if (foundElement == end()) {
|
if (foundElement == end()) {
|
||||||
return NO_MATCH;
|
return NO_MATCH;
|
||||||
} else {
|
} else {
|
||||||
return removeElementAndReconnectChildren(foundElement);
|
return removeElementAndReconnectChildren(foundElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename VALUE_T, typename INSERTION_T>
|
template<typename VALUE_T, typename INSERTION_T>
|
||||||
inline ReturnValue_t EventMatchTree::findOrInsertRangeMatcher(iterator start,
|
inline ReturnValue_t EventMatchTree::findOrInsertRangeMatcher(iterator start,
|
||||||
VALUE_T idFrom, VALUE_T idTo, bool inverted, iterator* lastTest) {
|
VALUE_T idFrom, VALUE_T idTo, bool inverted, iterator* lastTest) {
|
||||||
bool attachToBranch = AND;
|
bool attachToBranch = AND;
|
||||||
iterator iter = start;
|
iterator iter = start;
|
||||||
while (iter != end()) {
|
while (iter != end()) {
|
||||||
INSERTION_T* matcher = static_cast<INSERTION_T*>(*iter);
|
INSERTION_T* matcher = static_cast<INSERTION_T*>(*iter);
|
||||||
attachToBranch = OR;
|
attachToBranch = OR;
|
||||||
*lastTest = iter;
|
*lastTest = iter;
|
||||||
if ((matcher->rangeMatcher.lowerBound == idFrom)
|
if ((matcher->rangeMatcher.lowerBound == idFrom)
|
||||||
&& (matcher->rangeMatcher.upperBound == idTo)
|
&& (matcher->rangeMatcher.upperBound == idTo)
|
||||||
&& (matcher->rangeMatcher.inverted == inverted)) {
|
&& (matcher->rangeMatcher.inverted == inverted)) {
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
} else {
|
} else {
|
||||||
iter = iter.right();
|
iter = iter.right();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Only reached if nothing was found.
|
//Only reached if nothing was found.
|
||||||
SerializeableMatcherIF<EventMessage*>* newContent = factory.generate<
|
SerializeableMatcherIF<EventMessage*>* newContent = factory.generate<
|
||||||
INSERTION_T>(idFrom, idTo, inverted);
|
INSERTION_T>(idFrom, idTo, inverted);
|
||||||
if (newContent == NULL) {
|
if (newContent == NULL) {
|
||||||
return FULL;
|
return FULL;
|
||||||
}
|
}
|
||||||
Node* newNode = factory.generate<Node>(newContent);
|
Node* newNode = factory.generate<Node>(newContent);
|
||||||
if (newNode == NULL) {
|
if (newNode == NULL) {
|
||||||
//Need to make sure partially generated content is deleted, otherwise, that's a leak.
|
//Need to make sure partially generated content is deleted, otherwise, that's a leak.
|
||||||
factory.destroy<INSERTION_T>(static_cast<INSERTION_T*>(newContent));
|
factory.destroy<INSERTION_T>(static_cast<INSERTION_T*>(newContent));
|
||||||
return FULL;
|
return FULL;
|
||||||
}
|
}
|
||||||
*lastTest = insert(attachToBranch, *lastTest, newNode);
|
*lastTest = insert(attachToBranch, *lastTest, newNode);
|
||||||
if (*lastTest == end()) {
|
if (*lastTest == end()) {
|
||||||
//This actaully never fails, so creating a dedicated returncode seems an overshoot.
|
//This actaully never fails, so creating a dedicated returncode seems an overshoot.
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename VALUE_T, typename INSERTION_T>
|
template<typename VALUE_T, typename INSERTION_T>
|
||||||
EventMatchTree::iterator EventMatchTree::findRangeMatcher(iterator start,
|
EventMatchTree::iterator EventMatchTree::findRangeMatcher(iterator start,
|
||||||
VALUE_T idFrom, VALUE_T idTo, bool inverted) {
|
VALUE_T idFrom, VALUE_T idTo, bool inverted) {
|
||||||
iterator iter = start;
|
iterator iter = start;
|
||||||
while (iter != end()) {
|
while (iter != end()) {
|
||||||
INSERTION_T* matcher = static_cast<INSERTION_T*>(*iter);
|
INSERTION_T* matcher = static_cast<INSERTION_T*>(*iter);
|
||||||
if ((matcher->rangeMatcher.lowerBound == idFrom)
|
if ((matcher->rangeMatcher.lowerBound == idFrom)
|
||||||
&& (matcher->rangeMatcher.upperBound == idTo)
|
&& (matcher->rangeMatcher.upperBound == idTo)
|
||||||
&& (matcher->rangeMatcher.inverted == inverted)) {
|
&& (matcher->rangeMatcher.inverted == inverted)) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
iter = iter.right(); //next OR element
|
iter = iter.right(); //next OR element
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return iter;
|
return iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t EventMatchTree::cleanUpElement(iterator position) {
|
ReturnValue_t EventMatchTree::cleanUpElement(iterator position) {
|
||||||
factory.destroy(position.element->value);
|
factory.destroy(position.element->value);
|
||||||
//If deletion fails, delete element anyway, nothing we can do.
|
//If deletion fails, delete element anyway, nothing we can do.
|
||||||
//SHOULDO: Throw event, or write debug output.
|
//SHOULDO: Throw event, or write debug output.
|
||||||
return factory.destroy(position.element);
|
return factory.destroy(position.element);
|
||||||
}
|
}
|
||||||
|
@ -1,36 +1,36 @@
|
|||||||
#ifndef FRAMEWORK_EVENTS_EVENTMATCHING_EVENTMATCHTREE_H_
|
#ifndef FRAMEWORK_EVENTS_EVENTMATCHING_EVENTMATCHTREE_H_
|
||||||
#define FRAMEWORK_EVENTS_EVENTMATCHING_EVENTMATCHTREE_H_
|
#define FRAMEWORK_EVENTS_EVENTMATCHING_EVENTMATCHTREE_H_
|
||||||
|
|
||||||
#include "../../container/PlacementFactory.h"
|
#include "../../container/PlacementFactory.h"
|
||||||
#include "../../events/EventMessage.h"
|
#include "../../events/EventMessage.h"
|
||||||
#include "../../globalfunctions/matching/MatchTree.h"
|
#include "../../globalfunctions/matching/MatchTree.h"
|
||||||
#include "../../returnvalues/HasReturnvaluesIF.h"
|
#include "../../returnvalues/HasReturnvaluesIF.h"
|
||||||
class StorageManagerIF;
|
class StorageManagerIF;
|
||||||
|
|
||||||
class EventMatchTree: public MatchTree<EventMessage*>, public HasReturnvaluesIF {
|
class EventMatchTree: public MatchTree<EventMessage*>, public HasReturnvaluesIF {
|
||||||
public:
|
public:
|
||||||
EventMatchTree(StorageManagerIF* storageBackend, bool invertedMatch);
|
EventMatchTree(StorageManagerIF* storageBackend, bool invertedMatch);
|
||||||
virtual ~EventMatchTree();
|
virtual ~EventMatchTree();
|
||||||
ReturnValue_t addMatch(EventId_t idFrom = 0, EventId_t idTo = 0, bool idInverted = false,
|
ReturnValue_t addMatch(EventId_t idFrom = 0, EventId_t idTo = 0, bool idInverted = false,
|
||||||
object_id_t reporterFrom = 0, object_id_t reporterTo = 0,
|
object_id_t reporterFrom = 0, object_id_t reporterTo = 0,
|
||||||
bool reporterInverted = false);
|
bool reporterInverted = false);
|
||||||
ReturnValue_t removeMatch(EventId_t idFrom = 0, EventId_t idTo = 0, bool idInverted = false,
|
ReturnValue_t removeMatch(EventId_t idFrom = 0, EventId_t idTo = 0, bool idInverted = false,
|
||||||
object_id_t reporterFrom = 0, object_id_t reporterTo = 0,
|
object_id_t reporterFrom = 0, object_id_t reporterTo = 0,
|
||||||
bool reporterInverted = false);
|
bool reporterInverted = false);
|
||||||
bool match(EventMessage* number);
|
bool match(EventMessage* number);
|
||||||
protected:
|
protected:
|
||||||
ReturnValue_t cleanUpElement(iterator position);
|
ReturnValue_t cleanUpElement(iterator position);
|
||||||
private:
|
private:
|
||||||
PlacementFactory factory;
|
PlacementFactory factory;
|
||||||
bool invertedMatch;
|
bool invertedMatch;
|
||||||
template<typename VALUE_T, typename INSERTION_T>
|
template<typename VALUE_T, typename INSERTION_T>
|
||||||
ReturnValue_t findOrInsertRangeMatcher(iterator start, VALUE_T idFrom,
|
ReturnValue_t findOrInsertRangeMatcher(iterator start, VALUE_T idFrom,
|
||||||
VALUE_T idTo, bool inverted, iterator* lastTest);
|
VALUE_T idTo, bool inverted, iterator* lastTest);
|
||||||
|
|
||||||
template<typename VALUE_T, typename INSERTION_T>
|
template<typename VALUE_T, typename INSERTION_T>
|
||||||
iterator findRangeMatcher(iterator start, VALUE_T idFrom, VALUE_T idTo,
|
iterator findRangeMatcher(iterator start, VALUE_T idFrom, VALUE_T idTo,
|
||||||
bool inverted);
|
bool inverted);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FRAMEWORK_EVENTS_EVENTMATCHING_EVENTMATCHTREE_H_ */
|
#endif /* FRAMEWORK_EVENTS_EVENTMATCHING_EVENTMATCHTREE_H_ */
|
||||||
|
@ -1,29 +1,29 @@
|
|||||||
#ifndef FRAMEWORK_EVENTS_EVENTMATCHING_EVENTRANGEMATCHERBASE_H_
|
#ifndef FRAMEWORK_EVENTS_EVENTMATCHING_EVENTRANGEMATCHERBASE_H_
|
||||||
#define FRAMEWORK_EVENTS_EVENTMATCHING_EVENTRANGEMATCHERBASE_H_
|
#define FRAMEWORK_EVENTS_EVENTMATCHING_EVENTRANGEMATCHERBASE_H_
|
||||||
|
|
||||||
#include "../../events/EventMessage.h"
|
#include "../../events/EventMessage.h"
|
||||||
#include "../../globalfunctions/matching/RangeMatcher.h"
|
#include "../../globalfunctions/matching/RangeMatcher.h"
|
||||||
#include "../../globalfunctions/matching/SerializeableMatcherIF.h"
|
#include "../../globalfunctions/matching/SerializeableMatcherIF.h"
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class EventRangeMatcherBase: public SerializeableMatcherIF<EventMessage*> {
|
class EventRangeMatcherBase: public SerializeableMatcherIF<EventMessage*> {
|
||||||
friend class EventMatchTree;
|
friend class EventMatchTree;
|
||||||
public:
|
public:
|
||||||
EventRangeMatcherBase(T from, T till, bool inverted) : rangeMatcher(from, till, inverted) { }
|
EventRangeMatcherBase(T from, T till, bool inverted) : rangeMatcher(from, till, inverted) { }
|
||||||
virtual ~EventRangeMatcherBase() { }
|
virtual ~EventRangeMatcherBase() { }
|
||||||
ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
||||||
size_t maxSize, Endianness streamEndianness) const {
|
size_t maxSize, Endianness streamEndianness) const {
|
||||||
return rangeMatcher.serialize(buffer, size, maxSize, streamEndianness);
|
return rangeMatcher.serialize(buffer, size, maxSize, streamEndianness);
|
||||||
}
|
}
|
||||||
size_t getSerializedSize() const {
|
size_t getSerializedSize() const {
|
||||||
return rangeMatcher.getSerializedSize();
|
return rangeMatcher.getSerializedSize();
|
||||||
}
|
}
|
||||||
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||||
Endianness streamEndianness) {
|
Endianness streamEndianness) {
|
||||||
return rangeMatcher.deSerialize(buffer, size, streamEndianness);
|
return rangeMatcher.deSerialize(buffer, size, streamEndianness);
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
RangeMatcher<T> rangeMatcher;
|
RangeMatcher<T> rangeMatcher;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FRAMEWORK_EVENTS_EVENTMATCHING_EVENTRANGEMATCHERBASE_H_ */
|
#endif /* FRAMEWORK_EVENTS_EVENTMATCHING_EVENTRANGEMATCHERBASE_H_ */
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#include "../../events/eventmatching/ReporterRangeMatcher.h"
|
#include "ReporterRangeMatcher.h"
|
||||||
|
|
||||||
ReporterRangeMatcher::ReporterRangeMatcher(object_id_t lower, object_id_t upper,
|
ReporterRangeMatcher::ReporterRangeMatcher(object_id_t lower, object_id_t upper,
|
||||||
bool inverted) : EventRangeMatcherBase<object_id_t>(lower, upper, inverted) {
|
bool inverted) : EventRangeMatcherBase<object_id_t>(lower, upper, inverted) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ReporterRangeMatcher::~ReporterRangeMatcher() {
|
ReporterRangeMatcher::~ReporterRangeMatcher() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ReporterRangeMatcher::match(EventMessage* message) {
|
bool ReporterRangeMatcher::match(EventMessage* message) {
|
||||||
return rangeMatcher.match(message->getReporter());
|
return rangeMatcher.match(message->getReporter());
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#ifndef FRAMEWORK_EVENTS_EVENTMATCHING_REPORTERRANGEMATCHER_H_
|
#ifndef FRAMEWORK_EVENTS_EVENTMATCHING_REPORTERRANGEMATCHER_H_
|
||||||
#define FRAMEWORK_EVENTS_EVENTMATCHING_REPORTERRANGEMATCHER_H_
|
#define FRAMEWORK_EVENTS_EVENTMATCHING_REPORTERRANGEMATCHER_H_
|
||||||
|
|
||||||
#include "../../events/eventmatching/EventRangeMatcherBase.h"
|
#include "EventRangeMatcherBase.h"
|
||||||
|
|
||||||
class ReporterRangeMatcher: public EventRangeMatcherBase<object_id_t> {
|
class ReporterRangeMatcher: public EventRangeMatcherBase<object_id_t> {
|
||||||
public:
|
public:
|
||||||
ReporterRangeMatcher(object_id_t lower, object_id_t upper, bool inverted);
|
ReporterRangeMatcher(object_id_t lower, object_id_t upper, bool inverted);
|
||||||
~ReporterRangeMatcher();
|
~ReporterRangeMatcher();
|
||||||
bool match(EventMessage* message);
|
bool match(EventMessage* message);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FRAMEWORK_EVENTS_EVENTMATCHING_REPORTERRANGEMATCHER_H_ */
|
#endif /* FRAMEWORK_EVENTS_EVENTMATCHING_REPORTERRANGEMATCHER_H_ */
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
#include "../../events/eventmatching/SeverityRangeMatcher.h"
|
#include "SeverityRangeMatcher.h"
|
||||||
#include "../../events/EventMessage.h"
|
#include "../../events/EventMessage.h"
|
||||||
#include "../../serialize/SerializeAdapter.h"
|
#include "../../serialize/SerializeAdapter.h"
|
||||||
|
|
||||||
SeverityRangeMatcher::SeverityRangeMatcher(EventSeverity_t from,
|
SeverityRangeMatcher::SeverityRangeMatcher(EventSeverity_t from,
|
||||||
EventSeverity_t till, bool inverted) : EventRangeMatcherBase<EventSeverity_t>(from, till, inverted) {
|
EventSeverity_t till, bool inverted) : EventRangeMatcherBase<EventSeverity_t>(from, till, inverted) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SeverityRangeMatcher::~SeverityRangeMatcher() {
|
SeverityRangeMatcher::~SeverityRangeMatcher() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SeverityRangeMatcher::match(EventMessage* message) {
|
bool SeverityRangeMatcher::match(EventMessage* message) {
|
||||||
return rangeMatcher.match(message->getSeverity());
|
return rangeMatcher.match(message->getSeverity());
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#ifndef FRAMEWORK_EVENTS_EVENTMATCHING_SEVERITYRANGEMATCHER_H_
|
#ifndef FRAMEWORK_EVENTS_EVENTMATCHING_SEVERITYRANGEMATCHER_H_
|
||||||
#define FRAMEWORK_EVENTS_EVENTMATCHING_SEVERITYRANGEMATCHER_H_
|
#define FRAMEWORK_EVENTS_EVENTMATCHING_SEVERITYRANGEMATCHER_H_
|
||||||
|
|
||||||
#include "../../events/eventmatching/EventRangeMatcherBase.h"
|
#include "EventRangeMatcherBase.h"
|
||||||
|
|
||||||
class SeverityRangeMatcher: public EventRangeMatcherBase<EventSeverity_t> {
|
class SeverityRangeMatcher: public EventRangeMatcherBase<EventSeverity_t> {
|
||||||
public:
|
public:
|
||||||
SeverityRangeMatcher(EventSeverity_t from, EventSeverity_t till, bool inverted);
|
SeverityRangeMatcher(EventSeverity_t from, EventSeverity_t till, bool inverted);
|
||||||
~SeverityRangeMatcher();
|
~SeverityRangeMatcher();
|
||||||
bool match(EventMessage* message);
|
bool match(EventMessage* message);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FRAMEWORK_EVENTS_EVENTMATCHING_SEVERITYRANGEMATCHER_H_ */
|
#endif /* FRAMEWORK_EVENTS_EVENTMATCHING_SEVERITYRANGEMATCHER_H_ */
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#ifndef EVENTMATCHING_H_
|
#ifndef EVENTMATCHING_H_
|
||||||
#define EVENTMATCHING_H_
|
#define EVENTMATCHING_H_
|
||||||
|
|
||||||
#include "../../events/eventmatching/EventIdRangeMatcher.h"
|
#include "EventIdRangeMatcher.h"
|
||||||
#include "../../events/eventmatching/EventMatchTree.h"
|
#include "EventMatchTree.h"
|
||||||
#include "../../events/eventmatching/ReporterRangeMatcher.h"
|
#include "ReporterRangeMatcher.h"
|
||||||
#include "../../events/eventmatching/SeverityRangeMatcher.h"
|
#include "SeverityRangeMatcher.h"
|
||||||
|
|
||||||
|
|
||||||
#endif /* EVENTMATCHING_H_ */
|
#endif /* EVENTMATCHING_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user