Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F140258
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
11 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/base/serialization/immer-array.hpp b/src/base/serialization/immer-array.hpp
index ba13f8a..18519c5 100644
--- a/src/base/serialization/immer-array.hpp
+++ b/src/base/serialization/immer-array.hpp
@@ -1,74 +1,75 @@
/*
* Copyright (C) 2021 Tusooa Zhu <tusooa@kazv.moe>
*
* This file is part of libkazv.
*
* libkazv is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* libkazv is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with libkazv. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <libkazv-config.hpp>
#include <boost/serialization/nvp.hpp>
+#include <boost/serialization/split_free.hpp>
#include <immer/array.hpp>
#include <immer/array_transient.hpp>
namespace boost::serialization
{
template<class Archive,
class T,
class MP>
void save(Archive &ar, const immer::array<T, MP> &v, const unsigned int /* version */)
{
auto size = v.size();
ar << BOOST_SERIALIZATION_NVP(size);
for (const auto &i : v) {
ar << i;
}
}
template<class Archive,
class T,
class MP>
void load(Archive &ar, immer::array<T, MP> &v, const unsigned int /* version */)
{
using VecT = immer::array<T, MP>;
using TransientT = decltype(v.transient());
using SizeT = decltype(v.size());
using ValueT = typename VecT::value_type;
SizeT size{};
ar >> BOOST_SERIALIZATION_NVP(size);
TransientT transient = VecT(size).transient();
for (auto i = SizeT{}; i != size; ++i) {
ValueT val;
ar >> val;
transient.set(i, std::move(val));
}
v = transient.persistent();
}
template<class Archive,
class T,
class MP>
inline void serialize(Archive &ar, immer::array<T, MP> &v, const unsigned int version)
{
boost::serialization::split_free(ar, v, version);
}
}
diff --git a/src/base/serialization/immer-box.hpp b/src/base/serialization/immer-box.hpp
index 08ef479..5c123b8 100644
--- a/src/base/serialization/immer-box.hpp
+++ b/src/base/serialization/immer-box.hpp
@@ -1,53 +1,54 @@
/*
* Copyright (C) 2021 Tusooa Zhu <tusooa@kazv.moe>
*
* This file is part of libkazv.
*
* libkazv is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* libkazv is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with libkazv. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <libkazv-config.hpp>
#include <boost/serialization/nvp.hpp>
+#include <boost/serialization/split_free.hpp>
#include <immer/box.hpp>
namespace boost::serialization
{
template <class Archive, class T, class MP>
void save(Archive &ar, const immer::box<T, MP> &box, const unsigned int /* version */)
{
ar << box.get();
}
template <class Archive, class T, class MP>
void load(Archive &ar, immer::box<T, MP> &box, const unsigned int /* version */)
{
T val;
ar >> val;
box = val;
}
template<class Archive, class T, class MP>
inline void serialize(Archive &ar, immer::box<T, MP> &box, const unsigned int version)
{
boost::serialization::split_free(ar, box, version);
}
}
diff --git a/src/base/serialization/immer-flex-vector.hpp b/src/base/serialization/immer-flex-vector.hpp
index b82af72..78c45bf 100644
--- a/src/base/serialization/immer-flex-vector.hpp
+++ b/src/base/serialization/immer-flex-vector.hpp
@@ -1,80 +1,81 @@
/*
* Copyright (C) 2021 Tusooa Zhu <tusooa@kazv.moe>
*
* This file is part of libkazv.
*
* libkazv is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* libkazv is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with libkazv. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <libkazv-config.hpp>
#include <boost/serialization/nvp.hpp>
+#include <boost/serialization/split_free.hpp>
#include <immer/flex_vector.hpp>
#include <immer/flex_vector_transient.hpp>
namespace boost::serialization
{
template<class Archive,
class T,
class MP,
std::uint32_t B,
std::uint32_t BL>
void save(Archive &ar, const immer::flex_vector<T, MP, B, BL> &v, const unsigned int /* version */)
{
auto size = v.size();
ar << BOOST_SERIALIZATION_NVP(size);
for (const auto &i : v) {
ar << i;
}
}
template<class Archive,
class T,
class MP,
std::uint32_t B,
std::uint32_t BL>
void load(Archive &ar, immer::flex_vector<T, MP, B, BL> &v, const unsigned int /* version */)
{
using VecT = immer::flex_vector<T, MP, B, BL>;
using TransientT = decltype(v.transient());
using SizeT = decltype(v.size());
using ValueT = typename VecT::value_type;
SizeT size{};
ar >> BOOST_SERIALIZATION_NVP(size);
TransientT transient = VecT(size).transient();
for (auto i = SizeT{}; i != size; ++i) {
ValueT val;
ar >> val;
transient.set(i, std::move(val));
}
v = transient.persistent();
}
template<class Archive,
class T,
class MP,
std::uint32_t B,
std::uint32_t BL>
inline void serialize(Archive &ar, immer::flex_vector<T, MP, B, BL> &v, const unsigned int version)
{
boost::serialization::split_free(ar, v, version);
}
}
diff --git a/src/base/serialization/immer-map.hpp b/src/base/serialization/immer-map.hpp
index 0542bba..4b0b379 100644
--- a/src/base/serialization/immer-map.hpp
+++ b/src/base/serialization/immer-map.hpp
@@ -1,70 +1,71 @@
/*
* Copyright (C) 2021 Tusooa Zhu <tusooa@kazv.moe>
*
* This file is part of libkazv.
*
* libkazv is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* libkazv is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with libkazv. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <libkazv-config.hpp>
#include <boost/serialization/nvp.hpp>
+#include <boost/serialization/split_free.hpp>
#include <immer/map.hpp>
namespace boost::serialization
{
template <class Archive, class K, class T, class H, class E, class MP>
void save(Archive &ar, const immer::map<K, T, H, E, MP> &map, const unsigned int /* version */)
{
auto size = map.size();
ar << BOOST_SERIALIZATION_NVP(size);
for (const auto &[k, v] : map) {
ar << k << v;
}
}
template <class Archive, class K, class T, class H, class E, class MP>
void load(Archive &ar, immer::map<K, T, H, E, MP> &map, const unsigned int /* version */)
{
// map transient is not yet implemented
// using TransientT = decltype(v.transient());
using SizeT = decltype(map.size());
map = {};
SizeT size{};
ar >> BOOST_SERIALIZATION_NVP(size);
for (auto i = SizeT{}; i < size; ++i) {
K k;
T v;
ar >> k >> v;
map = std::move(map).set(std::move(k), std::move(v));
}
assert(size == map.size());
}
template<class Archive, class K, class T, class H, class E, class MP>
inline void serialize(Archive &ar, immer::map<K, T, H, E, MP> &m, const unsigned int version)
{
boost::serialization::split_free(ar, m, version);
}
}
diff --git a/src/base/serialization/std-optional.hpp b/src/base/serialization/std-optional.hpp
index 80d763f..67c1e8a 100644
--- a/src/base/serialization/std-optional.hpp
+++ b/src/base/serialization/std-optional.hpp
@@ -1,63 +1,64 @@
/*
* Copyright (C) 2021 Tusooa Zhu <tusooa@kazv.moe>
*
* This file is part of libkazv.
*
* libkazv is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* libkazv is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with libkazv. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <libkazv-config.hpp>
#include <boost/serialization/nvp.hpp>
+#include <boost/serialization/split_free.hpp>
#include <optional>
namespace boost::serialization
{
template<class Archive, class T>
void save(Archive &ar, const std::optional<T> &o, const unsigned int /* version */)
{
auto hasValue = o.has_value();
ar << BOOST_SERIALIZATION_NVP(hasValue);
if (hasValue) {
const auto &value = o.value();
ar << BOOST_SERIALIZATION_NVP(value);
}
}
template<class Archive, class T>
void load(Archive &ar, std::optional<T> &o, const unsigned int /* version */)
{
auto hasValue = bool{};
ar >> BOOST_SERIALIZATION_NVP(hasValue);
o.reset();
if (hasValue) {
T value;
ar >> BOOST_SERIALIZATION_NVP(value);
o = std::move(value);
}
}
template<class Archive,
class T>
inline void serialize(Archive &ar, std::optional<T> &o, const unsigned int version)
{
boost::serialization::split_free(ar, o, version);
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Jan 19, 3:58 PM (1 d, 4 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
55305
Default Alt Text
(11 KB)
Attached To
Mode
rL libkazv
Attached
Detach File
Event Timeline
Log In to Comment