Class: Roby::DRoby::V5::DRobyID

Inherits:
Object
  • Object
show all
Defined in:
lib/roby/droby/v5/droby_id.rb

Overview

These objects are used in distributed Roby to identify objects across the various Roby instances

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ DRobyID

Returns a new instance of DRobyID.



12
13
14
15
# File 'lib/roby/droby/v5/droby_id.rb', line 12

def initialize(id)
    @id = id
    @hash = id.hash
end

Class Attribute Details

.droby_id_allocatorObject (readonly)

Returns the value of attribute droby_id_allocator.



37
38
39
# File 'lib/roby/droby/v5/droby_id.rb', line 37

def droby_id_allocator
  @droby_id_allocator
end

Instance Attribute Details

#hashObject (readonly)

Returns the value of attribute hash.



22
23
24
# File 'lib/roby/droby/v5/droby_id.rb', line 22

def hash
  @hash
end

#idObject (readonly)

The object ID



10
11
12
# File 'lib/roby/droby/v5/droby_id.rb', line 10

def id
  @id
end

Class Method Details

.allocateObject



41
42
43
# File 'lib/roby/droby/v5/droby_id.rb', line 41

def self.allocate
    DRobyID.new(droby_id_allocator.increment)
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?

:nodoc:



17
18
19
# File 'lib/roby/droby/v5/droby_id.rb', line 17

def ==(other) # :nodoc:
    other.kind_of?(DRobyID) && other.id == id
end

#inspectObject



28
29
30
# File 'lib/roby/droby/v5/droby_id.rb', line 28

def inspect
    to_s
end

#pretty_print(pp) ⇒ Object



32
33
34
# File 'lib/roby/droby/v5/droby_id.rb', line 32

def pretty_print(pp)
    pp.text to_s
end

#to_sObject



24
25
26
# File 'lib/roby/droby/v5/droby_id.rb', line 24

def to_s
    "#<DRobyID:#{id}>"
end