There was a discussion on Orocos Developers where we were looking into these
issues of the data flow ports:
* a port->read(value) that returns OldData fills in value, which means:
-- the port needs to cache each last value, even if the user will never use it
-- this caching breaks data management since another copy 'always' lives
(until a new sample arrives)
* There's no circular buffer
-- we agreed here to add it in addition to the current buffer in the connection
policy
What remains a big issue is if we should break port->read(value) such that it
does not touch 'value' if the current sample was once read before. The
rationale is that if you need this case, you can simply change:
SomeData value; if ( inport.read(value) != NoData ) { // do something with 'value', it's filled in! // allowed to change 'value' too, it will be overwritten // during the next read ! }
to:
// SomeData value; --> moved to the class as member variable ! if ( inport.read(value) != NoData ) { // do something with 'value', it's filled in by previous NewData read! // not allowed to change value directly since we might need it // in the next loop ! }
The advantage is mainly in code size and copy-efficiency of the data in the data
flow. By removing this feature, we don't have to keep a copy of the old sample
and we can simplify the implementation
We'd like to get an idea of:
- Does your code use this case ? (a lot ?)
- Would you mind adapting it when upgrading ?
- Would you agree if we put a warning system in this to flag when new vs old
would give a different result ?
- What's your opinion overall on this ?
No matter what the decision is, this won't affect 2.5...
Peter
PS: please reply to the orocos-users list only.