SeqAn3
3.0.2
The Modern C++ library for sequence analysis.
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
store.hpp
1
#include <
fstream
>
2
#include <
vector
>
3
5
#include <cereal/archives/binary.hpp>
// includes the cereal::BinaryOutputArchive
8
#include <cereal/types/vector.hpp>
// includes cerealisation support for std::vector
10
11
#include <
seqan3/core/debug_stream.hpp
>
12
#include <seqan3/test/tmp_filename.hpp>
13
14
// Written for std::vector, other types also work.
15
void
store(
std::vector<int16_t>
const
& data, seqan3::test::tmp_filename & tmp_file)
16
{
17
std::ofstream
os(tmp_file.get_path(), std::ios::binary);
// Where output should be stored.
18
cereal::BinaryOutputArchive archive(os);
// Create an ouput archive from the output stream.
19
archive(data);
// Store data.
20
}
21
22
int
main()
23
{
24
// The following example is for an std::vector but any seqan3 data structure that is documented as serialisable
25
// could be used, e.g. seqan3::fm_index.
26
seqan3::test::tmp_filename tmp_file{
"data.out"
};
// This is a temporary file, use any other filename.
27
28
std::vector<int16_t>
vec{1,2,3,4};
29
store(vec, tmp_file);
// Calls store on a std::vector.
30
31
return
0;
32
}
debug_stream.hpp
Provides seqan3::debug_stream and related types.
fstream
vector
std::ofstream
Version:
main_user
main_dev
3.4.0
3.3.0
3.2.0
3.1.0
3.0.3
3.0.2
3.0.1
3.0.0
doc
howto
use_cereal
store.hpp
Generated on Thu Dec 3 2020 18:58:17 for SeqAn3 by
1.8.20