Implement equivalence relation for opaque types.

This commit is contained in:
Matthias Vallentin 2012-12-05 18:52:52 -10:00
parent fa9aeeaaf1
commit 2494940d95
2 changed files with 6 additions and 3 deletions

View file

@ -1754,8 +1754,11 @@ int same_type(const BroType* t1, const BroType* t2, int is_init)
return same_type(t1->YieldType(), t2->YieldType(), is_init);
case TYPE_OPAQUE:
// FIXME: Should we downcast here and compare the opaque type names?
return 1;
{
const OpaqueType* ot1 = (const OpaqueType*) t1;
const OpaqueType* ot2 = (const OpaqueType*) t2;
return ot1->Name() == ot2->Name() ? 1 : 0;
}
case TYPE_TYPE:
return same_type(t1, t2, is_init);

View file

@ -505,7 +505,7 @@ public:
OpaqueType(const string& name);
virtual ~OpaqueType() { };
const string& Name() { return name; }
const string& Name() const { return name; }
void Describe(ODesc* d) const;