SeqAn3
cereal.hpp
Go to the documentation of this file.
1 // ============================================================================
2 // SeqAn - The Library for Sequence Analysis
3 // ============================================================================
4 //
5 // Copyright (c) 2006-2018, Knut Reinert & Freie Universitaet Berlin
6 // Copyright (c) 2016-2018, Knut Reinert & MPI Molekulare Genetik
7 // All rights reserved.
8 //
9 // Redistribution and use in source and binary forms, with or without
10 // modification, are permitted provided that the following conditions are met:
11 //
12 // * Redistributions of source code must retain the above copyright
13 // notice, this list of conditions and the following disclaimer.
14 // * Redistributions in binary form must reproduce the above copyright
15 // notice, this list of conditions and the following disclaimer in the
16 // documentation and/or other materials provided with the distribution.
17 // * Neither the name of Knut Reinert or the FU Berlin nor the names of
18 // its contributors may be used to endorse or promote products derived
19 // from this software without specific prior written permission.
20 //
21 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 // ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE
25 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
31 // DAMAGE.
32 //
33 // ============================================================================
34 
40 #pragma once
41 
42 #include <type_traits>
43 
44 #include <seqan3/core/platform.hpp>
45 
46 #if SEQAN3_WITH_CEREAL
47 #include <cereal/details/traits.hpp>
48 #include <cereal/archives/binary.hpp>
49 #endif
50 
51 namespace seqan3
52 {
53 
65 #if SEQAN3_WITH_CEREAL
67 template <typename t>
68 concept cereal_output_archive_concept = std::is_base_of_v<cereal::detail::OutputArchiveBase, t>;
69 #else
70 template <typename t>
71 concept cereal_output_archive_concept = false;
72 #endif
73 
86 #if SEQAN3_WITH_CEREAL
88 template <typename t>
89 concept cereal_input_archive_concept = std::is_base_of_v<cereal::detail::InputArchiveBase, t>;
90 #else
91 template <typename t>
92 concept cereal_input_archive_concept = false;
93 #endif
94 
103 #if SEQAN3_WITH_CEREAL
105 template <typename t>
106 concept cereal_archive_concept = cereal_output_archive_concept<t> || cereal_input_archive_concept<t>;
107 #else
108 template <typename t>
109 concept cereal_archive_concept = false;
110 #endif
111 
124 #if SEQAN3_WITH_CEREAL
126 template <typename t>
127 concept cereal_text_archive_concept = std::is_base_of_v<cereal::traits::TextArchive, t>;
128 #else
129 template <typename t>
130 concept cereal_text_archive_concept = false;
131 #endif
132 
163 #if SEQAN3_WITH_CEREAL
165 template <typename value_t,
166  typename input_archive_t = cereal::BinaryInputArchive,
167  typename output_archive_t = cereal::BinaryOutputArchive>
168 concept cerealisable_concept =
169  cereal::traits::is_input_serializable<value_t, input_archive_t>::value &&
170  cereal::traits::is_output_serializable<value_t, output_archive_t>::value;
171 #else
172 template <typename t>
173 concept cerealisable_concept = false;
174 #endif
175 
177 } // namespace seqan3
178 
179 namespace seqan3::detail
180 {
181 
186 #if SEQAN3_WITH_CEREAL
187 template <typename type>
188 using strip_cereal_wrapper_t = typename cereal::traits::strip_minimal<std::decay_t<type>>::type;
189 #else
190 template <typename type>
191 using strip_cereal_wrapper_t = type;
192 #endif
193 
194 } // namespace seqan3::detail
Contains platform and dependency checks.
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:58
Definition: aligned_sequence_concept.hpp:288
Provides C++20 additions to the type_traits header.