mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 01:28:20 +00:00
Val: use class IntrusivePtr in class TableEntryVal
This commit is contained in:
parent
7924e948b9
commit
93c2064b9a
2 changed files with 17 additions and 28 deletions
16
src/Val.h
16
src/Val.h
|
@ -2,6 +2,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "IntrusivePtr.h"
|
||||
#include "Type.h"
|
||||
#include "Timer.h"
|
||||
#include "Notifier.h"
|
||||
|
@ -27,9 +28,7 @@ using std::string;
|
|||
#define UDP_PORT_MASK 0x20000
|
||||
#define ICMP_PORT_MASK 0x30000
|
||||
|
||||
template <class T> class IntrusivePtr;
|
||||
template<typename T> class PDict;
|
||||
template <class T> class IntrusivePtr;
|
||||
class IterCookie;
|
||||
|
||||
class Val;
|
||||
|
@ -644,9 +643,10 @@ extern double bro_start_network_time;
|
|||
|
||||
class TableEntryVal {
|
||||
public:
|
||||
explicit TableEntryVal(Val* v)
|
||||
template<typename V>
|
||||
explicit TableEntryVal(V&& v)
|
||||
: val(std::forward<V>(v))
|
||||
{
|
||||
val = v;
|
||||
last_access_time = network_time;
|
||||
expire_access_time =
|
||||
int(network_time - bro_start_network_time);
|
||||
|
@ -654,11 +654,7 @@ public:
|
|||
|
||||
TableEntryVal* Clone(Val::CloneState* state);
|
||||
|
||||
~TableEntryVal() { }
|
||||
|
||||
Val* Value() { return val; }
|
||||
void Ref() { val->Ref(); }
|
||||
void Unref() { ::Unref(val); }
|
||||
Val* Value() { return val.get(); }
|
||||
|
||||
// Returns/sets time of last expiration relevant access to this value.
|
||||
double ExpireAccessTime() const
|
||||
|
@ -669,7 +665,7 @@ public:
|
|||
protected:
|
||||
friend class TableVal;
|
||||
|
||||
Val* val;
|
||||
IntrusivePtr<Val> val;
|
||||
double last_access_time;
|
||||
|
||||
// The next entry stores seconds since Bro's start. We use ints here
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue