asn1_iterators-generic_integer.ads 1013 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
with ASN1_Iterators.SimpleTypes,
     ASN1_Iterators.Generic_Basic;

with Interfaces;
use Interfaces;

generic
    Min: Interfaces.Integer_64;
    Max: Interfaces.Integer_64;
package ASN1_Iterators.Generic_Integer is
    function Elem_Init return Interfaces.Integer_64 is (Min);
    function Has_Elem(Value: Interfaces.Integer_64) return Boolean is
        (Value <= Max);
    function Elem_First return Interfaces.Integer_64 is (Min);
    function Elem_Next(Value: Interfaces.Integer_64) return Interfaces.Integer_64 is
        (Value + 1);

    package Integer_type is new SimpleTypes(Element    => Interfaces.Integer_64,
                                            Elem_Init  => Elem_Init,
                                            Has_Elem   => Has_Elem,
                                            Elem_First => Elem_First,
                                            Elem_Next  => Elem_Next);

    package It is new Generic_Basic (P => Integer_type);

    subtype Instance is It.Basic_ASN1_Iterator;
end;