[Rock-dev] Inheritance in base/types - the natural way to go?

Javier Hidalgo Carrió javier.hidalgo_carrio at dfki.de
Fri Apr 10 11:12:49 CEST 2015


On 10.04.2015 09:47, Steffen Planthaber wrote:
>
> Now a short summary of the questions involved:
> (perhaps you can copy/paste this part to your answer to collect the
> opinions):
>
> - Use Inheritance? +1
+1

> - Use Templates for Extensions? +1
It depends on the type. I don't see a problem for Timestamp but I am not 
fully sure for Uncertainties since the propagation of the Uncertainty 
fully depends on the data type (no linearities on the propagation).  
Nevertheless, I guess it can be done using an Abstract class and the 
child class should implement the method.

Regarding std::pair,  I would guess typelib cannot handle multiple 
inheritance. Otherwise, NamedVector would be implemented in this manner.

Regarding the Timestamped:
Shall we still keep the Time.hpp class. What would happen in case 
someone just want to send a Time-stamp through a port? Was there a pull 
request for the Template class "Timestamped" to have a look?

> - Restructure folders in base/types to reflect extensions? +1
+ 1 with the naming convention:

The naming sceme reflects the way the template is read:
UncertainTransform : public Uncertain< Transform >


+1 with folders. We have to be careful to decide what goes where. 
Currently some samples types are what you named "extended". Therefore, I 
would avoid to have a folder named "extended" unless there is a good reason.

base/types:
- base:
     - <here all the base types>
- templates:
   - Timestamped.hpp
   - etc..
- samples:
    - <here all the extended types>
- commands:
    - <here all the extended types> (some types like Joints.hpp are just 
the same that samples)
> - Autoconvert extended and base types? -1
+1 I will say this will be the main advantage of the subtype polymorphism.
> - Generic Metadata in types? +1
Do you have an example for that?

> Kind regards,
>
> Steffen
I am afraid you brought a wider discussion than I originally meant with 
this email. Perhaps it is the right timing to discuss the topic...

Regards,

Javier.




More information about the Rock-dev mailing list