← Documentation
ADS-IDAC Engine 5.0.0
PanelOverlayIO.h
Go to the documentation of this file.
1#pragma once
8#include <cstdint>
9#include <memory>
10#include <stdexcept>
11#include <vector>
12
13namespace adsidac {
14
15template <class Archive, class T>
16void save_array_state(Archive& ar, const std::vector<std::unique_ptr<T>>& v) {
17 const uint32_t n = static_cast<uint32_t>(v.size());
18 ar & n;
19 for (const auto& e : v)
20 ar & *e;
21}
22
23template <class Archive, class T>
24void load_array_state(Archive& ar, std::vector<std::unique_ptr<T>>& v,
25 const char* what) {
26 uint32_t n = 0;
27 ar & n;
28 if (n != v.size())
29 throw std::runtime_error(std::string("panel state overlay: ") + what
30 + " count mismatch against the seeded panel");
31 for (auto& e : v)
32 ar & *e;
33}
34
35} // namespace adsidac
document e
void load_array_state(Archive &ar, std::vector< std::unique_ptr< T > > &v, const char *what)
void save_array_state(Archive &ar, const std::vector< std::unique_ptr< T > > &v)