Move IntrusivePtr and utility methods to the zeek namespace

This commit is contained in:
Tim Wojtulewicz 2020-06-24 16:40:00 -04:00
parent 4668378d91
commit 9364e6a5b7
255 changed files with 3761 additions and 3730 deletions

View file

@ -18,11 +18,11 @@ static void topk_element_hash_delete_func(void* val)
delete e;
}
void TopkVal::Typify(IntrusivePtr<zeek::Type> t)
void TopkVal::Typify(zeek::IntrusivePtr<zeek::Type> t)
{
assert(!hash && !type);
type = std::move(t);
auto tl = make_intrusive<zeek::TypeList>(type);
auto tl = zeek::make_intrusive<zeek::TypeList>(type);
tl->Append(type);
hash = new CompositeHash(std::move(tl));
}
@ -176,14 +176,14 @@ void TopkVal::Merge(const TopkVal* value, bool doPrune)
}
}
IntrusivePtr<Val> TopkVal::DoClone(CloneState* state)
zeek::IntrusivePtr<Val> TopkVal::DoClone(CloneState* state)
{
auto clone = make_intrusive<TopkVal>(size);
auto clone = zeek::make_intrusive<TopkVal>(size);
clone->Merge(this);
return state->NewClone(this, std::move(clone));
}
IntrusivePtr<VectorVal> TopkVal::GetTopK(int k) const // returns vector
zeek::IntrusivePtr<VectorVal> TopkVal::GetTopK(int k) const // returns vector
{
if ( numElements == 0 )
{
@ -191,8 +191,8 @@ IntrusivePtr<VectorVal> TopkVal::GetTopK(int k) const // returns vector
return nullptr;
}
auto v = make_intrusive<zeek::VectorType>(type);
auto t = make_intrusive<VectorVal>(std::move(v));
auto v = zeek::make_intrusive<zeek::VectorType>(type);
auto t = zeek::make_intrusive<VectorVal>(std::move(v));
// this does no estimation if the results is correct!
// in any case - just to make this future-proof (and I am lazy) - this can return more than k.
@ -269,7 +269,7 @@ uint64_t TopkVal::GetSum() const
return sum;
}
void TopkVal::Encountered(IntrusivePtr<Val> encountered)
void TopkVal::Encountered(zeek::IntrusivePtr<Val> encountered)
{
// ok, let's see if we already know this one.