IOTechSystems / iotech-c-utils

Apache License 2.0
9 stars 7 forks source link

XRT-2602 add iot_data_iter #316

Closed dpazj closed 11 months ago

dpazj commented 11 months ago

We discussed a generic array type iterator. Some of my current work would benefit from this so came up with an example implementation. Some feedback would be good before I go any further. Hopefully you can get the gist from this.

iter_get_value() for an iot_data_array_t would return an iot_data_t that user can read, however they would not be able to modify the underlying array, unless there is a way you can create a ref to an numerical type?

SteveOss commented 11 months ago

Some WIP comments:

dpazj commented 11 months ago

@SteveOss ready for review

dpazj commented 11 months ago

@SteveOss For array support we could allocate an iot_data_t and require a user to call a function like iot_data_iter_clear once they have finished with the iter? Would be a bit inconsistent with other api usage, but would allow us to keep arrays.

SteveOss commented 11 months ago

@dpazj Even allocating an iot_data_t for an array iterator, doesn't work WRT to ownership when considering both lifetime of value and validity of scope, as essentially target collection type isn't holding iot_data. Also is pretty inefficient for iterating arrays of basic types. Not seeing a solution that works for array given existing iterator semantics.

dpazj commented 11 months ago

recheck

dpazj commented 11 months ago

@SteveOss CI seems to be stuck. Any ideas?