mirror of
https://github.com/zeek/zeek.git
synced 2025-10-11 11:08:20 +00:00
Unify all of the Tag types into one type
- Remove tag types for each component type (analyzer, etc) - Add deprecated versions of the old types - Remove unnecessary tag element from templates for TaggedComponent and ComponentManager - Enable TaggedComponent to pass an EnumType when initializing Tag objects - Update some tests that are affected by the tag enum values changing order
This commit is contained in:
parent
4f9f46a0c4
commit
331161138a
46 changed files with 352 additions and 955 deletions
13
src/Tag.cc
13
src/Tag.cc
|
@ -7,12 +7,15 @@
|
|||
namespace zeek
|
||||
{
|
||||
|
||||
const Tag Tag::Error;
|
||||
|
||||
Tag::Tag(type_t arg_type, subtype_t arg_subtype) : Tag(nullptr, arg_type, arg_subtype) { }
|
||||
|
||||
Tag::Tag(const EnumTypePtr& etype, type_t arg_type, subtype_t arg_subtype)
|
||||
: type(arg_type), subtype(arg_subtype), etype(etype)
|
||||
{
|
||||
assert(arg_type > 0);
|
||||
|
||||
type = arg_type;
|
||||
subtype = arg_subtype;
|
||||
int64_t i = (int64_t)(type) | ((int64_t)subtype << 31);
|
||||
val = etype->GetEnumVal(i);
|
||||
}
|
||||
|
@ -68,11 +71,13 @@ Tag& Tag::operator=(const Tag&& other) noexcept
|
|||
return *this;
|
||||
}
|
||||
|
||||
const EnumValPtr& Tag::AsVal(const EnumTypePtr& etype) const
|
||||
const EnumValPtr& Tag::AsVal() const
|
||||
{
|
||||
// TODO: this probably isn't valid, and we should just return the null val
|
||||
// if it's null.
|
||||
if ( ! val )
|
||||
{
|
||||
assert(type == 0 && subtype == 0);
|
||||
assert(type == 0 && subtype == 0 && etype != nullptr);
|
||||
val = etype->GetEnumVal(0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue