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



37
38
39
# File 'lib/roby/relations/models/graph.rb', line 37

def child_name
  @child_name
end

#parentGraph?

The one and only graph that is a superset of self



47
48
49
# File 'lib/roby/relations/models/graph.rb', line 47

def parent
  @parent
end

#subsetsSet<Graph> (readonly)

The set of graphs that are subsets of self



42
43
44
# File 'lib/roby/relations/models/graph.rb', line 42

def subsets
  @subsets
end

Instance Method Details

#root_relation?Boolean

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



60
61
62
# File 'lib/roby/relations/models/graph.rb', line 60

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



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

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



67
68
69
70
# File 'lib/roby/relations/models/graph.rb', line 67

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