2 * Copyright (C) 2011, Jamie Thompson
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License as published by the Free Software Foundation; either
7 * version 3 of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public
15 * License along with this program; If not, see
16 * <http://www.gnu.org/licenses/>.
19 #include "RtcomEvent.h"
26 #include <rtcom-eventlogger/event.h>
27 #include <rtcom-eventlogger/eventlogger.h>
31 using namespace EventTypes;
33 RtcomEvent::RtcomEvent()
37 void RtcomEvent::freeRTComContents(RTComElEvent &event)
39 rtcom_el_event_free_contents(&event);
42 const unsigned int RtcomEvent::GetFlagValue(const QString &value) const
44 static QHash<QString, uint> valueLookups;
46 if(!valueLookups.contains(value))
48 RTComEl *el(rtcom_el_new());
52 if(-1 != (flagValue = rtcom_el_get_flag_value(el, value.toUtf8())))
53 valueLookups.insert(value, flagValue);
59 throw std::runtime_error(
60 QString("Unable to find flag value '%1'' in rtcom database")
61 .arg(value).toStdString());
65 qDebug() << "Failed to create event logger.";
68 return valueLookups.value(value);