added some class accessors/set-ers

This commit is contained in:
Vern Paxson 2023-06-16 15:09:30 -07:00 committed by Arne Welzel
parent 8389fc85d7
commit 1505fd4aa1
4 changed files with 23 additions and 2 deletions

View file

@ -53,6 +53,13 @@ public:
*/
Frame(int size, const ScriptFunc* func, const zeek::Args* fn_args);
/**
* Returns the size of the frame.
*
* @return the number of elements in the frame.
*/
int FrameSize() const { return size; }
/**
* @param n the index to get.
* @return the value at index *n* of the underlying array.

View file

@ -344,14 +344,19 @@ public:
const IDPtr& GetID() const { return id; }
const StmtPtr& Body() const { return body; }
void SetBody(StmtPtr _body) { body = std::move(_body); }
const auto& Inits() const { return inits; }
void ClearInits() { inits.clear(); }
size_t FrameSize() const { return frame_size; }
int Priority() const { return priority; }
const ScopePtr& Scope() const { return scope; }
const auto& Groups() const { return groups; }
// Used by script optimization to update lambda ingredients
// after compilation.
void SetFrameSize(size_t _frame_size) { frame_size = std::move(_frame_size); }
private:
IDPtr id;
StmtPtr body;

View file

@ -2787,6 +2787,11 @@ void TableVal::InitDefaultFunc(detail::Frame* f)
def_val = def_attr->GetExpr()->Eval(f);
}
void TableVal::InitDefaultVal(ValPtr _def_val)
{
def_val = std::move(_def_val);
}
void TableVal::InitTimer(double delay)
{
timer = new TableValTimer(this, run_state::network_time + delay);

View file

@ -968,9 +968,13 @@ public:
// If the &default attribute is not a function, or the function has
// already been initialized, this does nothing. Otherwise, evaluates
// the function in the frame allowing it to capture its closure.
// the function in the frame, allowing it to capture its closure.
void InitDefaultFunc(detail::Frame* f);
// An alternative that assigns the default value directly. Used
// by ZAM compilation.
void InitDefaultVal(ValPtr def_val);
void ClearTimer(detail::Timer* t)
{
if ( timer == t )