From 90d02c1abcf842ce51191e5d4c009149cba749c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20P=C3=B6schel?= Date: Fri, 20 Oct 2023 14:11:15 +0200 Subject: [PATCH] Move implementation to .tpp --- include/openPMD/RecordComponent.hpp | 29 ------------------------ include/openPMD/RecordComponent.tpp | 35 ++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 30 deletions(-) diff --git a/include/openPMD/RecordComponent.hpp b/include/openPMD/RecordComponent.hpp index 90352268d5..bd519fca20 100644 --- a/include/openPMD/RecordComponent.hpp +++ b/include/openPMD/RecordComponent.hpp @@ -98,29 +98,6 @@ namespace internal }; } // namespace internal -class RecordComponent; - -namespace detail -{ - template - struct VisitRecordComponent - { - template - static Res call(RecordComponent &rc, Args &&...args) - { - return Functor::template call(rc, std::forward(args)...); - } - - template - static Res call(Args &&...) - { - throw std::runtime_error( - "[RecordComponent::visit()] Unknown datatype in " - "RecordComponent"); - } - }; -} // namespace detail - class RecordComponent : public BaseRecordComponent { template @@ -461,13 +438,7 @@ class RecordComponent : public BaseRecordComponent template constexpr auto visit(Args &&...args) -> decltype(Visitor::template call( - std::declval(), std::forward(args)...)) - { - using Res = decltype(Visitor::template call( std::declval(), std::forward(args)...)); - return switchNonVectorType>( - getDatatype(), *this, std::forward(args)...); - } static constexpr char const *const SCALAR = "\vScalar"; diff --git a/include/openPMD/RecordComponent.tpp b/include/openPMD/RecordComponent.tpp index dc796c8180..724aa8ca57 100644 --- a/include/openPMD/RecordComponent.tpp +++ b/include/openPMD/RecordComponent.tpp @@ -250,7 +250,7 @@ void RecordComponent::storeChunkRaw(T *ptr, Offset offset, Extent extent) template inline typename std::enable_if_t< - auxiliary::IsContiguousContainer_v > + auxiliary::IsContiguousContainer_v> RecordComponent::storeChunk(T_ContiguousContainer &data, Offset o, Extent e) { uint8_t dim = getDimensionality(); @@ -373,4 +373,37 @@ RecordComponent::storeChunk(Offset offset, Extent extent) #endif }); } + +namespace detail +{ + template + struct VisitRecordComponent + { + template + static Res call(RecordComponent &rc, Args &&...args) + { + return Functor::template call(rc, std::forward(args)...); + } + + template + static Res call(Args &&...) + { + throw std::runtime_error( + "[RecordComponent::visit()] Unknown datatype in " + "RecordComponent"); + } + }; +} // namespace detail + +template +constexpr auto RecordComponent::visit(Args &&...args) + -> decltype(Visitor::template call( + std::declval(), std::forward(args)...)) +{ + using Res = decltype(Visitor::template call( + std::declval(), std::forward(args)...)); + return switchNonVectorType>( + getDatatype(), *this, std::forward(args)...); +} + } // namespace openPMD