/// <summary> /// Sets the type tag. The old type tag is kept to some extent, /// depending on if the implicit flag is set to true or false. For /// implicit inheritance, the first tag in the old tag chain is /// replaced with the new tag. For explicit inheritance, the new /// tag is added first in the tag chain without removing any old /// tag. /// NOTE: This is an internal method that should /// only be called by the MIB loader. /// </summary> /// <param name="implicitly">the implicit inheritance flag</param> /// <param name="newtag">the new type tag</param> public virtual void SetTag(bool implicitly, MibTypeTag newtag) { MibTypeTag next = this.tag; if (implicitly && next != null) { next = next.Next; } if (newtag != null) { newtag.Next = next; } this.tag = newtag; }
/// <summary> /// Checks if this type has a specific type tag. This method will /// check the whole type tag chain. /// </summary> /// <param name="category">The tag category to search or</param> /// <param name="value">The tag value to search for</param> /// <returns>True if the specified type tag is present, false if not</returns> /// <see cref="HasTag(MibTypeTag)"/> public bool HasTag(int category, int value) { MibTypeTag iter = this.Tag; while (iter != null) { if (iter.Equals(category, value)) { return(true); } iter = iter.Next; } return(false); }
/// <summary> /// Checks if this type tag equals another object. This method /// will only return true if the other object is a type tag with /// the same category and value numbers. /// </summary> /// <param name="obj">The object to compare to</param> /// <returns>True if the objects are equal, false if not</returns> public override bool Equals(object obj) { // If parameter is null return false. if (obj == null) { return(false); } MibTypeTag tag = obj as MibTypeTag; if (tag == null) { return(false); } return(this.Equals(tag)); }
/// <summary> /// Checks if this type has a specific type tag. This method will /// check the whole type tag chain. /// </summary> /// <param name="tag">The type tag to search for</param> /// <returns>True if the specified type tag is present, false if not</returns> /// <see cref="HasTag(int, int)"/> public bool HasTag(MibTypeTag tag) { return(this.HasTag(tag.Category, tag.Value)); }
/// <summary> /// Checks if this type tag equals another object. This method /// will only return true if the other object is a type tag with /// the same category and value numbers. /// </summary> /// <param name="m">The MibTypeTag to compare to</param> /// <returns>True if the tags are equal, false if not</returns> public bool Equals(MibTypeTag m) { return(this.category == m.category && this.value == m.value); }