Class: Roby::Coordination::Models::Variable

Inherits:
Struct
  • Object
show all
Includes:
Tools::Calculus::Build
Defined in:
lib/roby/coordination/models/variable.rb

Overview

Placeholder, in the execution contexts, for variables. It is used for instance to hold the arguments to the state machine during modelling, replaced by their values during instanciation

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Tools::Calculus::Build

binary_op, unary_op

Instance Attribute Details

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



9
10
11
# File 'lib/roby/coordination/models/variable.rb', line 9

def name
  @name
end

Instance Method Details

#can_merge?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/roby/coordination/models/variable.rb', line 31

def can_merge?(*)
    false
end

#evaluate(variables) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/roby/coordination/models/variable.rb', line 11

def evaluate(variables)
    if variables.has_key?(name)
        variables[name]
    else
        raise ArgumentError, "expected a value for #{arg}, got none"
    end
end

#evaluate_delayed_argument(task) ⇒ Object



35
36
37
# File 'lib/roby/coordination/models/variable.rb', line 35

def evaluate_delayed_argument(task)
    throw :no_value
end

#strong?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/roby/coordination/models/variable.rb', line 27

def strong?
    true
end

#to_coordination_task(task_model = Roby::Task) ⇒ Object



23
24
25
# File 'lib/roby/coordination/models/variable.rb', line 23

def to_coordination_task(task_model = Roby::Task)
    TaskFromVariable.new(name, task_model)
end

#to_sObject



19
20
21
# File 'lib/roby/coordination/models/variable.rb', line 19

def to_s
    "var:#{name}"
end