mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 09:08:20 +00:00
provide ZAM-generated code with low-level access to record fields
This commit is contained in:
parent
099dc99d2b
commit
5f4956bf24
1 changed files with 19 additions and 0 deletions
19
src/Val.h
19
src/Val.h
|
@ -45,6 +45,8 @@ class PrefixTable;
|
|||
class CompositeHash;
|
||||
class HashKey;
|
||||
|
||||
class ZBody;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
namespace run_state {
|
||||
|
@ -1398,6 +1400,23 @@ public:
|
|||
static void DoneParsing();
|
||||
|
||||
protected:
|
||||
friend class zeek::detail::ZBody;
|
||||
|
||||
// For use by low-level ZAM instructions. Caller assumes
|
||||
// responsibility for memory management. The first version
|
||||
// allows manipulation of whether the field is present at all.
|
||||
// The second version ensures that the optional value is present.
|
||||
std::optional<ZVal>& RawOptField(int field)
|
||||
{ return (*record_val)[field]; }
|
||||
|
||||
ZVal& RawField(int field)
|
||||
{
|
||||
auto& f = RawOptField(field);
|
||||
if ( ! f )
|
||||
f = ZVal();
|
||||
return *f;
|
||||
}
|
||||
|
||||
ValPtr DoClone(CloneState* state) override;
|
||||
|
||||
void AddedField(int field)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue