epics-base / pvDataCPP

pvDataCPP is an EPICS V4 C++ module
https://epics-base.github.io/pvDataCPP/
Other
6 stars 16 forks source link

Add {Structure,Union}::getFieldT, fix {Structure,Union}::getField #67

Closed brunoseivam closed 5 years ago

brunoseivam commented 5 years ago

Fixes #66

mdavidsaver commented 5 years ago

I'm ok with adding getFieldT() variants, but I just can't bring myself to retroactively change the error behavior of getField(size_t). This would mean that getField<T>(size_t) continues to throw an exception on out of range index, and return NULL when type T isn't dynamic_cast-able. While this isn't how I would design a new API, I also don't think it is unreasonable. Array bounds can easily be checked with Field::getNumberFields().

mdavidsaver commented 5 years ago

The checks of 4cc9b650c57e7aa12e715e0f163120b19a0f249b could also be incorporated.