[Rock-dev] Discussion: Timestamped Commands in base/types
Sylvain Joyeux
sylvain.joyeux at dfki.de
Tue Nov 5 14:45:12 CET 2013
On 11/05/2013 01:31 PM, Steffen Planthaber wrote:
> The copy constructor is only defined for the command itself, not for
> the template, so i didn't see an issue here. The implicit copy
> constructor is used in all other "normal" cases.
By 'implicit' I did not mean "automatically generated" but "not
explicit" (i.e. not declared with the explicit keyword).
> But I agree, the programmer should "give a thought" on the time to use,
> so I'm fine with removing the "upcast constructor".
Actually, I *was* proposing to add an upcase constructor (which is not
in the current implementation), to replace the set() method. But your
very comment makes me think that having it implicit is a bad idea indeed
(timestamp ...). Having an explicit constructor would be a better option
than the set method, though.
explicit TimeStamped(BASE const& base, base::Time const& time)
: BASE(base), time(time) {}
It would allow to do convertions in one line (instead of having to
create a variable, call set and then use it).
> Having public class variables is gernerally bad, you cannot change or
> refactor the internal implementation (e.g. varibale names) without
> breaking everyones implementations, having getters and setters lets you
> change class implementations without breaking other programmers code.
> I mostly program this way. This is also why I personally read the
> documentation of methods and functions more than the documentation of
> class variables. But as i understood having the time variable publis had
> other reasons, at least i hope so.
This is fine, except that changing attribute names on types used in
orogen interfaces is a definite no-no as it means "upgrade path" for all
users of this type (generated log files will differ, ...).
---
Sylvain Joyeux (Dr.Ing.)
Space & Security Robotics
!!! Achtung, neue Telefonnummer!!!
Standort Bremen:
DFKI GmbH
Robotics Innovation Center
Robert-Hooke-Straße 5
28359 Bremen, Germany
Phone: +49 (0)421 178-454136
Fax: +49 (0)421 218-454150
E-Mail: robotik 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