Skip to content

Add visit-like pattern for RecordComponent#1544

Merged
ax3l merged 5 commits intoopenPMD:devfrom
franzpoeschel:recordcomponent-visit
Dec 22, 2023
Merged

Add visit-like pattern for RecordComponent#1544
ax3l merged 5 commits intoopenPMD:devfrom
franzpoeschel:recordcomponent-visit

Conversation

@franzpoeschel
Copy link
Contributor

@franzpoeschel franzpoeschel commented Oct 20, 2023

Close #1372

TODO:

  • Once we agree on a design, add some further examples

This adds:

  1. std::variant<...> aliases for openPMD datatypes
  2. A RecordComponent::visit(...) call that instantiates the passed Functor Template Object with the current type of the RecordComponent
  3. Using 1. and 2., a RecordComponent::loadChunkVariant() call that returns a std::variant<...> of shared_ptr types

@franzpoeschel franzpoeschel added frontend: C++17 api: new additions to the API labels Oct 20, 2023
} // namespace detail

template <typename Visitor, typename... Args>
constexpr auto RecordComponent::visit(Args &&...args)

Check notice

Code scanning / CodeQL

Unused local variable

Variable args is not used.
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!

@ax3l ax3l merged commit b131cd2 into openPMD:dev Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: new additions to the API frontend: C++17

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A Variant-Based LoadChunk

2 participants