Page MenuHomePhabricator

Inconsistent style for DataNode lists/vectors.
Closed, ResolvedPublic

Description

Currently our code base is inconsistent regarding the way a set of DataNodes are returned. We have at least 3 prominent styles.

  1. itk::VectorContainer<unsigned int, DataNode::Pointer> (e.g. DataStorage::SetOfObjectes)
  2. std::vector<DataNode::ConstPointer>
  3. QList<DataNode::Pointer>

Variant 1 is used in the context of the data storage.
Variant 2 was used e.g. heavily when the statistics where reworked in 2018/2019 and in code parts without Qt.
Variant 3 is used everywhere near Blueberry and plugins and BlueBerry selections. (This is the reason e.g. while all the new selection widgets use this type).

Question: Should we keep it as is? Should be change something or at least define a default for the future?
All variants can be more (1 to 2) or less (2 to 3) easily converted. It is sometimes anoying when writing code and interfaces do not snap directly together (e.g. when combining selection widgets with statistic widgets). But I am not sure if it is worth the effort. Currently I have mitigated the situation by introducing additional convinience setter/getter, that can provide the other type.

Event Timeline

floca triaged this task as Normal priority.Apr 12 2020, 12:23 PM
floca created this task.
floca claimed this task.
floca removed a project: Request for Discussion.

Discussion result:

  1. We will move the helper functions that convert between const and non-const node pointers for V1<->V2 to mitkCore to use vor everyone. The conversion with same constness is easy anyways.
  2. We will move the helper functions that convert between V2<->V3 to QtWidgets module to be accessible for all that use Qt.
  3. For now we will make no policies as their are a lot of use cases out there. We could revise this matter if new problems arise.

For 1 and 2 will be addressed by T27354.