Merge remote-tracking branch 'origin/topic/vern/cpp-new-func'

- Removed a couple of dead statements during merge

* origin/topic/vern/cpp-new-func:
  option for deterministic descriptions of sets & tables
  determinism for concurrent Zeek test suite invocations; split out deprecations
  disambiguate descriptions of enums; include attributes when describing records
  more liberal view of attribute equality; allow suppressing attr type-checking
  support for operations on sets that return new values
  low-level addition of enum values
  sundry accessors/cast-ers; RE_Matcher's track their construction values
  convenience functions for comparing IP addresses
This commit is contained in:
Jon Siwek 2021-03-23 19:05:10 -07:00
commit f46d3dec8f
38 changed files with 371 additions and 102 deletions

View file

@ -61,6 +61,8 @@ class PortVal;
class AddrVal;
class SubNetVal;
class IntervalVal;
class FuncVal;
class FileVal;
class PatternVal;
class TableVal;
class RecordVal;
@ -143,6 +145,12 @@ UNDERLYING_ACCESSOR_DECL(PatternVal, const RE_Matcher*, AsPattern)
UNDERLYING_ACCESSOR_DECL(TableVal, const PDict<TableEntryVal>*, AsTable)
UNDERLYING_ACCESSOR_DECL(TypeVal, zeek::Type*, AsType)
FuncVal* AsFuncVal();
const FuncVal* AsFuncVal() const;
FileVal* AsFileVal();
const FileVal* AsFileVal() const;
PatternVal* AsPatternVal();
const PatternVal* AsPatternVal() const;
@ -760,6 +768,32 @@ public:
*/
TableValPtr Intersection(const TableVal& v) const;
/**
* Returns a new table that is the union of this table and the
* given table. Union is done only on index, so this generally
* makes most sense to use for sets, not tables.
* @param v The union'ing table.
* @return The union of this table and the given one.
*/
TableValPtr Union(TableVal* v) const
{
auto v_clone = cast_intrusive<TableVal>(v->Clone());
AddTo(v_clone.get(), false, false);
return v_clone;
}
/**
* Returns a copy of this table with the given table removed.
* @param v The table to remove.
* @return The subset of this table that doesn't include v.
*/
TableValPtr TakeOut(TableVal* v)
{
auto clone = cast_intrusive<TableVal>(Clone());
v->RemoveFrom(clone.get());
return clone;
}
// Returns true if this set contains the same members as the
// given set. Note that comparisons are done using hash keys,
// so errors can arise for compound sets such as sets-of-sets.