Alexandria  2.27.0
SDC-CH common library for the Euclid project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
serialize.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2021 Euclid Science Ground Segment
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License as published by the Free
6  * Software Foundation; either version 3.0 of the License, or (at your option)
7  * any later version.
8  *
9  * This library is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12  * details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #ifndef XYDATASET_SERIALIZE_H
20 #define XYDATASET_SERIALIZE_H
21 
23 #include <boost/serialization/string.hpp>
24 #include <boost/serialization/vector.hpp>
25 #include <string>
26 #include <vector>
27 
28 namespace boost {
29 namespace serialization {
30 
38 template <typename Archive>
39 void serialize(Archive&, Euclid::XYDataset::QualifiedName&, const unsigned int) {
40  // Nothing here. Everything is done in the constructor
41 }
42 
50 template <typename Archive>
51 void save_construct_data(Archive& ar, const Euclid::XYDataset::QualifiedName* t, const unsigned int) {
52  std::vector<std::string> groups = t->groups();
53  ar << groups;
54  std::string name = t->datasetName();
55  ar << name;
56 }
57 
65 template <typename Archive>
66 void load_construct_data(Archive& ar, Euclid::XYDataset::QualifiedName* t, const unsigned int) {
68  ar >> groups;
69  std::string name;
70  ar >> name;
71  ::new (t) Euclid::XYDataset::QualifiedName(std::move(groups), std::move(name));
72 }
73 
74 } // namespace serialization
75 } // namespace boost
76 
77 #endif // XYDATASET_SERIALIZE_H
void save_construct_data(Archive &ar, const Euclid::GridContainer::GridAxis< T > *t, const unsigned int)
Definition: GridAxis.h:69
STL class.
const std::string & datasetName() const
Returns the unqualified name.
void serialize(Archive &archive, std::array< CellType, ND > &array, const unsigned int)
Definition: array.h:37
T move(T...args)
void load_construct_data(Archive &ar, Euclid::GridContainer::GridAxis< T > *t, const unsigned int)
Definition: GridAxis.h:111
const std::vector< std::string > & groups() const
Returns the groups qualifying the name.
Represents a name qualified with a set of groups.
Definition: QualifiedName.h:66