Ejemplo n.º 1
0
        public AttributeBytes(IBytes bytes, AttributeDescriptor descriptor)
        {
            Bytes      = bytes;
            Descriptor = descriptor;

            // Should never happen, but just in case
            if (Bytes.ByteCount % Descriptor.ItemSize != 0)
            {
                throw new Exception("Number of items does not divide by item size properly");
            }

            Count = Bytes.ByteCount / Descriptor.ItemSize;
        }
Ejemplo n.º 2
0
 public static IAttribute ToAttribute <T>(this IArray <T> xs, AttributeDescriptor desc) where T : struct
 => new AttributeArray <T>(xs, desc);
Ejemplo n.º 3
0
 public AttributeArray(IArray <T> data, AttributeDescriptor desc)
 {
     Data       = data;
     Descriptor = desc;
 }
Ejemplo n.º 4
0
 public static IEnumerable <IAttribute> AttributesExcept(this IG3D g3d, AttributeDescriptor desc)
 => g3d.Attributes.Where(attr => !attr.Descriptor.Equals(desc));
Ejemplo n.º 5
0
 public static bool IsSameAttribute(this AttributeDescriptor desc, AttributeDescriptor other)
 => desc.AttributeType == other.AttributeType && desc.Association == other.Association && desc.AttributeTypeIndex == other.AttributeTypeIndex;
Ejemplo n.º 6
0
 public static IAttribute ToAttribute <T>(this T[] data, AttributeDescriptor desc) where T : struct
 => data.Pin().ToAttribute(desc);
Ejemplo n.º 7
0
 public static IAttribute ToAttribute(this IBytes bytes, AttributeDescriptor desc)
 => new AttributeBytes(bytes, desc);
Ejemplo n.º 8
0
 public static string AttributeTypeString(this AttributeType at)
 => AttributeDescriptor.AttributeTypeToString((int)at);