OmniSciDB  b28c0d5765
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TargetMetaInfoSerializer.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
21 
22 namespace boost {
23 namespace serialization {
24 
25 template <class Archive>
26 void serialize(Archive&, TargetMetaInfo&, const unsigned int) {
27  // We will not serialize anything directly from TargetMetaInfo instances and instead
28  // serialize constructor data. This is handled in the save/load_construct_data functions
29  // below below. See:
30  // https://www.boost.org/doc/libs/1_74_0/libs/serialization/doc/serialization.html#constructors
31  // for more.
32  // We still need to provide this no-op method for compilation tho.
33 }
34 
35 template <class Archive>
36 inline void save_construct_data(Archive& ar,
37  const TargetMetaInfo* target_meta,
38  const unsigned int version) {
39  ar << target_meta->get_resname();
40  ar << target_meta->get_type_info();
41  ar << target_meta->get_physical_type_info();
42 }
43 
44 template <class Archive>
45 inline void load_construct_data(Archive& ar,
46  TargetMetaInfo* target_meta,
47  const unsigned int version) {
48  std::string resname;
49  SQLTypeInfo ti;
50  SQLTypeInfo physical_ti;
51  ar >> resname;
52  ar >> ti;
53  ar >> physical_ti;
54  ::new (target_meta) TargetMetaInfo(resname, ti, physical_ti);
55 }
56 
57 } // namespace serialization
58 } // namespace boost
const SQLTypeInfo & get_type_info() const
const SQLTypeInfo & get_physical_type_info() const
string version
Definition: setup.in.py:73
void serialize(Archive &ar, RegisteredQueryHint &query_hint, const unsigned int version)
const std::string & get_resname() const
void save_construct_data(Archive &ar, const ExplainedQueryHint *query_hint, const unsigned int version)
void load_construct_data(Archive &ar, ExplainedQueryHint *query_hint, const unsigned int version)