Module: Roby::Relations::Models::Graph

Includes:
MetaRuby::ModelAsClass
Defined in:
lib/roby/relations/models/graph.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#child_nameObject (readonly)

The child_name as given to Space#relation

This is used to dispatch to the relation-specific hooks in DirectedRelationSupport



39
40
41
# File 'lib/roby/relations/models/graph.rb', line 39

def child_name
  @child_name
end

#parentGraph?

The one and only graph that is a superset of self

Returns:



49
50
51
# File 'lib/roby/relations/models/graph.rb', line 49

def parent
  @parent
end

#subsetsSet<Graph> (readonly)

The set of graphs that are subsets of self

Returns:



44
45
46
# File 'lib/roby/relations/models/graph.rb', line 44

def subsets
  @subsets
end

Instance Method Details

#root_relation?Boolean

True if this relation graph is the subset of no other relation

Returns:

  • (Boolean)


63
64
65
# File 'lib/roby/relations/models/graph.rb', line 63

def root_relation?
    !parent
end

#setup_submodel(submodel, child_name: nil, distribute: true, dag: false, weak: false, strong: false, copy_on_replace: false, noinfo: true, subsets: Set.new) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Hook method called to setup a new relation graph



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/roby/relations/models/graph.rb', line 12

def setup_submodel(submodel, child_name: nil, distribute: true, dag: false, weak: false, strong: false, copy_on_replace: false, noinfo: true, subsets: Set.new)
    super
    submodel.instance_variable_set :@child_name, child_name
    submodel.distribute = distribute
    submodel.dag = dag
    submodel.weak = weak
    submodel.strong = strong
    submodel.copy_on_replace = copy_on_replace
    submodel.embeds_info = !noinfo
    submodel.instance_variable_set :@subsets, Set.new
    submodel.instance_variable_set :@parent, nil
    subsets.each do |rel|
        submodel.superset_of(rel)
    end
end

#superset_of(rel) ⇒ Object

Declare that self is a superset of another graph

Parameters:



70
71
72
73
# File 'lib/roby/relations/models/graph.rb', line 70

def superset_of(rel)
    subsets << rel
    rel.parent = self
end