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