Class: TCWrapper::Id

Inherits:
Object
  • Object
show all
Defined in:
lib/distem/wrapper/tc/id.rb

Direct Known Subclasses

IdRoot

Constant Summary

@@majors =
{}

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Id) initialize(major, minor = 0)

Returns a new instance of Id



8
9
10
11
12
13
# File 'lib/distem/wrapper/tc/id.rb', line 8

def initialize(major,minor=0)
  @major = major
  @minor = minor

  @minors = minor
end

Instance Attribute Details

- (Object) major (readonly)

Returns the value of attribute major



5
6
7
# File 'lib/distem/wrapper/tc/id.rb', line 5

def major
  @major
end

- (Object) minor (readonly)

Returns the value of attribute minor



5
6
7
# File 'lib/distem/wrapper/tc/id.rb', line 5

def minor
  @minor
end

Class Method Details

+ (Object) get_unique_major_id(iface)



19
20
21
22
23
# File 'lib/distem/wrapper/tc/id.rb', line 19

def self.get_unique_major_id(iface)
  @@majors[iface] = 0 unless @@majors[iface]
  @@majors[iface] += 1
  @@majors[iface] * 10
end

Instance Method Details

- (Object) next_minor_id



15
16
17
# File 'lib/distem/wrapper/tc/id.rb', line 15

def next_minor_id
  @minors += 1
end

- (Object) to_s



25
26
27
# File 'lib/distem/wrapper/tc/id.rb', line 25

def to_s
  @major.to_s + ":" + (@minor > 0 ? "0x#{@minor.to_s(16)}" : "")
end