AIDASoft / podio

PODIO
GNU General Public License v3.0
24 stars 59 forks source link

Inconsistent reference access for Mutable types #551

Closed tmadlener closed 7 months ago

tmadlener commented 7 months ago

The generated interface for our mutable types allows to access component members by reference, but not for primitive types, i.e.

components:
  SimpleStruct:
    Members:
      -  int i // integer

datatypes:
  SimpleDatatype:
    Members:
      - int j // integer
      - SimpleStruct s // component

will generate to (assuming getter syntax is turned on)

class MutableSimpleDataType {
  // many other things
  // ...

  int getJ() const;
  const  SimpleStruct& getS() const;

  // this mutable accessor only exists for non-builtin types
  SimpleStruct& s();
};

This is inconsistent in two ways with the rest of the generated code:

After some discussion with @paulgessinger (who actually found this), I think the easiest solution is to

This doesn't affect const-correctness of generated EDMs and will make the Mutable handles more consistent (and a bit more useful).