Exemplo n.º 1
0
 public void Remap(T name, uint address, uint length)
 {
     if (!map.ContainsKey(name))
     {
         throw new ArgumentException("A mapped range with that name does not exist.");
     }
     map[name] = new SmartPointer(address, length);
 }
Exemplo n.º 2
0
 public void Map(T name, SmartPointer ptr)
 {
     if (map.ContainsKey(name))
     {
         throw new ArgumentException("A mapped range with that name already exists.");
     }
     map.Add(name, ptr);
 }
Exemplo n.º 3
0
 public void Remap(T name, SmartPointer ptr)
 {
     if (!map.ContainsKey(name))
     {
         throw new ArgumentException("A mapped range with that name does not exist.");
     }
     map[name] = ptr;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Determines if the provided pointer collides with this pointer.
 /// </summary>
 /// <param name="ptr">Another pointer</param>
 /// <returns>Returns true if there is overlap. Otherwise, returns false.</returns>
 public bool Overlaps(SmartPointer ptr)
 {
     if ((ptr.Address >= Address) & (ptr.Address < Address + Length))
     {
         return(true);
     }
     if ((ptr.Address + ptr.Length >= Address) & (ptr.Address + ptr.Length <= Address + Length))
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 5
0
        public T[] FindEncompassingRanges(SmartPointer ptr)
        {
            List <T> ranges = new List <T>();

            T[] keys = map.Keys.ToArray();

            for (int i = 0; i < keys.Length; i++)
            {
                T            t = keys[i];
                SmartPointer p = map[t];

                if (ptr.Overlaps(p))
                {
                    ranges.Add(t);
                }
            }

            return(ranges.ToArray());
        }