//-----------------------------------------------------------------------
// <copyright file="IBitwiseReadable.cs" company="Leet">
//     Copyright © by Hubert Bukowski. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace Leet.Binary
{
    using System;
    using System.Diagnostics.Contracts;

    /// <summary>
    ///     An interface that represents an object which provides reading of individual bits.
    /// </summary>
    public interface IBitwiseReadable
    {
        #region Properties
        /// <summary>
        ///     Gets a bit count of the readable data or indicates that the data unbounded ot its length is unknown.
        /// </summary>
        [Pure]
        int BitLength
        {
            get;
        }
        #endregion

        #region Methods
        /// <summary>
        ///     Reads specified numbers of bits starting at the specified offset.
        /// </summary>
        /// <param name="bitOffset">
        ///     Offset at which the read shall begin.
        /// </param>
        /// <param name="bitCount">
        ///     Number of bits to read.
        /// </param>
        /// <returns>
        ///     A bit segment of the <see cref="Int32"/> value that delimits the bits read from the object.
        /// </returns>
        [Pure]
        BitSegment<int> ReadBitsAsInt32(int bitOffset, int bitCount);

        /// <summary>
        ///     Reads specified numbers of bits starting at the specified offset.
        /// </summary>
        /// <param name="bitOffset">
        ///     Offset at which the read shall begin.
        /// </param>
        /// <param name="bitCount">
        ///     Number of bits to read.
        /// </param>
        /// <returns>
        ///     A bit segment of the <see cref="Int64"/> value that delimits the bits read from the object.
        /// </returns>
        [Pure]
        BitSegment<long> ReadBitsAsInt64(int bitOffset, int bitCount);
        #endregion
    }
}
