module Roby::Relations::Models::Graph
Attributes
child_name[R]
The child_name
as given to Space#relation
This is used to dispatch to the relation-specific hooks in {DirectedRelationSupport}
parent[R]
The one and only graph that is a superset of self
@return [Graph,nil]
subsets[R]
The set of graphs that are subsets of self
@return [Set<Graph>]
Public Instance Methods
parent=(rel)
click to toggle source
Sets the graph that is a superset of self
@raise [ArgumentError] if there is already one
# File lib/roby/relations/models/graph.rb, line 52 def parent=(rel) if @parent && @parent != rel raise ArgumentError, "#{self} already has a parent (#{@parent})" end @parent = rel end
root_relation?()
click to toggle source
True if this relation graph is the subset of no other relation
# 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)
click to toggle source
@api private
Hook method called to setup a new relation graph
Calls superclass method
# 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)
click to toggle source
Declare that self is a superset of another graph
@param [Graph] rel
# File lib/roby/relations/models/graph.rb, line 67 def superset_of(rel) subsets << rel rel.parent = self end