Class: Roby::Models::TaskServiceModel
- Includes:
- MetaRuby::ModelAsModule, DRoby::Identifiable, DRoby::V5::Models::TaskServiceModelDumper, Arguments
- Defined in:
- lib/roby/models/task_service.rb,
lib/roby/droby/enable.rb
Overview
Ruby (the language) has no support for multiple inheritance. Instead, it uses module to extend classes outside of the class hierarchy.
TaskService are the equivalent concept in the world of task models. They are a limited for of task models, which can be used to represent that certain task models have multiple functions.
For instance,
task_service "CameraDriver" do
# CameraDriver is an abstract model used to represent that some tasks
# are providing the services of cameras. They can be used to tag tasks
# that belong to different class hirerachies.
#
# One can set up arguments on TaskService the same way than class models:
argument :camera_name
argument :aperture
argument :aperture
end
FirewireDriver.provides CameraDriver
# FirewireDriver can now be used in relationships where CameraDriver was
# needed
Constant Summary
Constants included from Arguments
Arguments::NO_DEFAULT_ARGUMENT
Instance Method Summary collapse
Methods included from DRoby::V5::ModelDumper
#droby_dump, #droby_marshallable?
Methods included from DRoby::Identifiable
Methods included from Arguments
#argument, #arguments, #default_argument, #fullfills?, #meaningful_arguments
Methods inherited from Module
#action_library, #droby_dump, #droby_marshallable?, #each_fullfilled_model, #private_model?, #proxy_for
Methods included from TaskServiceDefinitionDSL
Instance Method Details
#clear_model ⇒ Object
32 33 34 35 |
# File 'lib/roby/models/task_service.rb', line 32 def clear_model super arguments.clear end |
#match(*args) ⇒ Object
47 48 49 50 51 52 53 54 55 |
# File 'lib/roby/models/task_service.rb', line 47 def match(*args) matcher = Queries::TaskMatcher.new if args.empty? && self != TaskService matcher.which_fullfills(self) else matcher.which_fullfills(*args) end matcher end |
#query(*args) ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/roby/models/task_service.rb', line 37 def query(*args) query = Queries::Query.new if args.empty? && self != TaskService query.which_fullfills(self) else query.which_fullfills(*args) end query end |