Move all Val classes to the zeek namespaces

This commit is contained in:
Tim Wojtulewicz 2020-06-24 16:55:28 -04:00
parent ec9eff0bd5
commit 64332ca22c
265 changed files with 3154 additions and 3086 deletions

View file

@ -7,10 +7,12 @@
#include "Type.h"
#include "IntrusivePtr.h"
class ListVal;
ZEEK_FORWARD_DECLARE_NAMESPACED(ListVal, zeek);
class HashKey;
namespace zeek {
using ListValPtr = zeek::IntrusivePtr<ListVal>;
}
class CompositeHash {
public:
@ -19,27 +21,27 @@ public:
// Compute the hash corresponding to the given index val,
// or nullptr if it fails to typecheck.
std::unique_ptr<HashKey> MakeHashKey(const Val& v, bool type_check) const;
std::unique_ptr<HashKey> MakeHashKey(const zeek::Val& v, bool type_check) const;
[[deprecated("Remove in v4.1. Use MakeHashKey().")]]
HashKey* ComputeHash(const Val* v, bool type_check) const
HashKey* ComputeHash(const zeek::Val* v, bool type_check) const
{ return MakeHashKey(*v, type_check).release(); }
// Given a hash key, recover the values used to create it.
ListValPtr RecoverVals(const HashKey& k) const;
zeek::ListValPtr RecoverVals(const HashKey& k) const;
[[deprecated("Remove in v4.1. Pass in HashKey& instead.")]]
ListValPtr RecoverVals(const HashKey* k) const
zeek::ListValPtr RecoverVals(const HashKey* k) const
{ return RecoverVals(*k); }
unsigned int MemoryAllocation() const { return padded_sizeof(*this) + pad_size(size); }
protected:
std::unique_ptr<HashKey> ComputeSingletonHash(const Val* v, bool type_check) const;
std::unique_ptr<HashKey> ComputeSingletonHash(const zeek::Val* v, bool type_check) const;
// Computes the piece of the hash for Val*, returning the new kp.
// Used as a helper for ComputeHash in the non-singleton case.
char* SingleValHash(bool type_check, char* kp, zeek::Type* bt, Val* v,
char* SingleValHash(bool type_check, char* kp, zeek::Type* bt, zeek::Val* v,
bool optional) const;
// Recovers just one Val of possibly many; called from RecoverVals.
@ -48,7 +50,7 @@ protected:
// upon errors, so there is no return value for invalid input.
const char* RecoverOneVal(
const HashKey& k, const char* kp, const char* const k_end,
zeek::Type* t, ValPtr* pval, bool optional) const;
zeek::Type* t, zeek::ValPtr* pval, bool optional) const;
// Rounds the given pointer up to the nearest multiple of the
// given size, if not already a multiple.
@ -84,12 +86,12 @@ protected:
// the value is computed for the particular list of values.
// Returns 0 if the key has an indeterminant size (if v not given),
// or if v doesn't match the index type (if given).
int ComputeKeySize(const Val* v, bool type_check,
bool calc_static_size) const;
int ComputeKeySize(const zeek::Val* v, bool type_check,
bool calc_static_size) const;
int SingleTypeKeySize(zeek::Type*, const Val*,
bool type_check, int sz, bool optional,
bool calc_static_size) const;
int SingleTypeKeySize(zeek::Type*, const zeek::Val*,
bool type_check, int sz, bool optional,
bool calc_static_size) const;
zeek::TypeListPtr type;
char* key; // space for composite key