/// <summary>Initializes the MIB symbol. This will remove all levels of
 /// indirection present, such as references to types or values. No
 /// information is lost by this operation. This method may modify
 /// this object as a side-effect.
 /// NOTE: This is an internal method that should
 /// only be called by the MIB loader.
 /// </summary>
 /// <param name="log">The MIB Loader Log</param>
 public override void Initialize(MibLoaderLog log)
 {
     if (this.type != null)
     {
         try
         {
             this.type = this.type.Initialize(this, log);
         }
         catch (MibException e)
         {
             log.AddError(e.Location, e.Message);
             this.type = null;
         }
     }
 }
示例#2
0
        /// <summary>
        /// Initializes the MIB symbol. This will remove all levels of
        /// indirection present, such as references to types or values. No
        /// information is lost by this operation. This method may modify
        /// this object as a side-effect.
        /// </summary>
        /// NOTE: This is an internal method that should
        /// only be called by the MIB loader.
        /// <param name="log">The MIB loader log</param>
        /// <exception cref="MibException">
        /// If an error was encountered during the initialization
        /// </exception>
        public override void Initialize(MibLoaderLog log)
        {
            ObjectIdentifierValue oid;

            if (this.type != null)
            {
                try
                {
                    this.type = this.type.Initialize(this, log);
                }
                catch (MibException e)
                {
                    log.AddError(e.Location, e.Message);
                    this.type = null;
                }
            }

            if (this.value != null)
            {
                try
                {
                    this.value = this.value.Initialize(log, this.type);
                }
                catch (MibException e)
                {
                    log.AddError(e.Location, e.Message);
                    this.value = null;
                }
            }

            if (this.type != null && this.value != null && !this.type.IsCompatible(this.value))
            {
                log.AddError(this.Location, "value is not compatible with type");
            }

            if (this.value is ObjectIdentifierValue)
            {
                oid = (ObjectIdentifierValue)this.value;
                if (oid.Symbol == null)
                {
                    oid.Symbol = this;
                }
            }
        }
示例#3
0
 /// <summary>
 /// Initializes the MIB value. This will remove all levels of
 /// indirection present, such as references to other values. No
 /// value information is lost by this operation. This method may
 /// modify this object as a side-effect, and will return the basic
 /// value.
 /// NOTE: This is an internal method that should
 /// only be called by the MIB loader.
 /// </summary>
 /// <param name="log">The MIB loader log</param>
 /// <param name="type">The value type</param>
 /// <returns>The basic MIB value</returns>
 /// <exception cref="MibException">
 /// If an error was encountered during the initialization
 /// </exception>
 public abstract MibValue Initialize(MibLoaderLog log, MibType type);
 /// <summary>
 /// Initializes a new instance of the <see cref="MibValueSymbol"/> class.
 /// NOTE: This is an internal constructor that
 /// should only be called by the MIB loader.
 /// </summary>
 /// <param name="location">The symbol location</param>
 /// <param name="mib">The symbol MIB name</param>
 /// <param name="name">The symbol name</param>
 /// <param name="type">The symbol type</param>
 /// <param name="value">The symbol value</param>
 public MibValueSymbol(FileLocation location, Mib mib, string name, MibType type, MibValue value) :
     base(location, mib, name)
 {
     this.Type  = type;
     this.Value = value;
 }
 /// <summary>
 /// Clears and prepares this MIB symbol for garbage collection.
 /// This method will recursively clear any associated types or
 /// values, making sure that no data structures references this
 /// symbol.
 /// </summary>
 public override void Clear()
 {
     this.type = null;
 }