[Rock-dev] Orogen Task Interface Enums

Alexander Duda Alexander.Duda at dfki.de
Wed Sep 28 17:56:25 CEST 2011


On Wed, 2011-09-28 at 15:44 +0200, Chris Müller wrote:
> 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.

should work

> 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

should work 

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

:Symbok.to_s 
But I do not understand why you need this.

> 
> 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
> 
> 
> 
> _______________________________________________
> Rock-dev mailing list
> Rock-dev at dfki.de
> http://www.dfki.de/mailman/cgi-bin/listinfo/rock-dev

-- 
Dipl.-Ing. Alexander Duda 
Unterwasserrobotik

DFKI Bremen
Robotics Innovation Center
Robert-Hooke-Straße 5
28359 Bremen, Germany

Phone: +49 (0)421 178-456620
Fax:   +49 (0)421 178-454150
E-Mail: alexander.duda at dfki.de

Weitere Informationen: http://www.dfki.de/robotik
-----------------------------------------------------------------------
Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
Firmensitz: Trippstadter Straße 122, D-67663 Kaiserslautern
Geschaeftsfuehrung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster
(Vorsitzender) Dr. Walter Olthoff
Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
Amtsgericht Kaiserslautern, HRB 2313
Sitz der Gesellschaft: Kaiserslautern (HRB 2313)
USt-Id.Nr.:    DE 148646973
Steuernummer:  19/673/0060/3



More information about the Rock-dev mailing list