[Rock-dev] Orogen Task Interface Enums

Chris Müller christoph.mueller at dfki.de
Wed Sep 28 15:44:00 CEST 2011


Hi everybody,

i'm currently writing an orogen module and would like to use for a 
specific property an enum-like
structure something like:

namespace symbols {
enum Type {
    SYSTEM, NETWORK
};
}

I'm not sure if its possible to define an Enum in a simple Header file 
'enum.h', import its type via
import_types_from "symbols/Type" and use this in a property and in its
relating c++ task representation.

Most of the time the components are controlled via orocos.rb interface.

Therefore i would probably prefer the ruby-way by using its symbol 
syntax e.g.:

task = TaskContext.get "AnyTask"
task.property = :value

It's possible in Ruby to convert any symbol to a String. Therefore the 
port could be easily described via an /std/string.

I've already tried that out in our current implementation of orocos.rb 
and unfortanetely i'll get an error:
`from_ruby': cannot convert system to /std/string (ArgumentError)

Can we implement an autoconversion for Symbol -> String, if the current 
property accepts /std/string?
(or maybe another way to map Symbols to Integers/Enums)

I know this is a very unimportant issue because we can also use a simple 
String for that. But it would make the task
interface a little more ruby-like similar to other famous Ruby APIs.

Just a simple thought in daily work with ruby & orocos.rb

Chris





More information about the Rock-dev mailing list