[SERVER-77577] Make IDL compiler generate “movable” getter methods Created: 30/May/23  Updated: 29/Aug/23

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Denis Grebennicov Assignee: Backlog - Service Architecture
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Service Arch
Participants:

 Description   

IDL compiler can generate class definitions with getter methods for the member fields.

The instances of the generated classes may be used in various places in the code and we could avoid copying values of their member fields if there was a way of moving field values.

This is not as simple as one could think as generated classes maintain a `_hasXField` boolean flag that indicates if the given field contains a value. This flag would need to be checked and set to false on value being moved.

One proposal discussed with billy.donahue@mongodb.com is to generate:

const Foo& getFoo() const;
void setFoo(Foo);
Foo takeFoo(); 


Generated at Thu Feb 08 06:35:59 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.