Skip to content

enh(core): const getters on data do not return const pointer

Description

Many getters in data returns shared_pointer, even if the data was const the returned pointer wasn't and underlying data was still modifiable. This has been changed to provide const getters that returns const pointer, and non const getter to returns simple shared_pointer. Doing so leads to some changes in part of the code that uses const data (usually input data)

  • Use of const_cast as been restricted to 3 cases:
    • When moving buffer to ITK or VTK
    • SReconstruction when moving the pointer to data::Material to an internal SMesh adaptor.
    • SGetImage, since ImageSeries input is const, when doing a setOutput (non const) with series->getImage, a const_cast is needed to discard const qualifier.
  • Changing from inout to input access:
    • SMesh: mesh data is now a const input.
  • Use const shared_pointer when possible

Closes #232 (closed)

How to test it?

You will need to test almost every application / tutorials / examples to check that everything that implies data still works.

A specific focus on reading/writting, on sessions & DICOM may be required.

Edited by Marc SCHWEITZER

Merge request reports