asn1_iterators-myseq.ads 1.72 KB
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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
with Ada.Iterator_Interfaces;

with Ada.Finalization;
use Ada.Finalization;

with ASN1_Iterators.Generic_Basic;
with ASN1_Iterators.SimpleTypes;
with ASN1_Ada_Iterators.Iterators;
use ASN1_Ada_Iterators.Iterators;

with TASTE_DataView;

package ASN1_Iterators.MySeq is

    package a_Pkg renames MyInteger.Pkg;
    package b_Pkg renames MyEnum_Pkg;

    type ASN1_MySeq_Ptr;
    type ASN1_MySeq_It;

    type ASN1_MySeq is new Controlled
    with record
      a_val  : a_Pkg.It.Basic_ASN1_Iterator;
      a_it   : a_Pkg.It.Iterator;
      b_val  : b_Pkg.It.Basic_ASN1_Iterator;
      b_i    : B_Pkg.It.Iterator;
      Value  : asn1SccMySeq;
      -- First value
      -- FirstVal : P.Basic_ASN1_Iterator;
      --FirstIt  : P.Iterator;
    end record
      with Default_Iterator  => Iterate,
           Iterator_Element  => asn1SccMySeq,
           Constant_Indexing => Element_MySeq_Value;

    type Cursor is access all ASN1_MySeq;

    --  Constructor (called automatically)
    procedure Initialize (Self : in out ASN1_MySeq);

    function Has_Element_MySeq (Ptr : Cursor) return Boolean;

    package Iterators_MySeq is
       new Ada.Iterator_Interfaces (Cursor, Has_Element_MySeq);

    type ASN1_MySeq_It is new Iterators_MySeq.Forward_Iterator with record
       Ptr : Cursor;
    end record;

    overriding function First (Item : ASN1_MySeq_It) return Cursor;
    overriding function Next  (Item : ASN1_MySeq_It;
                               Ptr  : Cursor) return Cursor;

    function Iterate (self : ASN1_MySeq)
       return ASN1_MySeq_It'Class; --  Iterators_SeqOf.Forward_Iterator'Class;

    function Element_MySeq_Value (Self : ASN1_MySeq;
                                  Ptr  : Cursor)
       return asn1SccMySeq is (self.Value);
end;