Skip to content

Follow-up of frontend redesign: Remove unnecessary pointer members#936

Merged
ax3l merged 7 commits intoopenPMD:devfrom
franzpoeschel:topic-remove-shared-pointers
Mar 8, 2021
Merged

Follow-up of frontend redesign: Remove unnecessary pointer members#936
ax3l merged 7 commits intoopenPMD:devfrom
franzpoeschel:topic-remove-shared-pointers

Conversation

@franzpoeschel
Copy link
Contributor

@franzpoeschel franzpoeschel commented Feb 26, 2021

This makes the members of SeriesData and AttributableData plain members instead of shared pointers.

TODO:

  • Member ordering?

Also, I've noticed that we could theoretically merge Writable with AttributableData, simplifying our class structure somewhat. Writable m_writable is now a plain member of AttributableData, it is neither movable nor copyable so it's not going anywhere and it has a pointer back to the AttributableData, so there's no real reason to keep them separate apart from the large diff that would be..

mapped_type &
operator[]( key_type && key ) override;
};

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed to move to front now since m_writeIterations is now a plain member of SeriesData. We could use a unique pointer to avoid this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a plain member is quite good.
We could move the WriteIterations class in its own .hpp/.cpp files, though.

@ax3l ax3l self-requested a review March 4, 2021 01:10
@ax3l ax3l self-assigned this Mar 4, 2021
Copy link
Member

@ax3l ax3l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great!

I added two minor updates inline.

If you like to merge Writable and AttributableData I am ok in a follow-up. If you like we can also discuss it briefly on Tuesday first.

mapped_type &
operator[]( key_type && key ) override;
};

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a plain member is quite good.
We could move the WriteIterations class in its own .hpp/.cpp files, though.

@franzpoeschel franzpoeschel force-pushed the topic-remove-shared-pointers branch from 36fdc71 to 2f123e0 Compare March 5, 2021 14:24
@franzpoeschel franzpoeschel force-pushed the topic-remove-shared-pointers branch from 2f123e0 to 199f65d Compare March 5, 2021 14:40
#include "openPMD/Iteration.hpp"
#include "openPMD/Series.hpp"

/** Writing side of the streaming API.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you add a doxygen block like this here, it will "pop down" to the next best match, which is namespace openPMD.

Do you like to make this a block for the file itself? In that case do this:

Suggested change
/** Writing side of the streaming API.
/** @file
*
* Writing side of the streaming API.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy paste error, that's not supposed to be there. Thanks for noticing.

{
return SeriesIterator::end();
}
} No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
} // namespace openPMD

}
return res;
}
} No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EOF newlines are good for:

  • compiler robustness (pre C++11, this was even required by the C++ standard)
  • better git diffs

I am adding a namespace comment here since that makes the }} more readable, since it has no indentation.

Suggested change
}
} // namespace openPMD

Copy link
Member

@ax3l ax3l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 very nice :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants