report_manager: more use of unordered_map

This commit is contained in:
Justin Viiret
2017-04-24 14:58:20 +10:00
committed by Matthew Barr
parent 1878b9a857
commit 9258592d0b
3 changed files with 26 additions and 8 deletions

View File

@@ -1,5 +1,5 @@
/*
* 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:
@@ -34,9 +34,10 @@
#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>
@@ -195,6 +196,23 @@ bool operator<(const Report &a, const Report &b) {
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);