/// <summary>
 /// File address of an element as a 32 bits unsigned integer
 /// </summary>
 public static FileAddress32Element FileAddress32(this ElementCollection collection, Element target)
 {
     return(Add(collection, new FileAddress32Element(target)));
 }
 /// <summary>
 /// File size of an element as a 16 bits unsigned integer
 /// </summary>
 public static FileSize16Element FileSize16(this ElementCollection collection, Element target)
 {
     return(Add(collection, new FileSize16Element(target)));
 }
 /// <summary>
 /// Align the next element on a boundary
 /// </summary>
 /// <param name="alignment">Desired alignement</param>
 /// <param name="padding">Value used to fill the void</param>
 public static AlignmentElement Alignment(this ElementCollection collection, uint alignment, byte padding)
 {
     return(Add(collection, new AlignmentElement(alignment, alignment, padding)));
 }
 /// <summary>
 /// Align the next element on a boundary
 /// </summary>
 /// <param name="fileAlignment">Desired file alignment</param>
 /// <param name="memoryAlignment">Desired memory alignement</param>
 /// <param name="padding">Value used to fill the void</param>
 public static AlignmentElement Alignment(this ElementCollection collection, uint fileAlignment,
                                          uint memoryAlignment, byte padding)
 {
     return(Add(collection, new AlignmentElement(fileAlignment, memoryAlignment, padding)));
 }
        // ********************************************************************
        // * Misc

        /// <summary>
        /// Create a nested collection on elements
        /// </summary>
        public static ElementCollection ElementCollection(this ElementCollection collection)
        {
            return(Add(collection, new ElementCollection()));
        }
 /// <summary>
 /// Put a mark in the collection of elements
 /// </summary>
 public static MarkerElement Marker(this ElementCollection collection)
 {
     return(Add(collection, new MarkerElement()));
 }
        // ********************************************************************
        // * Byte array

        /// <summary>
        /// Bulk data as an array of bytes
        /// </summary>
        public static ByteArrayElement ByteArray(this ElementCollection collection, byte[] value)
        {
            return(Add(collection, new ByteArrayElement(value)));
        }
 private static T Add <T>(ElementCollection collection, T value) where T : Element
 {
     collection.Elements.Add(value);
     return(value);
 }
        // ********************************************************************
        // * Character strings

        /// <summary>
        /// A string of ASCII characters with a fixed size. If value is longer than length, value is chopped. If it is
        /// shorter, value is padded with null characters
        /// </summary>
        public static FixedSizeStringElement FixedSizeString(this ElementCollection collection, string value,
                                                             uint length)
        {
            return(Add(collection, new FixedSizeStringElement(value, length)));
        }
 /// <summary>
 /// A null terminated string of ASCII characters
 /// </summary>
 public static VariableSizeStringElement VariableSizeString(this ElementCollection collection, string value)
 {
     return(Add(collection, new VariableSizeStringElement(value)));
 }
 /// <summary>
 /// Immediate 32 bits or 64 bits unsigned integer depending on assembling context
 /// </summary>
 public static UIntPElement UIntP(this ElementCollection collection, UInt64 value)
 {
     return(Add(collection, new UIntPElement(value)));
 }
        // ********************************************************************
        // * UInt

        /// <summary>
        /// Immediate 8 bits unsigned integer
        /// </summary>
        public static UInt8Element UInt8(this ElementCollection collection, byte value)
        {
            return(Add(collection, new UInt8Element(value)));
        }
 /// <summary>
 /// Size in memory of an element as a 32 bits unsigned integer
 /// </summary>
 public static MemorySize32Element MemorySize32(this ElementCollection collection, Element target)
 {
     return(Add(collection, new MemorySize32Element(target)));
 }
 /// <summary>
 /// Absolute memory address of an element as a 32 bits or 64 bits unsigned integer depending on assembling context
 /// </summary>
 public static AbsoluteMemoryAddressPElement AbsoluteMemoryAddressP(this ElementCollection collection,
                                                                    Element target)
 {
     return(Add(collection, new AbsoluteMemoryAddressPElement(target)));
 }
 /// <summary>
 /// Memory address of an element relative to the base memory address as a 32 bits or 64 bits unsigned integer depending on assembling context
 /// </summary>
 public static RelativeMemoryAddressPElement RelativeMemoryAddressP(this ElementCollection collection,
                                                                    Element target)
 {
     return(Add(collection, new RelativeMemoryAddressPElement(target)));
 }