Esempio n. 1
0
        /// <summary>
        /// Stores an annotation in the given element.
        /// If an annotation of the same class existed before the call to this function it is replaced
        /// by the new instance.
        /// </summary>
        /// <param name="element">the element</param>
        /// <param name="value">the instance</param>
        public static void putAnnotation(VhdlElement element, object @value)
        {
            if (element.AnnotationList == null)
            {
                element.AnnotationList = new Dictionary <object, List <object> >();
            }

            if (element.AnnotationList.ContainsKey(element) == false)
            {
                element.AnnotationList.Add(element, new List <object>()
                {
                    @value
                });
            }
            else
            {
                element.AnnotationList[element].Add(@value);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Returns an annotation instance of the given class.
 /// If no instance of the class is available in the element the function returns null
 /// </summary>
 /// <typeparam name="T">the class of the instance</typeparam>
 /// <param name="element">the element</param>
 /// <returns>the instance, or null</returns>
 public static T getAnnotation <T>(VhdlElement element) where T : class
 {
     if (element.AnnotationList == null)
     {
         return(null);
     }
     else
     {
         Dictionary <object, List <object> > annotationList = element.AnnotationList;
         if (annotationList.ContainsKey(element))
         {
             List <object> objects = annotationList[element];
             foreach (object o in objects)
             {
                 if (o is T)
                 {
                     return(o as T);
                 }
             }
         }
     }
     return(null);
 }
Esempio n. 3
0
 /// <summary>
 /// Creates a scope.
 /// </summary>
 /// <param name="parent">the associated VhdlElement</param>
 /// <param name="list">a list of resolvables</param>
 /// <returns>the created scope</returns>
 public static IScope createScope(VhdlElement parent, params IResolvable[] list)
 {
     return(new ResolvableListsScope(parent, list));
 }
Esempio n. 4
0
 public AbstractScope(VhdlElement parent)
 {
     this.parent = parent;
 }
Esempio n. 5
0
 public ResolvableListsScope(VhdlElement parent, params IResolvable[] lists)
     : base(parent)
 {
     this.lists = new IResolvable[lists.Length];
     lists.CopyTo(this.lists, 0);
 }