isce3  0.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
Serialization.h
1 //-*- C++ -*-
2 //-*- coding: utf-8 -*-
3 //
4 // Author: Bryan V. Riel
5 // Copyright 2017-2018
6 
7 #pragma once
8 
9 #include <iostream>
10 #include <memory>
11 #include <cereal/types/memory.hpp>
12 #include <cereal/archives/xml.hpp>
13 
14 #include <isce3/geometry/Topo.h>
15 #include <isce3/geometry/Geo2rdr.h>
16 
17 namespace isce3 {
18  namespace geometry {
19 
20  // Main template call for archiving any isce3::geometry object
21  template <typename T>
22  void load_archive(std::string metadata, char * objectTag, T * object) {
23  std::stringstream metastream;
24  metastream << metadata;
25  cereal::XMLInputArchive archive(metastream);
26  archive(cereal::make_nvp(objectTag, (*object)));
27  }
28 
29  // ----------------------------------------------------------------------
30  // Serialization for Topo
31  // ----------------------------------------------------------------------
32 
33  // Topo save does nothing
34  template <class Archive>
35  void save(Archive &, const Topo &) {}
36 
37  // Topo load
38  template <class Archive>
39  void load(Archive & archive, Topo & topo) {
40 
41  // Deserialize scalar values
42  double threshold;
43  int epsgOut;
44  size_t numiter, extraiter;
46  archive(cereal::make_nvp("threshold", threshold),
47  cereal::make_nvp("numIterations", numiter),
48  cereal::make_nvp("extraIterations", extraiter),
49  cereal::make_nvp("demMethod", demMethod),
50  cereal::make_nvp("epsgOut", epsgOut));
51 
52  // Send to Topo setters
53  topo.threshold(threshold);
54  topo.numiter(numiter);
55  topo.extraiter(extraiter);
56  topo.demMethod(demMethod);
57  topo.epsgOut(epsgOut);
58  }
59 
60  // ----------------------------------------------------------------------
61  // Serialization for Geo2rdr
62  // ----------------------------------------------------------------------
63 
64  // Geo2rdr save does nothing
65  template <class Archive>
66  void save(Archive &, const Geo2rdr &) {}
67 
68  // Geo2rdr load
69  template <class Archive>
70  void load(Archive & archive, Geo2rdr & geo) {
71 
72  // Deserialize scalar values
73  double threshold;
74  size_t numiter;
75  archive(cereal::make_nvp("threshold", threshold),
76  cereal::make_nvp("numIterations", numiter));
77 
78  // Send to Geo2rdr setters
79  geo.threshold(threshold);
80  geo.numiter(numiter);
81  }
82 
83  }
84 }
dataInterpMethod
Enumeration type to indicate interpolation method.
Definition: Constants.h:23

Generated for ISCE3.0 by doxygen 1.8.5.