Class: RetroIDL::ASN::BITSTRING

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

Constant Summary collapse

TAG_CLASS_NUMBER =
3
TAG_CLASS =
:universal

Instance Attribute Summary

Attributes inherited from BaseType

#id

Instance Method Summary collapse

Methods inherited from BaseType

===

Constructor Details

#initialize(**opts) ⇒ BITSTRING

Returns a new instance of BITSTRING.



7
8
9
10
11
12
13
14
15
# File 'lib/retro_idl/asn/bit_string.rb', line 7

def initialize(**opts)

    super(**opts)
    @bitList = nil
    if opts[:bitList]
        @bitList = ValueList.new(opts[:bitList], NamedNumber)
    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



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/retro_idl/asn/bit_string.rb', line 18

def link(mod, stack)

    if @mod.nil? or @mod != mod
        @mod = nil
        if @bitList.nil? or @bitList.link(mod, [])
            super(mod, stack)
        end
    else
        @mod
    end
    
end

#to_sString

Convert object to ASN.1 syntax representation

Returns:

  • (String)

    ASN.1 syntax representation

Raises:



32
33
34
35
36
37
38
39
40
# File 'lib/retro_idl/asn/bit_string.rb', line 32

def to_s

    result = "#{@tag} BIT STRING"
    if @bitList
        result << @bitList.to_s
    end
    result << " #{@constraint}"
    
end