/*
- * Copyright (c) 2015-2016, Intel Corporation
+ * Copyright (c) 2015-2017, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
#ifndef UTIL_REPORT_H
#define UTIL_REPORT_H
-#include "util/exhaust.h" // for INVALID_EKEY
-#include "order_check.h"
#include "ue2common.h"
+#include "util/exhaust.h" // for INVALID_EKEY
+#include "util/hash.h"
+#include "util/order_check.h"
#include <cassert>
return false;
}
+inline
+bool operator==(const Report &a, const Report &b) {
+ return a.type == b.type && a.quashSom == b.quashSom &&
+ a.minOffset == b.minOffset && a.maxOffset == b.maxOffset &&
+ a.minLength == b.minLength && a.ekey == b.ekey &&
+ a.offsetAdjust == b.offsetAdjust && a.onmatch == b.onmatch &&
+ a.revNfaIndex == b.revNfaIndex && a.somDistance == b.somDistance &&
+ a.topSquashDistance == b.topSquashDistance;
+}
+
+inline
+size_t hash_value(const Report &r) {
+ return hash_all(r.type, r.quashSom, r.minOffset, r.maxOffset, r.minLength,
+ r.ekey, r.offsetAdjust, r.onmatch, r.revNfaIndex,
+ r.somDistance, r.topSquashDistance);
+}
+
static inline
Report makeECallback(u32 report, s32 offsetAdjust, u32 ekey) {
Report ir(EXTERNAL_CALLBACK, report);
std::vector<Report> reportIds;
/** \brief Mapping from Report to ID (inverse of \ref reportIds
- * vector). */
- std::map<Report, size_t> reportIdToInternalMap;
+ * vector). */
+ unordered_map<Report, size_t> reportIdToInternalMap;
/** \brief Mapping from ReportID to dedupe key. */
- std::map<ReportID, u32> reportIdToDedupeKey;
+ unordered_map<ReportID, u32> reportIdToDedupeKey;
/** \brief Mapping from ReportID to Rose program offset in bytecode. */
- std::map<ReportID, u32> reportIdToProgramOffset;
+ unordered_map<ReportID, u32> reportIdToProgramOffset;
/** \brief Mapping from external match ids to information about that
* id. */