This is a supplemental class used only as a return value of Name::compare(). More...
Public Types | |
enum | NameRelation { SUPERDOMAIN = 0, SUBDOMAIN = 1, EQUAL = 2, COMMONANCESTOR = 3 } |
The relation of two names under comparison. More... | |
Public Member Functions | |
Constructors and Destructor | |
NameComparisonResult (int order, unsigned int nlabels, NameRelation relation) | |
Constructor from a comparison tuple. | |
Getter Methods | |
int | getOrder () const |
Returns the ordering of the comparison result. | |
unsigned int | getCommonLabels () const |
Returns the number of common labels of the comparison result. | |
NameRelation | getRelation () const |
Returns the NameRelation of the comparison result. |
This is a supplemental class used only as a return value of Name::compare().
It encapsulate a tuple of the comparison: ordering, number of common labels, and relationship as follows:
The relation of two names under comparison.
Its semantics for the case of name1->compare(name2)
(where name1 and name2 are instances of the Name class) is as follows:
Note that in our implementation there's always a hierarchical relationship between any two names since all names are absolute and they at least share the trailing empty label. So, for example, the relationship between "com." and "net." is "commonancestor", even though it may be counter intuitive.
isc::dns::NameComparisonResult::NameComparisonResult | ( | int | order, | |
unsigned int | nlabels, | |||
NameRelation | relation | |||
) | [explicit] |
Constructor from a comparison tuple.
This constructor simply initializes the object in the straightforward way.
unsigned int isc::dns::NameComparisonResult::getCommonLabels | ( | ) | const |
Returns the number of common labels of the comparison result.
int isc::dns::NameComparisonResult::getOrder | ( | ) | const |
Returns the ordering of the comparison result.
NameRelation isc::dns::NameComparisonResult::getRelation | ( | ) | const |
Returns the NameRelation of the comparison result.