[Bug 734] New: Adaption of DataSource to const reference

https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=734

Summary: Adaption of DataSource to const reference
Product: RTT
Version: 1.10.1
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P3
Component: Real-Time Toolkit (RTT)
AssignedTo: orocos-dev [..] ...
ReportedBy: meyer [..] ...
CC: orocos-dev [..] ...
Estimated Hours: 0.0

Created an attachment (id=573)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=573)
adapt AssignableDataSource to const ref without copying

If I am not totally wrong, in AdaptDataSource<const TResult&> the second case
where the source is an AssignableDataSource<TResult> will never be used, as
each AssignableDataSource is also a DataSource. Therefore the conversion always
involves copying, although this is not necessary. I would suggest to swap the
two cases. A patch for DataSourceAdapter.hpp is attached.

Johannes

[Bug 734] Adaption of DataSource to const reference

https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=734

Peter Soetens <peter [..] ...> changed:

What |Removed |Added
----------------------------------------------------------------------------
Resolution| |FIXED
Status|NEW |RESOLVED

--- Comment #2 from Peter Soetens <peter [..] ...> 2009-11-19 12:39:38 ---
(In reply to comment #0)
> Created an attachment (id=573)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=573)
> adapt AssignableDataSource to const ref without copying
>
> If I am not totally wrong, in AdaptDataSource<const TResult&> the second case
> where the source is an AssignableDataSource<TResult> will never be used, as each
> AssignableDataSource is also a DataSource. Therefore the conversion always
> involves copying, although this is not necessary. I would suggest to swap the
> two cases. A patch for DataSourceAdapter.hpp is attached.

It's on the mainlines and backported to 1.10.

Thanks for reporting.

Peter

[Bug 734] Adaption of DataSource to const reference

https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=734

Peter Soetens <peter [..] ...> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |peter [..] ...

--- Comment #1 from Peter Soetens <peter [..] ...> 2009-11-18 20:51:37 ---
(In reply to comment #0)
> Created an attachment (id=573)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=573) [details]
> adapt AssignableDataSource to const ref without copying
>
> If I am not totally wrong, in AdaptDataSource<const TResult&> the second case
> where the source is an AssignableDataSource<TResult> will never be used, as
> each AssignableDataSource is also a DataSource. Therefore the conversion always
> involves copying, although this is not necessary. I would suggest to swap the
> two cases. A patch for DataSourceAdapter.hpp is attached.

Holy sh*t ! How did you track that one down ? Everything relies on these
conversion functions, scripting, CORBA and all that may come...

Anyway, it's fortunately only an optimisation problem, but it can influence RT
in case copying TResult is not HRT.

I'll apply it asap. It's time for 1.10.2 anyway...

Peter