File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55
66#include < nlohmann/json.hpp>
77
8+ #include < boost/serialization/export.hpp>
9+ #include < boost/serialization/optional.hpp>
10+ #include < boost/serialization/shared_ptr.hpp>
11+ #include < boost/serialization/vector.hpp>
12+
813#include " silo/preprocessing/preprocessing_exception.h"
914#include " silo/query_engine/batched_bitmap_reader.h"
1015
16+ BOOST_CLASS_EXPORT (silo::common::TreeNode)
17+
1118namespace silo ::common {
1219using silo::common::TreeNodeId;
1320
Original file line number Diff line number Diff line change @@ -22,6 +22,20 @@ class TreeNode {
2222
2323 bool isLeaf () { return children.empty (); }
2424 bool rowIndexExists () const { return row_index.has_value (); }
25+
26+ virtual ~TreeNode () = default ;
27+
28+ friend class boost ::serialization::access;
29+ template <class Archive >
30+ [[maybe_unused]] void serialize (Archive& archive, const uint32_t /* version */ ) {
31+ // clang-format off
32+ archive & node_id;
33+ archive & row_index;
34+ archive & children;
35+ archive & parent;
36+ archive & depth;
37+ // clang-format on
38+ }
2539};
2640
2741class PhyloTree {
@@ -50,6 +64,14 @@ class PhyloTree {
5064 roaring::Roaring getDescendants (const TreeNodeId& node_id);
5165
5266 roaring::Roaring getDescendants (const std::string& node_label);
67+
68+ friend class boost ::serialization::access;
69+ template <class Archive >
70+ [[maybe_unused]] void serialize (Archive& archive, const uint32_t /* version */ ) {
71+ // clang-format off
72+ archive & nodes;
73+ // clang-format on
74+ }
5375};
5476
5577} // namespace silo::common
Original file line number Diff line number Diff line change @@ -117,6 +117,7 @@ template <class Archive>
117117) {
118118 ar & object.column_name ;
119119 ar & object.dictionary ;
120+ ar & object.phylo_tree ;
120121}
121122} // namespace boost::serialization
122123
@@ -130,10 +131,18 @@ template <class Archive>
130131) {
131132 std::string column_name;
132133 silo::common::BidirectionalMap<std::string> dictionary;
134+ std::optional<silo::common::PhyloTree> phylo_tree;
133135 ar & column_name;
134136 ar & dictionary;
135- object = std::make_shared<silo::storage::column::StringColumnMetadata>(
136- column_name, std::move (dictionary)
137- );
137+ ar & phylo_tree;
138+ if (phylo_tree.has_value ()) {
139+ object = std::make_shared<silo::storage::column::StringColumnMetadata>(
140+ std::move (column_name), std::move (dictionary), std::move (phylo_tree.value ())
141+ );
142+ } else {
143+ object = std::make_shared<silo::storage::column::StringColumnMetadata>(
144+ std::move (column_name), std::move (dictionary)
145+ );
146+ }
138147}
139148} // namespace boost::serialization
You can’t perform that action at this time.
0 commit comments