Module: Syskit::Models::Deployment

Includes:
MetaRuby::ModelAsClass, Base, OrogenBase
Included in:
Deployment
Defined in:
lib/syskit/models/deployment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from OrogenBase

#find_model_by_orogen, #find_model_from_orogen_name, #has_model_for?, #model_for

Methods included from Base

#dependency_injection_names, #pretty_print, #short_name, #to_instance_requirements, #to_s

Instance Attribute Details

#orogen_modelObject

Orocos::Generation::Deployment

the deployment model



31
32
33
# File 'lib/syskit/models/deployment.rb', line 31

def orogen_model
  @orogen_model
end

Instance Method Details

#all_default_name_mappingArray<String,String>

The union, along the class hierarchy, of all the values stored in default_name_mapping

Returns:

  • (Array<String,String>)


20
# File 'lib/syskit/models/deployment.rb', line 20

inherited_attribute('default_name_mapping', 'default_name_mappings', map: true) { Hash.new }

#all_default_run_optionArray<String,String>

The union, along the class hierarchy, of all the values stored in default_run_option

Returns:

  • (Array<String,String>)


13
# File 'lib/syskit/models/deployment.rb', line 13

inherited_attribute('default_run_option', 'default_run_options', map: true) { Hash.new }

#default_name_mappingHash<String,String>

The set of default name mappings for the instances of this deployment model

Returns:

  • (Hash<String,String>)


20
# File 'lib/syskit/models/deployment.rb', line 20

inherited_attribute('default_name_mapping', 'default_name_mappings', map: true) { Hash.new }

#default_name_mappingsHash<String,String>

The set of default name mappings for the instances of this deployment model

Returns:

  • (Hash<String,String>)


20
# File 'lib/syskit/models/deployment.rb', line 20

inherited_attribute('default_name_mapping', 'default_name_mappings', map: true) { Hash.new }

#default_run_optionHash<String,String>

The options that should be passed when starting the underlying Orocos process.

Returns:

  • (Hash<String,String>)


13
# File 'lib/syskit/models/deployment.rb', line 13

inherited_attribute('default_run_option', 'default_run_options', map: true) { Hash.new }

#default_run_optionsHash<String,String>

The options that should be passed when starting the underlying Orocos process.

Returns:

  • (Hash<String,String>)


13
# File 'lib/syskit/models/deployment.rb', line 13

inherited_attribute('default_run_option', 'default_run_options', map: true) { Hash.new }

#define_from_orogen(orogen_model, register: false) ⇒ Models::Deployment

Creates a subclass of Deployment that represents the given deployment

Parameters:

  • orogen_model (Orocos::Spec::Deployment)

    the oroGen deployment model

  • options (Hash)

    a customizable set of options

Returns:



77
78
79
80
81
82
83
# File 'lib/syskit/models/deployment.rb', line 77

def define_from_orogen(orogen_model, register: false)
    model = new_submodel(orogen_model: orogen_model)
    if register && orogen_model.name
        Deployments.const_set(orogen_model.name.camelcase(:upper), model)
    end
    model
end

#deployment_nameObject

Returns the name of this particular deployment instance



34
35
36
# File 'lib/syskit/models/deployment.rb', line 34

def deployment_name
    orogen_model.name
end

#each_default_name_mapping {|element| ... } ⇒ Object

Enumerates all objects registered in default_name_mapping

Yields:

  • (element)

Yield Parameters:

  • element (String, String)

Returns:



20
# File 'lib/syskit/models/deployment.rb', line 20

inherited_attribute('default_name_mapping', 'default_name_mappings', map: true) { Hash.new }

#each_default_run_option {|element| ... } ⇒ Object

Enumerates all objects registered in default_run_option

Yields:

  • (element)

Yield Parameters:

  • element (String, String)

Returns:



13
# File 'lib/syskit/models/deployment.rb', line 13

inherited_attribute('default_run_option', 'default_run_options', map: true) { Hash.new }

#each_deployed_task_model {|name, model| ... } ⇒ Object

Enumerate the tasks that are deployed in self

Yield Parameters:



104
105
106
107
108
109
110
111
# File 'lib/syskit/models/deployment.rb', line 104

def each_deployed_task_model
    return enum_for(__method__) if !block_given?

    each_orogen_deployed_task_context_model do |deployed_task|
        task_model = Syskit::TaskContext.model_for(deployed_task.task_model)
        yield(deployed_task.name, task_model)
    end
end

#each_deployed_task_nameObject

Enumerate the names of the tasks deployed by self



93
94
95
96
97
98
# File 'lib/syskit/models/deployment.rb', line 93

def each_deployed_task_name
    return enum_for(__method__) if !block_given?
    orogen_model.task_activities.each do |task|
        yield(task.name)
    end
end

#each_orogen_deployed_task_context_model {|deployed_task| ... } ⇒ void

This method returns an undefined value.

Enumerates the deployed tasks this deployment contains

Yield Parameters:

  • deployed_task (Orocos::Generation::DeployedTask)


117
118
119
# File 'lib/syskit/models/deployment.rb', line 117

def each_orogen_deployed_task_context_model(&block)
    orogen_model.task_activities.each(&block)
end

#instanciate(plan, arguments = Hash.new) ⇒ Object



38
39
40
41
# File 'lib/syskit/models/deployment.rb', line 38

def instanciate(plan, arguments = Hash.new)
    plan.add(task = new(arguments))
    task
end

#new_submodel(name: nil, orogen_model: nil, **options, &block) ⇒ Deployment

Creates a new deployment model

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (**options):

  • orogen_model (Orocos::Spec::Deployment)

    the oroGen model for this deployment

  • name (String)

    the model name, for anonymous model. It is usually not necessary to provide it.

Returns:

  • (Deployment)

    the deployment class, as a subclass of Deployment



51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/syskit/models/deployment.rb', line 51

def new_submodel(name: nil, orogen_model: nil, **options, &block)
    klass = super(name: name, **options) do
        self.orogen_model = orogen_model ||
            Models.create_orogen_deployment_model(name)
        if block
            self.orogen_model.instance_eval(&block)
        end
    end
    klass.each_deployed_task_name do |name|
        klass.default_name_mappings[name] = name
    end
    klass
end

#supermodelObject

Models::Deployment

Returns the parent model for this class, or

nil if it is the root model



24
25
26
27
28
# File 'lib/syskit/models/deployment.rb', line 24

def supermodel
    if superclass.respond_to?(:register_submodel)
        return superclass
    end
end

#tasksObject

An array of Orocos::Generation::TaskDeployment instances that represent the tasks available in this deployment. Associated plan objects can be instanciated with #task



88
89
90
# File 'lib/syskit/models/deployment.rb', line 88

def tasks
    orogen_model.task_activities
end