Class: RetroIDL::ASN::SEQUENCE

Inherits:
BaseType
  • Object
show all
Defined in:
lib/retro_idl/asn/sequence.rb

Constant Summary collapse

TAG_CLASS_NUMBER =
16
TAG_CLASS =
:universal

Instance Attribute Summary

Attributes inherited from BaseType

#id

Instance Method Summary collapse

Methods inherited from BaseType

===

Constructor Details

#initialize(**opts) ⇒ SEQUENCE

Returns a new instance of SEQUENCE.



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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/retro_idl/asn/sequence.rb', line 26

def initialize(**opts)

    super(**opts)

    errors = false

    @exception = opts[:exception]
    @extensible = opts[:extensible]
    @head = nil
    @tail = nil
    @additional = nil
    
    if opts[:head]

        begin
    
        @head = TypeList.new(opts[:head], ComponentType)

        rescue ASNError

        errors = true

        end

    end

    if opts[:additional]

        begin

        @additional = TypeList.new(opts[:additional], ComponentType)

        rescue ASNError

        errors = true

        end                    

    end

    if opts[:tail]

        begin

        @tail = TypeList.new(opts[:tail], ComponentType)

        rescue ASNError

        errors = true

        end
    
    end

    if errors

        raise ASNError.new

    end
    
end

Instance Method Details

resolve symbols to definitions in module

Parameters:

  • mod (MODULE)

    module this type belongs to

  • stack (Array)

    objects called before this object for depth first search of recursion

Returns:

  • (MODULE)

    object has been linked

  • (nil)

    object has not been linked



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/retro_idl/asn/sequence.rb', line 89

def link(mod, stack)

    if @mod.nil? or @mod != mod

        @mod = nil

        if @head.nil? or @head.link(mod, stack)

            if @tail.nil? or @tail.link(mod, stack)

                if @additional.nil? or @additional.link(mod, stack)

                    super(mod, [])

                end

            end

        end

    else

        @mod

    end
    
end

#to_sString

Convert object to ASN.1 syntax representation

Returns:

  • (String)

    ASN.1 syntax representation

Raises:



118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/retro_idl/asn/sequence.rb', line 118

def to_s

    result = "#{@tag} SEQUENCE { #{@head} "

    if @extensible

        result << ", ... "

    end

    result << "} #{@constraint}"

end