diff --git a/CMakeLists.txt b/CMakeLists.txt index c2787652..63df2d35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,7 +56,7 @@ configure_ccache() # Boost configure_boost() -find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS serialization) +find_package(Boost ${BOOST_MIN_VERSION} REQUIRED) include_directories(${Boost_INCLUDE_DIRS}) ############################################################## diff --git a/Config.cmake.in b/Config.cmake.in index b4b92ee2..361a21be 100644 --- a/Config.cmake.in +++ b/Config.cmake.in @@ -9,7 +9,7 @@ include("${CMAKE_CURRENT_LIST_DIR}/cmake/configure_boost.cmake") include(CMakeFindDependencyMacro) configure_boost() -find_dependency(Boost ${BOOST_MIN_VERSION} COMPONENTS serialization) +find_dependency(Boost ${BOOST_MIN_VERSION} REQUIRED) ############ diff --git a/api/python/CMakeLists.txt b/api/python/CMakeLists.txt index 31fe26e0..66a8b965 100644 --- a/api/python/CMakeLists.txt +++ b/api/python/CMakeLists.txt @@ -7,7 +7,6 @@ target_sources(_dlplan src/generator.cpp src/novelty.cpp src/policy.cpp - src/serialization.cpp src/state_space.cpp) target_link_libraries(_dlplan PRIVATE @@ -16,6 +15,5 @@ target_link_libraries(_dlplan dlplangenerator dlplannovelty dlplanpolicy - dlplanserialization dlplanstatespace) target_compile_definitions(_dlplan PUBLIC DLPLAN_VERSION_INFO="${DLPLAN_VERSION_INFO}") diff --git a/api/python/src/dlplan/__init__.py b/api/python/src/dlplan/__init__.py index c2aad1cc..e69de29b 100644 --- a/api/python/src/dlplan/__init__.py +++ b/api/python/src/dlplan/__init__.py @@ -1,2 +0,0 @@ -# For backward compatibility -# from _dlplan import * diff --git a/api/python/src/dlplan/policy/__init__.py b/api/python/src/dlplan/policy/__init__.py index 9310c4aa..78c7e48f 100644 --- a/api/python/src/dlplan/policy/__init__.py +++ b/api/python/src/dlplan/policy/__init__.py @@ -1,3 +1,3 @@ -from _dlplan import NamedBaseElement, NamedBoolean, NamedNumerical, NamedConcept, NamedRole, \ +from _dlplan import NamedBoolean, NamedNumerical, NamedConcept, NamedRole, \ BaseCondition, BaseEffect, Rule, Policy, PolicyFactory, \ PolicyMinimizer \ No newline at end of file diff --git a/api/python/src/dlplan/policy/__init__.pyi b/api/python/src/dlplan/policy/__init__.pyi index 7feb1e26..ecf406af 100644 --- a/api/python/src/dlplan/policy/__init__.pyi +++ b/api/python/src/dlplan/policy/__init__.pyi @@ -3,25 +3,32 @@ from typing import List, Overload, Union, MutableSet, Tuple from ..core import State, DenotationsCaches, Boolean, Numerical, Concept, Role, SyntacticElementFactory -class NamedBaseElement: + +class NamedBoolean(): def __repr__(self) -> str: ... def __str__(self) -> str: ... def get_key(self) -> str: ... - - -class NamedBoolean(NamedBaseElement): def get_boolean(self) -> Boolean: ... -class NamedNumerical(NamedBaseElement): +class NamedNumerical(): + def __repr__(self) -> str: ... + def __str__(self) -> str: ... + def get_key(self) -> str: ... def get_numerical(self) -> Numerical: ... -class NamedConcept(NamedBaseElement): +class NamedConcept(): + def __repr__(self) -> str: ... + def __str__(self) -> str: ... + def get_key(self) -> str: ... def get_concept(self) -> Concept: ... -class NamedRole(NamedBaseElement): +class NamedRole(): + def __repr__(self) -> str: ... + def __str__(self) -> str: ... + def get_key(self) -> str: ... def get_role(self) -> Role: ... diff --git a/api/python/src/dlplan/serialization/__init__.py b/api/python/src/dlplan/serialization/__init__.py deleted file mode 100644 index 10fdde21..00000000 --- a/api/python/src/dlplan/serialization/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from _dlplan import Data, serialize, deserialize diff --git a/api/python/src/dlplan/serialization/__init__.pyi b/api/python/src/dlplan/serialization/__init__.pyi deleted file mode 100644 index ab8209b5..00000000 --- a/api/python/src/dlplan/serialization/__init__.pyi +++ /dev/null @@ -1,24 +0,0 @@ -from enum import Enum - -from typing import Dict - -from ..core import DenotationsCaches, VocabularyInfo, InstanceInfo, SyntacticElementFactory -from ..novelty import TupleGraph -from ..policy import Policy, PolicyBuilder -from ..state_space import StateSpace - - -class Data: - vocabulary_infos: Dict[str, VocabularyInfo] - instance_infos: Dict[str, InstanceInfo] - syntactic_element_factories: Dict[str, SyntacticElementFactory] - denotations_caches: Dict[str, DenotationsCaches] - state_spaces: Dict[str, StateSpace] - tuple_graphs: Dict[str, TupleGraph] - policies: Dict[str, Policy] - policy_builders: Dict[str, PolicyBuilder] - def __init__(self) -> None: ... - -def serialize(data: Data) -> str: ... - -def deserialize(text: str) -> Data: ... diff --git a/api/python/src/main.cpp b/api/python/src/main.cpp index 2d2da7f9..066006d0 100644 --- a/api/python/src/main.cpp +++ b/api/python/src/main.cpp @@ -10,7 +10,6 @@ void init_core(py::module_ &); void init_generator(py::module_ &); void init_novelty(py::module_ &); void init_policy(py::module_ &); -void init_serialization(py::module_ &); void init_state_space(py::module_ &); PYBIND11_MODULE(_dlplan, m) { @@ -20,14 +19,12 @@ PYBIND11_MODULE(_dlplan, m) { py::module_ m_generator = m.def_submodule("generator", "The generator submodule."); py::module_ m_novelty = m.def_submodule("novelty", "The novelty submodule."); py::module_ m_policy = m.def_submodule("policy", "The policy submodule."); - py::module_ m_serialization = m.def_submodule("serialization", "The serialization submodule."); py::module_ m_state_space = m.def_submodule("state_space", "The state_space submodule."); init_core(m); init_generator(m); init_novelty(m); init_policy(m); - init_serialization(m); init_state_space(m); #ifdef VERSION_INFO diff --git a/api/python/src/policy.cpp b/api/python/src/policy.cpp index 070524dd..05179bd9 100644 --- a/api/python/src/policy.cpp +++ b/api/python/src/policy.cpp @@ -15,25 +15,31 @@ using namespace dlplan; void init_policy(py::module_ &m_policy) { - py::class_>(m_policy, "NamedBaseElement") - .def("__repr__", &policy::NamedBaseElement::compute_repr) - .def("__str__", &policy::NamedBaseElement::str) - .def("get_key", &policy::NamedBaseElement::get_key) - ; - - py::class_>(m_policy, "NamedBoolean") + py::class_>(m_policy, "NamedBoolean") + .def("__repr__", &policy::NamedBoolean::compute_repr) + .def("__str__", &policy::NamedBoolean::str) + .def("get_key", &policy::NamedBoolean::get_key) .def("get_boolean", &policy::NamedBoolean::get_boolean) ; - py::class_>(m_policy, "NamedNumerical") + py::class_>(m_policy, "NamedNumerical") + .def("__repr__", &policy::NamedNumerical::compute_repr) + .def("__str__", &policy::NamedNumerical::str) + .def("get_key", &policy::NamedNumerical::get_key) .def("get_numerical", &policy::NamedNumerical::get_numerical) ; - py::class_>(m_policy, "NamedConcept") + py::class_>(m_policy, "NamedConcept") + .def("__repr__", &policy::NamedConcept::compute_repr) + .def("__str__", &policy::NamedConcept::str) + .def("get_key", &policy::NamedConcept::get_key) .def("get_concept", &policy::NamedConcept::get_concept) ; - py::class_>(m_policy, "NamedRole") + py::class_>(m_policy, "NamedRole") + .def("__repr__", &policy::NamedRole::compute_repr) + .def("__str__", &policy::NamedRole::str) + .def("get_key", &policy::NamedRole::get_key) .def("get_role", &policy::NamedRole::get_role) ; diff --git a/api/python/src/serialization.cpp b/api/python/src/serialization.cpp deleted file mode 100644 index dc79a9bb..00000000 --- a/api/python/src/serialization.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include // Necessary for automatic conversion of e.g. std::vectors -#include -#include -#include // everything needed for embedding - -#define STRINGIFY(x) #x -#define MACRO_STRINGIFY(x) STRINGIFY(x) - -#include "../../../include/dlplan/serialization.h" -#include "../../../include/dlplan/state_space.h" - -#include - -namespace py = pybind11; - -using namespace dlplan::serialization; - - -void init_serialization(py::module_ &m_serialization) { - py::class_(m_serialization, "Data") - .def(py::init<>()) - .def_readwrite("vocabulary_infos", &Data::vocabulary_infos) - .def_readwrite("instance_infos", &Data::instance_infos) - .def_readwrite("syntactic_element_factories", &Data::syntatic_element_factories) - .def_readwrite("denotations_caches", &Data::denotations_caches) - .def_readwrite("state_spaces", &Data::state_spaces) - .def_readwrite("tuple_graphs", &Data::tuple_graphs) - .def_readwrite("policies", &Data::policies) - .def_readwrite("policy_factories", &Data::policy_factories) - ; - - m_serialization.def("serialize", [](const Data& data){ - std::stringstream buffer; - serialize(data, buffer); - return buffer.str(); - }); - - m_serialization.def("deserialize", [](const std::string& text){ - std::stringstream buffer(text); - return deserialize(buffer); - }); -} diff --git a/api/python/tests/serialization/__init__.py b/api/python/tests/serialization/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/api/python/tests/serialization/gripper/domain.pddl b/api/python/tests/serialization/gripper/domain.pddl deleted file mode 100644 index 20f8f284..00000000 --- a/api/python/tests/serialization/gripper/domain.pddl +++ /dev/null @@ -1,35 +0,0 @@ -(define (domain gripper-strips) - (:constants rooma roomb) - (:predicates (room ?r) - (ball ?b) - (gripper ?g) - (at-robby ?r) - (at ?b ?r) - (free ?g) - (carry ?o ?g)) - - (:action move - :parameters (?from ?to) - :precondition (and (room ?from) (room ?to) (at-robby ?from)) - :effect (and (at-robby ?to) - (not (at-robby ?from)))) - - - - (:action pick - :parameters (?obj ?room ?gripper) - :precondition (and (ball ?obj) (room ?room) (gripper ?gripper) - (at ?obj ?room) (at-robby ?room) (free ?gripper)) - :effect (and (carry ?obj ?gripper) - (not (at ?obj ?room)) - (not (free ?gripper)))) - - - (:action drop - :parameters (?obj ?room ?gripper) - :precondition (and (ball ?obj) (room ?room) (gripper ?gripper) - (carry ?obj ?gripper) (at-robby ?room)) - :effect (and (at ?obj ?room) - (free ?gripper) - (not (carry ?obj ?gripper))))) - diff --git a/api/python/tests/serialization/gripper/p-1-0.pddl b/api/python/tests/serialization/gripper/p-1-0.pddl deleted file mode 100644 index 1ac2c116..00000000 --- a/api/python/tests/serialization/gripper/p-1-0.pddl +++ /dev/null @@ -1,25 +0,0 @@ - - - -(define (problem gripper-1) -(:domain gripper-strips) -(:objects left right ball1 ) -(:init -(room rooma) -(room roomb) -(gripper left) -(gripper right) -(ball ball1) -(free left) -(free right) -(at ball1 rooma) -(at-robby rooma) -) -(:goal -(and -(at ball1 roomb) -) -) -) - - diff --git a/api/python/tests/serialization/gripper/p-2-0.pddl b/api/python/tests/serialization/gripper/p-2-0.pddl deleted file mode 100644 index fbce5269..00000000 --- a/api/python/tests/serialization/gripper/p-2-0.pddl +++ /dev/null @@ -1,28 +0,0 @@ - - - -(define (problem gripper-2) -(:domain gripper-strips) -(:objects left right ball1 ball2 ) -(:init -(room rooma) -(room roomb) -(gripper left) -(gripper right) -(ball ball1) -(ball ball2) -(free left) -(free right) -(at ball1 rooma) -(at ball2 rooma) -(at-robby rooma) -) -(:goal -(and -(at ball1 roomb) -(at ball2 roomb) -) -) -) - - diff --git a/api/python/tests/serialization/gripper/test_gripper.py b/api/python/tests/serialization/gripper/test_gripper.py deleted file mode 100644 index 3aedfc4f..00000000 --- a/api/python/tests/serialization/gripper/test_gripper.py +++ /dev/null @@ -1,114 +0,0 @@ -from pathlib import Path - -from dlplan.core import SyntacticElementFactory, DenotationsCaches -from dlplan.novelty import NoveltyBase, TupleGraph -from dlplan.policy import PolicyFactory -from dlplan.serialization import Data, serialize, deserialize -from dlplan.state_space import generate_state_space - -HERE = Path(__file__).resolve().parent - - -def test_serialization_gripper(): - result_1 = generate_state_space(str(HERE / "domain.pddl"), str(HERE / "p-1-0.pddl"), None, 0) - result_2 = generate_state_space(str(HERE / "domain.pddl"), str(HERE / "p-2-0.pddl"), result_1.state_space.get_instance_info().get_vocabulary_info(), 1) - - # StateSpace - out_data = Data() - out_data.state_spaces = { - "0": result_1.state_space, - "1": result_2.state_space - } - - # TupleGraph - novelty_base_1 = NoveltyBase(len(result_1.state_space.get_instance_info().get_atoms()), 1) - novelty_base_2 = NoveltyBase(len(result_2.state_space.get_instance_info().get_atoms()), 1) - tuple_graphs = { - str(result_1.state_space.get_instance_info().get_index()) + "_" + str(s_idx): TupleGraph(novelty_base_1, result_1.state_space, s_idx) \ - for s_idx, state in result_1.state_space.get_states().items() - } - tuple_graphs.update({ - str(result_2.state_space.get_instance_info().get_index()) + "_" + str(s_idx): TupleGraph(novelty_base_2, result_2.state_space, s_idx) \ - for s_idx, state in result_2.state_space.get_states().items() - }) - out_data.tuple_graphs = tuple_graphs - - # VocabularyInfo - vocabulary_infos = { - "0": result_1.state_space.get_instance_info().get_vocabulary_info(), - "1": result_2.state_space.get_instance_info().get_vocabulary_info() - } - out_data.vocabulary_infos = vocabulary_infos - - # InstanceData - instance_infos = { - "0": result_1.state_space.get_instance_info(), - "1": result_2.state_space.get_instance_info() - } - out_data.instance_infos = instance_infos - - # SyntacticElementFactory - element_factory = SyntacticElementFactory(result_1.state_space.get_instance_info().get_vocabulary_info()) - numerical = element_factory.parse_numerical("n_count(c_primitive(free, 0))") - boolean = element_factory.parse_boolean("b_empty(r_and(r_primitive(at, 0, 1), r_primitive(at_g, 0, 1)))"); - syntactic_element_factories = { - "0": element_factory - } - out_data.syntactic_element_factories = syntactic_element_factories - - # PolicyBuilder - policy_factory = PolicyFactory(element_factory) - named_numerical = policy_factory.make_numerical("n0", numerical) - named_boolean = policy_factory.make_boolean("b0", boolean) - c_n_gt = policy_factory.make_gt_condition(named_numerical) - e_n_dec = policy_factory.make_dec_effect(named_numerical) - c_b_pos = policy_factory.make_pos_condition(named_boolean) - e_b_neg = policy_factory.make_neg_effect(named_boolean) - rule_1 = policy_factory.make_rule({c_n_gt}, {e_n_dec}) - rule_2 = policy_factory.make_rule({c_b_pos}, {e_b_neg}) - policy = policy_factory.make_policy({rule_1, rule_2}) - policy_factories = { - "0": policy_factory - } - out_data.policy_factories = policy_factories - - # Policy - policies = { - "0": policy - } - out_data.policies = policies - - # DenotationsCaches - denotations_caches_1 = DenotationsCaches() - denotations_caches_2 = DenotationsCaches() - for s_idx, state in result_1.state_space.get_states().items(): - numerical.evaluate(state, denotations_caches_1) - for s_idx, state in result_2.state_space.get_states().items(): - numerical.evaluate(state, denotations_caches_2) - denotations_caches = { - "0": denotations_caches_1, - "1": denotations_caches_2 - } - out_data.denotations_caches = denotations_caches - - text = serialize(out_data) - in_data = deserialize(text) - assert len(in_data.state_spaces) == 2 - assert id(in_data.state_spaces["0"].get_instance_info()) != id(in_data.state_spaces["1"].get_instance_info()) - assert id(in_data.state_spaces["0"].get_instance_info().get_vocabulary_info()) == id(in_data.state_spaces["1"].get_instance_info().get_vocabulary_info()) - - assert len(in_data.tuple_graphs) == len(result_1.state_space.get_states()) + len(result_2.state_space.get_states()) - assert in_data.tuple_graphs["0_0"] is not None - assert in_data.tuple_graphs["1_0"] is not None - - assert len(in_data.vocabulary_infos) == 2 - assert in_data.vocabulary_infos["0"] == in_data.vocabulary_infos["1"] - - assert len(in_data.instance_infos) == 2 - assert in_data.instance_infos["0"] != in_data.instance_infos["1"] - - assert len(in_data.denotations_caches) == 2 - - assert len(in_data.policies) == 1 - - assert len(in_data.policy_factories) == 1 \ No newline at end of file diff --git a/api/python/tests/serialization/test_serialization.py b/api/python/tests/serialization/test_serialization.py deleted file mode 100644 index 37b825bd..00000000 --- a/api/python/tests/serialization/test_serialization.py +++ /dev/null @@ -1,9 +0,0 @@ -from dlplan.serialization import Data, serialize, deserialize - - -def test_serialization_empty(): - out_data = Data() - text = serialize(out_data) - in_data = deserialize(text) - assert in_data.state_spaces == {} - assert in_data.tuple_graphs == {} diff --git a/include/dlplan/core/elements/booleans/empty.h b/include/dlplan/core/elements/booleans/empty.h index d4177ccd..6508879c 100644 --- a/include/dlplan/core/elements/booleans/empty.h +++ b/include/dlplan/core/elements/booleans/empty.h @@ -4,12 +4,6 @@ #include "../../../../../src/core/elements/utils.h" #include "../../../core.h" -#include -#include -#include -#include -#include - #include #include @@ -21,28 +15,6 @@ template class ReferenceCountedObjectFactory; } -namespace dlplan::core { -template -class EmptyBoolean; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::core::EmptyBoolean& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::EmptyBoolean* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::EmptyBoolean* t, const unsigned int version); - - template - void serialize(Archive& ar, std::pair, std::weak_ptr>>& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const std::pair, std::weak_ptr>>* t, const unsigned int version); - template - void load_construct_data(Archive& ar, std::pair, std::weak_ptr>>* t, const unsigned int version); -} - namespace dlplan::core { template @@ -82,12 +54,6 @@ class EmptyBoolean : public Boolean { : Boolean(vocabulary_info, index, element->is_static()), m_element(element) { } - template - friend void boost::serialization::serialize(Archive& ar, EmptyBoolean& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive & ar, const EmptyBoolean* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive & ar, EmptyBoolean* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -137,61 +103,6 @@ class EmptyBoolean : public Boolean { } -namespace boost::serialization { -template -void serialize(Archive& /*ar*/, dlplan::core::EmptyBoolean& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& ar, const dlplan::core::EmptyBoolean* t, const unsigned int /* version */ ) -{ - ar << t->m_index; - ar << t->m_vocabulary_info; - ar << t->m_element; -} - -template -void load_construct_data(Archive& ar, dlplan::core::EmptyBoolean* t, const unsigned int /* version */ ) -{ - int index; - std::shared_ptr vocabulary; - std::shared_ptr element; - ar >> index; - ar >> vocabulary; - ar >> element; - ::new(t)dlplan::core::EmptyBoolean(index, vocabulary, element); -} - - -template -void serialize(Archive& /*ar*/, std::pair, std::weak_ptr>>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair, std::weak_ptr>>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair, std::weak_ptr>>* t, const unsigned int /*version*/) { - dlplan::core::EmptyBoolean* first = nullptr; - std::weak_ptr>* second = nullptr; - ar >> const_cast&>(*first); - ar >> second; - ::new(t)std::pair, std::weak_ptr>>(*first, *second); - delete first; - delete second; -} - -} - -BOOST_CLASS_EXPORT_KEY2(dlplan::core::EmptyBoolean, "dlplan::core::EmptyBoolean") -BOOST_CLASS_EXPORT_KEY2(dlplan::core::EmptyBoolean, "dlplan::core::EmptyBoolean") - - namespace std { template struct less>> diff --git a/include/dlplan/core/elements/booleans/inclusion.h b/include/dlplan/core/elements/booleans/inclusion.h index a6f7fcf4..94280cfb 100644 --- a/include/dlplan/core/elements/booleans/inclusion.h +++ b/include/dlplan/core/elements/booleans/inclusion.h @@ -4,12 +4,6 @@ #include "../../../../../src/core/elements/utils.h" #include "../../../core.h" -#include -#include -#include -#include -#include - #include #include @@ -22,29 +16,6 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::core { -template -class InclusionBoolean; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::core::InclusionBoolean& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::InclusionBoolean* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::InclusionBoolean* t, const unsigned int version); - - template - void serialize(Archive& ar, std::pair, std::weak_ptr>>& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const std::pair, std::weak_ptr>>* t, const unsigned int version); - template - void load_construct_data(Archive& ar, std::pair, std::weak_ptr>>* t, const unsigned int version); -} - - namespace dlplan::core { template class InclusionBoolean : public Boolean { @@ -89,12 +60,6 @@ class InclusionBoolean : public Boolean { m_element_right(element_right) { } - template - friend void boost::serialization::serialize(Archive& ar, InclusionBoolean& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const InclusionBoolean* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, InclusionBoolean* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -149,65 +114,6 @@ class InclusionBoolean : public Boolean { } - -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::InclusionBoolean& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& ar, const dlplan::core::InclusionBoolean* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; - ar << t->m_element_left; - ar << t->m_element_right; -} - -template -void load_construct_data(Archive& ar, dlplan::core::InclusionBoolean* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - std::shared_ptr element_left; - std::shared_ptr element_right; - ar >> vocabulary; - ar >> index; - ar >> element_left; - ar >> element_right; - ::new(t)dlplan::core::InclusionBoolean(index, vocabulary, element_left, element_right); -} - - -template -void serialize(Archive& /*ar*/, std::pair, std::weak_ptr>>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair, std::weak_ptr>>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair, std::weak_ptr>>* t, const unsigned int /*version*/) { - dlplan::core::InclusionBoolean* first = nullptr; - std::weak_ptr>* second = nullptr; - ar >> const_cast&>(*first); - ar >> second; - ::new(t)std::pair, std::weak_ptr>>(*first, *second); - delete first; - delete second; -} - -} - -BOOST_CLASS_EXPORT_KEY2(dlplan::core::InclusionBoolean, "dlplan::core::InclusionBoolean") -BOOST_CLASS_EXPORT_KEY2(dlplan::core::InclusionBoolean, "dlplan::core::InclusionBoolean") - - namespace std { template struct less>> diff --git a/include/dlplan/core/elements/booleans/nullary.h b/include/dlplan/core/elements/booleans/nullary.h index 5e094e29..497933a8 100644 --- a/include/dlplan/core/elements/booleans/nullary.h +++ b/include/dlplan/core/elements/booleans/nullary.h @@ -4,8 +4,6 @@ #include "../../../../../src/core/elements/utils.h" #include "../../../core.h" -#include - #include #include @@ -18,28 +16,6 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::core { -class NullaryBoolean; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::core::NullaryBoolean& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::NullaryBoolean* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::NullaryBoolean* t, const unsigned int version); - - template - void serialize(Archive& ar, std::pair>& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int version); - template - void load_construct_data(Archive& ar, std::pair>* t, const unsigned int version); -} - - namespace dlplan::core { class NullaryBoolean : public Boolean { private: @@ -54,12 +30,6 @@ class NullaryBoolean : public Boolean { NullaryBoolean(ElementIndex index, std::shared_ptr vocabulary_info, const Predicate& predicate); - template - friend void boost::serialization::serialize(Archive& ar, NullaryBoolean& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const NullaryBoolean* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, NullaryBoolean* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -79,8 +49,6 @@ class NullaryBoolean : public Boolean { } -BOOST_CLASS_EXPORT_KEY2(dlplan::core::NullaryBoolean, "dlplan::core::NullaryBoolean") - namespace std { template<> diff --git a/include/dlplan/core/elements/concepts/all.h b/include/dlplan/core/elements/concepts/all.h index 2146360f..4baa4db1 100644 --- a/include/dlplan/core/elements/concepts/all.h +++ b/include/dlplan/core/elements/concepts/all.h @@ -4,8 +4,6 @@ #include "../../../../../src/core/elements/utils.h" #include "../../../core.h" -#include - #include #include @@ -18,28 +16,6 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::core { -class AllConcept; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::core::AllConcept& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::AllConcept* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::AllConcept* t, const unsigned int version); - - template - void serialize(Archive& ar, std::pair>& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int version); - template - void load_construct_data(Archive& ar, std::pair>* t, const unsigned int version); -} - - namespace dlplan::core { class AllConcept : public Concept { private: @@ -54,12 +30,6 @@ class AllConcept : public Concept { AllConcept(ElementIndex index, std::shared_ptr vocabulary_info, std::shared_ptr role, std::shared_ptr concept); - template - friend void boost::serialization::serialize(Archive& ar, AllConcept& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const AllConcept* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, AllConcept* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -79,8 +49,6 @@ class AllConcept : public Concept { } -BOOST_CLASS_EXPORT_KEY2(dlplan::core::AllConcept, "dlplan::core::AllConcept") - namespace std { template<> diff --git a/include/dlplan/core/elements/concepts/and.h b/include/dlplan/core/elements/concepts/and.h index 52985ddb..57ac5e33 100644 --- a/include/dlplan/core/elements/concepts/and.h +++ b/include/dlplan/core/elements/concepts/and.h @@ -4,8 +4,6 @@ #include "../../../../../src/core/elements/utils.h" #include "../../../core.h" -#include - #include #include @@ -18,27 +16,6 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::core { -class AndConcept; -} - - -namespace boost::serialization { - class access; - template - void serialize(Archive& ar, dlplan::core::AndConcept& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::AndConcept* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::AndConcept* t, const unsigned int version); - - template - void serialize(Archive& ar, std::pair>& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int version); - template - void load_construct_data(Archive& ar, std::pair>* t, const unsigned int version); -} namespace dlplan::core { @@ -54,12 +31,7 @@ class AndConcept : public Concept { ConceptDenotations evaluate_impl(const States& states, DenotationsCaches& caches) const override; AndConcept(ElementIndex index, std::shared_ptr vocabulary_info, std::shared_ptr concept_1, std::shared_ptr concept_2); - template - friend void boost::serialization::serialize(Archive& ar, AndConcept& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const AndConcept* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, AndConcept* t, const unsigned int version); + template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -79,8 +51,6 @@ class AndConcept : public Concept { } -BOOST_CLASS_EXPORT_KEY2(dlplan::core::AndConcept, "dlplan::core::AndConcept") - namespace std { template<> diff --git a/include/dlplan/policy.h b/include/dlplan/policy.h index 356ef5e4..a26b831e 100644 --- a/include/dlplan/policy.h +++ b/include/dlplan/policy.h @@ -35,83 +35,6 @@ class ReferenceCountedObjectFactory; } -// Forward declarations of template spezializations for serialization -namespace boost::serialization { - class access; - - template - void serialize(Archive& ar, dlplan::policy::NamedBoolean& t, const unsigned int version); - template - void serialize(Archive& ar, std::pair>& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int version); - template - void load_construct_data(Archive& ar, std::pair>* t, const unsigned int version); - - template - void serialize(Archive& ar, dlplan::policy::NamedNumerical& t, const unsigned int version); - template - void serialize(Archive& ar, std::pair>& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int version); - template - void load_construct_data(Archive& ar, std::pair>* t, const unsigned int version); - - template - void serialize(Archive& ar, dlplan::policy::NamedConcept& t, const unsigned int version); - template - void serialize(Archive& ar, std::pair>& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int version); - template - void load_construct_data(Archive& ar, std::pair>* t, const unsigned int version); - - template - void serialize(Archive& ar, dlplan::policy::NamedRole& t, const unsigned int version); - template - void serialize(Archive& ar, std::pair>& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int version); - template - void load_construct_data(Archive& ar, std::pair>* t, const unsigned int version); - - template - void serialize(Archive& ar, dlplan::policy::BaseCondition& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::policy::BaseCondition* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::policy::BaseCondition* t, const unsigned int version); - - template - void serialize(Archive& ar, dlplan::policy::BaseEffect& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::policy::BaseEffect* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::policy::BaseEffect* t, const unsigned int version); - - template - void serialize(Archive& ar, dlplan::policy::Rule& t, const unsigned int version); - template - void serialize(Archive& ar, std::pair>& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int version); - template - void load_construct_data(Archive& ar, std::pair>* t, const unsigned int version); - - template - void serialize(Archive& ar, dlplan::policy::Policy& t, const unsigned int version); - template - void serialize(Archive& ar, std::pair>& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int version); - template - void load_construct_data(Archive& ar, std::pair>* t, const unsigned int version); - - template - void serialize(Archive& ar, dlplan::policy::PolicyFactory& t, const unsigned int version); -} - - namespace dlplan::policy { /// @brief Sort elements in policy by their evaluate time score. /// @tparam T @@ -148,14 +71,8 @@ class NamedBoolean { std::string m_key; std::shared_ptr m_boolean; - /// @brief Constructor for serialization. - NamedBoolean(); - NamedBoolean(int identifier, const std::string& key, std::shared_ptr boolean); - friend class boost::serialization::access; - template - friend void boost::serialization::serialize(Archive& ar, NamedBoolean& t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -186,14 +103,8 @@ class NamedNumerical { std::string m_key; std::shared_ptr m_numerical; - /// @brief Constructor for serialization. - NamedNumerical(); - NamedNumerical(int identifier, const std::string& key, std::shared_ptr numerical); - friend class boost::serialization::access; - template - friend void boost::serialization::serialize(Archive& ar, NamedNumerical& t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -224,14 +135,8 @@ class NamedConcept { std::string m_key; std::shared_ptr m_concept; - /// @brief Constructor for serialization. - NamedConcept(); - NamedConcept(int identifier, const std::string& key, std::shared_ptr concept); - friend class boost::serialization::access; - template - friend void boost::serialization::serialize(Archive& ar, NamedConcept& t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -262,14 +167,8 @@ class NamedRole { std::string m_key; std::shared_ptr m_role; - /// @brief Constructor for serialization. - NamedRole(); - NamedRole(int identifier, const std::string& key, std::shared_ptr role); - friend class boost::serialization::access; - template - friend void boost::serialization::serialize(Archive& ar, NamedRole& t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -303,12 +202,6 @@ class BaseCondition { explicit BaseCondition(int identifier); - template - friend void boost::serialization::serialize(Archive& ar, BaseCondition& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const BaseCondition* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, BaseCondition* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -346,12 +239,6 @@ class BaseEffect { explicit BaseEffect(int identifier); - template - friend void boost::serialization::serialize(Archive& ar, BaseEffect& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const BaseEffect* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, BaseEffect* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -390,15 +277,8 @@ class Rule { Conditions m_conditions; Effects m_effects; - /// @brief Constructor for serialization. - Rule(); - Rule(int identifier, const Conditions& conditions, const Effects& effects); - friend class PolicyFactoryImpl; - friend class boost::serialization::access; - template - friend void boost::serialization::serialize(Archive& ar, Rule& t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -444,15 +324,8 @@ class Policy { Numericals m_numericals; Rules m_rules; - /// @brief Constructor for serialization. - Policy(); - Policy(int identifier, const Rules& rules); - friend class PolicyFactoryImpl; - friend class boost::serialization::access; - template - friend void boost::serialization::serialize(Archive& ar, Policy& t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -503,13 +376,6 @@ class PolicyFactory { private: dlplan::utils::pimpl m_pImpl; - /// @brief Constructor for serialization. - PolicyFactory(); - - friend class boost::serialization::access; - template - friend void boost::serialization::serialize(Archive& ar, PolicyFactory& t, const unsigned int version); - public: PolicyFactory(std::shared_ptr element_factory); PolicyFactory(const PolicyFactory& other); diff --git a/include/dlplan/serialization.h b/include/dlplan/serialization.h deleted file mode 100644 index 52f64657..00000000 --- a/include/dlplan/serialization.h +++ /dev/null @@ -1,53 +0,0 @@ -/// @brief Provides functionality for serialization of the whole library state. - -#ifndef DLPLAN_INCLUDE_DLPLAN_SERIALIZATION_H_ -#define DLPLAN_INCLUDE_DLPLAN_SERIALIZATION_H_ - -#include -#include - -#include "core.h" -#include "novelty.h" -#include "policy.h" -#include "state_space.h" - -using namespace dlplan; - - -namespace dlplan::serialization { - -/// @brief Encapsulates a forest of library objects for serialization and deserialization. -/// -/// The key is a string to allow the user the encode more complex nestings. -/// The value is a shared_ptr to the allow sharing between other objects. -struct Data { - // core - std::unordered_map> vocabulary_infos; - std::unordered_map> instance_infos; - std::unordered_map> syntatic_element_factories; - std::unordered_map> denotations_caches; - - // state_space - std::unordered_map> state_spaces; - - // novelty - std::unordered_map> tuple_graphs; - - // policy - std::unordered_map> policies; - std::unordered_map> policy_factories; -}; - -/// @brief Serializes the data and places it into the out_buffer. -/// @param data -/// @param out_buffer -void serialize(const Data& data, std::ostream& out_buffer); - -/// @brief Deserializes the data from the buffer. -/// @param buffer -/// @return -Data deserialize(std::istream& buffer); - -} - -#endif diff --git a/include/dlplan/state_space.h b/include/dlplan/state_space.h index b45af7e5..ad7c9232 100644 --- a/include/dlplan/state_space.h +++ b/include/dlplan/state_space.h @@ -10,21 +10,6 @@ #include "core.h" -// Forward declarations of this header -namespace dlplan::state_space { -class StateSpace; -} - - -// Forward declarations of template spezializations for serialization -namespace boost::serialization { - class access; - - template - void serialize(Archive& ar, dlplan::state_space::StateSpace& state_space, const unsigned int version); -} - - namespace dlplan::state_space { using StateIndex = int; using StateIndices = std::vector; @@ -50,13 +35,6 @@ class StateSpace { // for backward search AdjacencyList m_backward_successor_state_indices; - /// @brief Constructor for serialization - StateSpace(); - - friend class boost::serialization::access; - template - friend void boost::serialization::serialize(Archive& ar, StateSpace& state_space, const unsigned int version); - public: StateSpace( std::shared_ptr&& instance_info, diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8e4b2495..8af8fce9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,6 +2,5 @@ add_subdirectory(core) add_subdirectory(generator) add_subdirectory(novelty) add_subdirectory(policy) -add_subdirectory(serialization) add_subdirectory(state_space) #add_subdirectory(weisfeiler_lehman) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 4ef30cc1..49fa0d99 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -60,9 +60,6 @@ target_sources(dlplancore ../utils/hash.cpp ../common/parsers/utility.cpp ../common/parsers/filesystem.cpp) -target_link_libraries(dlplancore - PRIVATE - Boost::serialization) # Create an alias for simpler reference add_library(dlplan::core ALIAS dlplancore) diff --git a/src/core/atom.cpp b/src/core/atom.cpp index 7d7555d6..a670f486 100644 --- a/src/core/atom.cpp +++ b/src/core/atom.cpp @@ -87,20 +87,3 @@ bool Atom::is_static() const { } } - - -namespace boost::serialization { -template -void serialize(Archive& ar, dlplan::core::Atom& t, const unsigned int /* version */) { - ar & t.m_name; - ar & t.m_index; - ar & t.m_predicate_index; - ar & t.m_object_indices; - ar & t.m_is_static; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::core::Atom& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::core::Atom& t, const unsigned int version); -} \ No newline at end of file diff --git a/src/core/base_element.cpp b/src/core/base_element.cpp index dbbb593c..2dc95ab2 100644 --- a/src/core/base_element.cpp +++ b/src/core/base_element.cpp @@ -41,21 +41,3 @@ bool BaseElement::is_static() const { } } - - -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::BaseElement& /* t */, const unsigned int /* version */ ) -{ -} - -template -void save_construct_data(Archive& /* ar */ , const dlplan::core::BaseElement* /* t */ , const unsigned int /* version */ ) -{ -} - -template -void load_construct_data(Archive& /* ar */ , dlplan::core::BaseElement* /* t */ , const unsigned int /* version */ ) -{ -} -} diff --git a/src/core/boolean.cpp b/src/core/boolean.cpp index c4cec83f..fc4174b8 100644 --- a/src/core/boolean.cpp +++ b/src/core/boolean.cpp @@ -48,23 +48,3 @@ const BooleanDenotations* Boolean::evaluate(const States& states, DenotationsCac } } - - -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::Boolean& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& /* ar */ , const dlplan::core::Boolean* /* t */ , const unsigned int /* version */ ) -{ -} - -template -void load_construct_data(Archive& /* ar */ , dlplan::core::Boolean* /* t */ , const unsigned int /* version */ ) -{ -} -} - diff --git a/src/core/cache.h b/src/core/cache.h deleted file mode 100644 index 29527418..00000000 --- a/src/core/cache.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef DLPLAN_SRC_CORE_CACHE_H_ -#define DLPLAN_SRC_CORE_CACHE_H_ - -#include "../utils/cache.h" -#include "../../include/dlplan/core.h" - -#include - -#include - - -namespace dlplan::core { -/** - * One cache for each template instantiated element. - */ -struct Caches { - std::shared_ptr> m_concept_cache; - std::shared_ptr> m_role_cache; - std::shared_ptr> m_numerical_cache; - std::shared_ptr> m_boolean_cache; - - Caches() - : m_concept_cache(std::make_shared>()), - m_role_cache(std::make_shared>()), - m_numerical_cache(std::make_shared>()), - m_boolean_cache(std::make_shared>()) { } -}; - -} - - -namespace boost::serialization { -template -void serialize(Archive& ar, dlplan::core::Caches& t, const unsigned int /* version */ ) -{ - ar & t.m_boolean_cache; - ar & t.m_numerical_cache; - ar & t.m_concept_cache; - ar & t.m_role_cache; -} - -} - -#endif \ No newline at end of file diff --git a/src/core/concept.cpp b/src/core/concept.cpp index 87579f4c..053e5371 100644 --- a/src/core/concept.cpp +++ b/src/core/concept.cpp @@ -52,25 +52,3 @@ const ConceptDenotations* Concept::evaluate(const States& states, DenotationsCac } - -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::Concept& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& /* ar */ , const dlplan::core::Concept* /* t */ , const unsigned int /* version */ ) -{ -} - -template -void load_construct_data(Archive& /* ar */ , dlplan::core::Concept* /* t */ , const unsigned int /* version */ ) -{ -} - -} - - - diff --git a/src/core/concept_denotation.cpp b/src/core/concept_denotation.cpp index c09063b2..e6f89509 100644 --- a/src/core/concept_denotation.cpp +++ b/src/core/concept_denotation.cpp @@ -136,18 +136,3 @@ int ConceptDenotation::get_num_objects() const { } } - - -namespace boost::serialization { -template -void serialize(Archive& ar, dlplan::core::ConceptDenotation& t, const unsigned int /* version */) { - ar & t.m_num_objects; - ar & t.m_data; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::core::ConceptDenotation& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::core::ConceptDenotation& t, const unsigned int version); -} - diff --git a/src/core/constant.cpp b/src/core/constant.cpp index 5e3a6326..6c7009d8 100644 --- a/src/core/constant.cpp +++ b/src/core/constant.cpp @@ -61,17 +61,3 @@ const std::string& Constant::get_name() const { } } - -namespace boost::serialization { - -template -void serialize(Archive& ar, dlplan::core::Constant& t, const unsigned int /* version */) { - ar & t.m_name; - ar & t.m_index; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::core::Constant& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::core::Constant& t, const unsigned int version); -} diff --git a/src/core/core.cpp b/src/core/core.cpp index 7a5d3bd7..8ca58801 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -265,18 +265,3 @@ std::shared_ptrSyntacticElementFactory::make_transitive_reflexive_cl } } - - -namespace boost::serialization { -template -void serialize(Archive& ar, dlplan::core::SyntacticElementFactory& t, const unsigned int /* version */ ) -{ - ar & t.m_pImpl; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::core::SyntacticElementFactory& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::core::SyntacticElementFactory& t, const unsigned int version); - -} \ No newline at end of file diff --git a/src/core/denotations_caches.cpp b/src/core/denotations_caches.cpp index 2a7eb80e..e480700e 100644 --- a/src/core/denotations_caches.cpp +++ b/src/core/denotations_caches.cpp @@ -2,12 +2,6 @@ #include "../../include/dlplan/utils/hash.h" -#include -#include -#include -#include -#include - namespace dlplan::core { @@ -38,82 +32,3 @@ std::size_t DenotationsCaches::KeyHash::operator()(const Key& key) const { } } - -namespace boost::serialization { - -template -void serialize(Archive& ar, dlplan::core::DenotationsCaches& t, const unsigned int /* version */ ) { - ar & t.concept_denotation_cache; - ar & t.role_denotation_cache; - ar & t.boolean_denotation_cache; - ar & t.numerical_denotation_cache; - ar & t.concept_denotations_cache; - ar & t.role_denotations_cache; - ar & t.boolean_denotations_cache; - ar & t.numerical_denotations_cache; -} - -template -void serialize(Archive& ar, dlplan::core::DenotationsCaches::Key& t, const unsigned int /* version */ ) { - ar & t.element; - ar & t.instance; - ar & t.state; -} - -template -void serialize(Archive& ar, dlplan::core::DenotationsCaches::Cache& t, const unsigned int /* version */ ) { - ar & t.uniqueness; - ar & t.per_element_instance_state_mapping; -} - -template -void serialize(Archive& ar, bool& t, const unsigned int /* version */ ) { - ar & t; -} - -template -void serialize(Archive& ar, int& t, const unsigned int /* version */ ) { - ar & t; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::core::DenotationsCaches& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::core::DenotationsCaches& t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::core::DenotationsCaches::Key& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::core::DenotationsCaches::Key& t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::core::DenotationsCaches::Cache& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::core::DenotationsCaches::Cache& t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::core::DenotationsCaches::Cache& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::core::DenotationsCaches::Cache& t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::core::DenotationsCaches::Cache& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::core::DenotationsCaches::Cache& t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::core::DenotationsCaches::Cache& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::core::DenotationsCaches::Cache& t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - bool& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - bool& t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - int& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - int& t, const unsigned int version); - -} diff --git a/src/core/element_factory.cpp b/src/core/element_factory.cpp index 3e148236..9f33367c 100644 --- a/src/core/element_factory.cpp +++ b/src/core/element_factory.cpp @@ -5,10 +5,6 @@ #include "../../include/dlplan/core/parsers/semantic/parser.hpp" #include "../../include/dlplan/common/parsers/utility.hpp" -#include -#include -#include - #include #include @@ -17,10 +13,6 @@ using namespace dlplan; namespace dlplan::core { -SyntacticElementFactoryImpl::SyntacticElementFactoryImpl() - : m_vocabulary_info(nullptr) { -} - SyntacticElementFactoryImpl::SyntacticElementFactoryImpl(std::shared_ptr vocabulary_info) : m_vocabulary_info(vocabulary_info) { } @@ -326,18 +318,3 @@ std::shared_ptr SyntacticElementFactoryImpl::get_vocabulary_info } } - - -namespace boost::serialization { -template -void serialize(Archive& ar, dlplan::core::SyntacticElementFactoryImpl& t, const unsigned int /* version */ ) -{ - ar & t.m_vocabulary_info; - ar & t.m_cache; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::core::SyntacticElementFactoryImpl& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::core::SyntacticElementFactoryImpl& t, const unsigned int version); -} diff --git a/src/core/element_factory.h b/src/core/element_factory.h index 1f5086e0..7c1ab44e 100644 --- a/src/core/element_factory.h +++ b/src/core/element_factory.h @@ -43,18 +43,6 @@ #include -namespace dlplan::core { -class SyntacticElementFactoryImpl; -} - -namespace boost::serialization { - class access; - - template - void serialize(Archive& ar, dlplan::core::SyntacticElementFactoryImpl& factory, const unsigned int version); -} - - namespace dlplan::core { class SyntacticElementFactoryImpl { private: @@ -97,13 +85,6 @@ class SyntacticElementFactoryImpl { , TransitiveClosureRole , TransitiveReflexiveClosureRole> m_cache; - /// @brief Constructor for serialization. - SyntacticElementFactoryImpl(); - - friend class boost::serialization::access; - template - friend void boost::serialization::serialize(Archive& ar, SyntacticElementFactoryImpl& factory, const unsigned int version); - public: SyntacticElementFactoryImpl(std::shared_ptr vocabulary_info); diff --git a/src/core/elements/booleans/empty.cpp b/src/core/elements/booleans/empty.cpp index ab5ccdfa..3a6e19af 100644 --- a/src/core/elements/booleans/empty.cpp +++ b/src/core/elements/booleans/empty.cpp @@ -1,4 +1,5 @@ #include "../../../../include/dlplan/core/elements/booleans/empty.h" -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::EmptyBoolean) -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::EmptyBoolean) +namespace dlplan::core { + +} diff --git a/src/core/elements/booleans/inclusion.cpp b/src/core/elements/booleans/inclusion.cpp index 55de6b5a..2202fd55 100644 --- a/src/core/elements/booleans/inclusion.cpp +++ b/src/core/elements/booleans/inclusion.cpp @@ -1,5 +1 @@ #include "../../../../include/dlplan/core/elements/booleans/inclusion.h" - - -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::InclusionBoolean) -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::InclusionBoolean) diff --git a/src/core/elements/booleans/nullary.cpp b/src/core/elements/booleans/nullary.cpp index 9298b1fb..c32a5ce3 100644 --- a/src/core/elements/booleans/nullary.cpp +++ b/src/core/elements/booleans/nullary.cpp @@ -1,11 +1,5 @@ #include "../../../../include/dlplan/core/elements/booleans/nullary.h" -#include -#include -#include -#include -#include - namespace dlplan::core { @@ -81,78 +75,6 @@ int NullaryBoolean::compute_evaluate_time_score() const { } -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::NullaryBoolean& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& ar, const dlplan::core::NullaryBoolean* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; - ar << &t->m_predicate; -} - -template -void load_construct_data(Archive& ar, dlplan::core::NullaryBoolean* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - dlplan::core::Predicate* predicate; - ar >> vocabulary; - ar >> index; - ar >> predicate; - ::new(t)dlplan::core::NullaryBoolean(index, vocabulary, *predicate); - delete predicate; -} - - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::core::NullaryBoolean* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::core::NullaryBoolean& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::core::NullaryBoolean& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const dlplan::core::NullaryBoolean* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - dlplan::core::NullaryBoolean* t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - std::pair>& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - std::pair>& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const std::pair>* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - std::pair>* t, const unsigned int version); -} - -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::NullaryBoolean) - - namespace std { bool less>::operator()( const std::shared_ptr& left_boolean, diff --git a/src/core/elements/concepts/all.cpp b/src/core/elements/concepts/all.cpp index 5942b742..61e25757 100644 --- a/src/core/elements/concepts/all.cpp +++ b/src/core/elements/concepts/all.cpp @@ -1,11 +1,5 @@ #include "../../../../include/dlplan/core/elements/concepts/all.h" -#include -#include -#include -#include -#include - namespace dlplan::core { void AllConcept::compute_result(const RoleDenotation& role_denot, const ConceptDenotation& concept_denot, ConceptDenotation& result) const { @@ -88,80 +82,6 @@ int AllConcept::compute_evaluate_time_score() const { } -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::AllConcept& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& ar, const dlplan::core::AllConcept* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; - ar << t->m_role; - ar << t->m_concept; -} - -template -void load_construct_data(Archive& ar, dlplan::core::AllConcept* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - std::shared_ptr concept_; - std::shared_ptr role; - ar >> vocabulary; - ar >> index; - ar >> role; - ar >> concept_; - ::new(t)dlplan::core::AllConcept(index, vocabulary, role, concept_); -} - - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::core::AllConcept* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::core::AllConcept& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::core::AllConcept& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const dlplan::core::AllConcept* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - dlplan::core::AllConcept* t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - std::pair>& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - std::pair>& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const std::pair>* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - std::pair>* t, const unsigned int version); -} - -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::AllConcept) - - namespace std { bool less>::operator()( const std::shared_ptr& left_concept, diff --git a/src/core/elements/concepts/and.cpp b/src/core/elements/concepts/and.cpp index 1217bc11..3824a72d 100644 --- a/src/core/elements/concepts/and.cpp +++ b/src/core/elements/concepts/and.cpp @@ -1,11 +1,5 @@ #include "../../../../include/dlplan/core/elements/concepts/and.h" -#include -#include -#include -#include -#include - namespace dlplan::core { void AndConcept::compute_result(const ConceptDenotation& left_denot, const ConceptDenotation& right_denot, ConceptDenotation& result) const { @@ -86,80 +80,6 @@ int AndConcept::compute_evaluate_time_score() const { } -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::AndConcept& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& ar, const dlplan::core::AndConcept* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; - ar << t->m_concept_left; - ar << t->m_concept_right; -} - -template -void load_construct_data(Archive& ar, dlplan::core::AndConcept* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - std::shared_ptr concept_left; - std::shared_ptr concept_right; - ar >> vocabulary; - ar >> index; - ar >> concept_left; - ar >> concept_right; - ::new(t)dlplan::core::AndConcept(index, vocabulary, concept_left, concept_right); -} - - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::core::AndConcept* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::core::AndConcept& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::core::AndConcept& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const dlplan::core::AndConcept* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - dlplan::core::AndConcept* t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - std::pair>& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - std::pair>& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const std::pair>* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - std::pair>* t, const unsigned int version); -} - -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::AndConcept) - - namespace std { bool less>::operator()( const std::shared_ptr& left_concept, diff --git a/src/core/elements/concepts/bot.cpp b/src/core/elements/concepts/bot.cpp index a3f20c09..361a3516 100644 --- a/src/core/elements/concepts/bot.cpp +++ b/src/core/elements/concepts/bot.cpp @@ -1,3 +1,2 @@ #include "bot.h" -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::BotConcept) diff --git a/src/core/elements/concepts/bot.h b/src/core/elements/concepts/bot.h index 4163dec6..c6085f76 100644 --- a/src/core/elements/concepts/bot.h +++ b/src/core/elements/concepts/bot.h @@ -4,12 +4,6 @@ #include "../utils.h" #include "../../../../include/dlplan/core.h" -#include -#include -#include -#include -#include - #include #include @@ -22,28 +16,6 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::core { -class BotConcept; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::core::BotConcept& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::BotConcept* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::BotConcept* t, const unsigned int version); - - template - void serialize(Archive& ar, std::pair>& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int version); - template - void load_construct_data(Archive& ar, std::pair>* t, const unsigned int version); -} - - namespace dlplan::core { class BotConcept : public Concept { private: @@ -62,18 +34,8 @@ class BotConcept : public Concept { } BotConcept(ElementIndex index, std::shared_ptr vocabulary_info) - : Concept(vocabulary_info, index, true) { - } - - /// @brief Constructor for serialization. - BotConcept() {} - - template - friend void boost::serialization::serialize(Archive& ar, BotConcept& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const BotConcept* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, BotConcept* t, const unsigned int version); + : Concept(vocabulary_info, index, true) { } + template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -110,56 +72,6 @@ class BotConcept : public Concept { } -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::BotConcept& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& ar, const dlplan::core::BotConcept* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; -} - -template -void load_construct_data(Archive& ar, dlplan::core::BotConcept* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - ar >> vocabulary; - ar >> index; - ::new(t)dlplan::core::BotConcept(index, vocabulary); -} - - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::core::BotConcept* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} -} - -BOOST_CLASS_EXPORT_KEY2(dlplan::core::BotConcept, "dlplan::core::BotConcept") - - namespace std { template<> struct less> diff --git a/src/core/elements/concepts/diff.cpp b/src/core/elements/concepts/diff.cpp index d0ff8023..713485ac 100644 --- a/src/core/elements/concepts/diff.cpp +++ b/src/core/elements/concepts/diff.cpp @@ -1,3 +1 @@ #include "diff.h" - -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::DiffConcept) diff --git a/src/core/elements/concepts/diff.h b/src/core/elements/concepts/diff.h index cc016ca5..06c0c1b0 100644 --- a/src/core/elements/concepts/diff.h +++ b/src/core/elements/concepts/diff.h @@ -4,12 +4,6 @@ #include "../utils.h" #include "../../../../include/dlplan/core.h" -#include -#include -#include -#include -#include - #include #include @@ -22,22 +16,6 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::core { -class DiffConcept; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::core::DiffConcept& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::DiffConcept* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::DiffConcept* t, const unsigned int version); - -} - - namespace dlplan::core { class DiffConcept : public Concept { private: @@ -77,12 +55,6 @@ class DiffConcept : public Concept { DiffConcept(ElementIndex index, std::shared_ptr vocabulary_info, std::shared_ptr concept_1, std::shared_ptr concept_2) : Concept(vocabulary_info, index, concept_1->is_static() && concept_2->is_static()), m_concept_left(concept_1), m_concept_right(concept_2) { } - template - friend void boost::serialization::serialize(Archive& ar, DiffConcept& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const DiffConcept* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, DiffConcept* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -130,63 +102,6 @@ class DiffConcept : public Concept { } -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::DiffConcept& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& ar, const dlplan::core::DiffConcept* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; - ar << t->m_concept_left; - ar << t->m_concept_right; -} - -template -void load_construct_data(Archive& ar, dlplan::core::DiffConcept* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - std::shared_ptr concept_left; - std::shared_ptr concept_right; - ar >> vocabulary; - ar >> index; - ar >> concept_left; - ar >> concept_right; - ::new(t)dlplan::core::DiffConcept(index, vocabulary, concept_left, concept_right); -} - - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::core::DiffConcept* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -} - -BOOST_CLASS_EXPORT_KEY2(dlplan::core::DiffConcept, "dlplan::core::DiffConcept") - - namespace std { template<> struct less> diff --git a/src/core/elements/concepts/equal.cpp b/src/core/elements/concepts/equal.cpp index 47963ad7..b385f54a 100644 --- a/src/core/elements/concepts/equal.cpp +++ b/src/core/elements/concepts/equal.cpp @@ -1,3 +1 @@ #include "equal.h" - -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::EqualConcept) diff --git a/src/core/elements/concepts/equal.h b/src/core/elements/concepts/equal.h index ed5765ac..47c76861 100644 --- a/src/core/elements/concepts/equal.h +++ b/src/core/elements/concepts/equal.h @@ -4,12 +4,6 @@ #include "../utils.h" #include "../../../../include/dlplan/core.h" -#include -#include -#include -#include -#include - #include #include @@ -22,22 +16,6 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::core { -class EqualConcept; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::core::EqualConcept& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::EqualConcept* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::EqualConcept* t, const unsigned int version); - -} - - namespace dlplan::core { class EqualConcept : public Concept { private: @@ -85,12 +63,6 @@ class EqualConcept : public Concept { : Concept(vocabulary_info, index, role_left->is_static() && role_right->is_static()), m_role_left(role_left), m_role_right(role_right) { } - template - friend void boost::serialization::serialize(Archive& ar, EqualConcept& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const EqualConcept* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, EqualConcept* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -138,63 +110,6 @@ class EqualConcept : public Concept { } -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::EqualConcept& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& ar, const dlplan::core::EqualConcept* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; - ar << t->m_role_left; - ar << t->m_role_right; -} - -template -void load_construct_data(Archive& ar, dlplan::core::EqualConcept* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - std::shared_ptr role_left; - std::shared_ptr role_right; - ar >> vocabulary; - ar >> index; - ar >> role_left; - ar >> role_right; - ::new(t)dlplan::core::EqualConcept(index, vocabulary, role_left, role_right); -} - - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::core::EqualConcept* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -} - -BOOST_CLASS_EXPORT_KEY2(dlplan::core::EqualConcept, "dlplan::core::EqualConcept") - - namespace std { template<> struct less> diff --git a/src/core/elements/concepts/not.cpp b/src/core/elements/concepts/not.cpp index d09d7a4c..77795366 100644 --- a/src/core/elements/concepts/not.cpp +++ b/src/core/elements/concepts/not.cpp @@ -1,3 +1 @@ #include "not.h" - -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::NotConcept) diff --git a/src/core/elements/concepts/not.h b/src/core/elements/concepts/not.h index a89ee42c..406f258f 100644 --- a/src/core/elements/concepts/not.h +++ b/src/core/elements/concepts/not.h @@ -4,12 +4,6 @@ #include "../utils.h" #include "../../../../include/dlplan/core.h" -#include -#include -#include -#include -#include - #include #include @@ -22,22 +16,6 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::core { -class NotConcept; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::core::NotConcept& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::NotConcept* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::NotConcept* t, const unsigned int version); - -} - - namespace dlplan::core { class NotConcept : public Concept { private: @@ -74,12 +52,6 @@ class NotConcept : public Concept { NotConcept(ElementIndex index, std::shared_ptr vocabulary_info, std::shared_ptr concept) : Concept(vocabulary_info, index, concept->is_static()), m_concept(concept){ } - template - friend void boost::serialization::serialize(Archive& ar, NotConcept& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const NotConcept* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, NotConcept* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -123,60 +95,6 @@ class NotConcept : public Concept { } -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::NotConcept& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& ar, const dlplan::core::NotConcept* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; - ar << t->m_concept; -} - -template -void load_construct_data(Archive& ar, dlplan::core::NotConcept* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - std::shared_ptr concept_; - ar >> vocabulary; - ar >> index; - ar >> concept_; - ::new(t)dlplan::core::NotConcept(index, vocabulary, concept_); -} - - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::core::NotConcept* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -} - -BOOST_CLASS_EXPORT_KEY2(dlplan::core::NotConcept, "dlplan::core::NotConcept") - - namespace std { template<> struct less> diff --git a/src/core/elements/concepts/one_of.cpp b/src/core/elements/concepts/one_of.cpp index 99210352..602b17bf 100644 --- a/src/core/elements/concepts/one_of.cpp +++ b/src/core/elements/concepts/one_of.cpp @@ -1,3 +1 @@ #include "one_of.h" - -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::OneOfConcept) diff --git a/src/core/elements/concepts/one_of.h b/src/core/elements/concepts/one_of.h index 5ee34dbc..4120ffa3 100644 --- a/src/core/elements/concepts/one_of.h +++ b/src/core/elements/concepts/one_of.h @@ -4,11 +4,6 @@ #include "../utils.h" #include "../../../../include/dlplan/core.h" -#include -#include -#include -#include -#include #include #include @@ -22,22 +17,6 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::core { -class OneOfConcept; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::core::OneOfConcept& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::OneOfConcept* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::OneOfConcept* t, const unsigned int version); - -} - - namespace dlplan::core { class OneOfConcept : public Concept { private: @@ -81,12 +60,6 @@ class OneOfConcept : public Concept { OneOfConcept(ElementIndex index, std::shared_ptr vocabulary_info, const Constant& constant) : Concept(vocabulary_info, index, true), m_constant(constant) { } - template - friend void boost::serialization::serialize(Archive& ar, OneOfConcept& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const OneOfConcept* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, OneOfConcept* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -126,61 +99,6 @@ class OneOfConcept : public Concept { } -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::OneOfConcept& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& ar, const dlplan::core::OneOfConcept* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; - ar << &t->m_constant; -} - -template -void load_construct_data(Archive& ar, dlplan::core::OneOfConcept* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - dlplan::core::Constant* constant; - ar >> vocabulary; - ar >> index; - ar >> constant; - ::new(t)dlplan::core::OneOfConcept(index, vocabulary, *constant); - delete constant; -} - - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::core::OneOfConcept* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -} - -BOOST_CLASS_EXPORT_KEY2(dlplan::core::OneOfConcept, "dlplan::core::OneOfConcept") - - namespace std { template<> struct less> diff --git a/src/core/elements/concepts/or.cpp b/src/core/elements/concepts/or.cpp index c3cf38a7..aa3e2b4c 100644 --- a/src/core/elements/concepts/or.cpp +++ b/src/core/elements/concepts/or.cpp @@ -1,3 +1,2 @@ #include "or.h" -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::OrConcept) diff --git a/src/core/elements/concepts/or.h b/src/core/elements/concepts/or.h index 4a014558..eb61038e 100644 --- a/src/core/elements/concepts/or.h +++ b/src/core/elements/concepts/or.h @@ -4,12 +4,6 @@ #include "../utils.h" #include "../../../../include/dlplan/core.h" -#include -#include -#include -#include -#include - #include #include @@ -22,28 +16,6 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::core { -class OrConcept; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::core::OrConcept& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::OrConcept* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::OrConcept* t, const unsigned int version); - - template - void serialize(Archive& ar, std::pair>& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int version); - template - void load_construct_data(Archive& ar, std::pair>* t, const unsigned int version); -} - - namespace dlplan::core { class OrConcept : public Concept { private: @@ -87,12 +59,6 @@ class OrConcept : public Concept { m_concept_right(concept_1->get_index() < concept_2->get_index() ? concept_2 : concept_1) { } - template - friend void boost::serialization::serialize(Archive& ar, OrConcept& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const OrConcept* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, OrConcept* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -140,64 +106,6 @@ class OrConcept : public Concept { } -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::OrConcept& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& ar, const dlplan::core::OrConcept* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; - ar << t->m_concept_left; - ar << t->m_concept_right; -} - -template -void load_construct_data(Archive& ar, dlplan::core::OrConcept* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - std::shared_ptr concept_left; - std::shared_ptr concept_right; - ar >> vocabulary; - ar >> index; - ar >> concept_left; - ar >> concept_right; - ::new(t)dlplan::core::OrConcept(index, vocabulary, concept_left, concept_right); -} - - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::core::OrConcept* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - - -} - -BOOST_CLASS_EXPORT_KEY2(dlplan::core::OrConcept, "dlplan::core::OrConcept") - - namespace std { template<> struct less> diff --git a/src/core/elements/concepts/primitive.cpp b/src/core/elements/concepts/primitive.cpp index fdfe40b1..5cea3bb2 100644 --- a/src/core/elements/concepts/primitive.cpp +++ b/src/core/elements/concepts/primitive.cpp @@ -1,11 +1,5 @@ #include "primitive.h" -#include -#include -#include -#include -#include - namespace dlplan::core { void PrimitiveConcept::compute_result(const State& state, ConceptDenotation& result) const { @@ -87,80 +81,3 @@ int PrimitiveConcept::compute_evaluate_time_score() const { } } - - - -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::PrimitiveConcept& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& ar, const dlplan::core::PrimitiveConcept* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; - ar << &t->m_predicate; - ar << t->m_pos; -} - -template -void load_construct_data(Archive& ar, dlplan::core::PrimitiveConcept* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - dlplan::core::Predicate* predicate; - int pos; - ar >> vocabulary; - ar >> index; - ar >> predicate; - ar >> pos; - ::new(t)dlplan::core::PrimitiveConcept(index, vocabulary, *predicate, pos); - delete predicate; -} - - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::core::PrimitiveConcept* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::core::PrimitiveConcept& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::core::PrimitiveConcept& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const dlplan::core::PrimitiveConcept* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - dlplan::core::PrimitiveConcept* t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - std::pair>& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - std::pair>& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const std::pair>* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - std::pair>* t, const unsigned int version); -} - - -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::PrimitiveConcept) diff --git a/src/core/elements/concepts/primitive.h b/src/core/elements/concepts/primitive.h index f7bf2d90..0e08ee41 100644 --- a/src/core/elements/concepts/primitive.h +++ b/src/core/elements/concepts/primitive.h @@ -5,8 +5,6 @@ #include "../../../utils/collections.h" #include "../../../../include/dlplan/core.h" -#include - #include #include @@ -20,27 +18,6 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::core { -class PrimitiveConcept; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::core::PrimitiveConcept& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::PrimitiveConcept* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::PrimitiveConcept* t, const unsigned int version); - - template - void serialize(Archive& ar, std::pair>& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int version); - template - void load_construct_data(Archive& ar, std::pair>* t, const unsigned int version); -} - namespace dlplan::core { class PrimitiveConcept : public Concept { private: @@ -55,12 +32,6 @@ class PrimitiveConcept : public Concept { PrimitiveConcept(ElementIndex index, std::shared_ptr vocabulary_info, const Predicate& predicate, int pos); - template - friend void boost::serialization::serialize(Archive& ar, PrimitiveConcept& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const PrimitiveConcept* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, PrimitiveConcept* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -80,8 +51,6 @@ class PrimitiveConcept : public Concept { } -BOOST_CLASS_EXPORT_KEY2(dlplan::core::PrimitiveConcept, "dlplan::core::PrimitiveConcept") - namespace std { template<> diff --git a/src/core/elements/concepts/projection.cpp b/src/core/elements/concepts/projection.cpp index 2a438e9f..3fefe220 100644 --- a/src/core/elements/concepts/projection.cpp +++ b/src/core/elements/concepts/projection.cpp @@ -1,3 +1 @@ #include "projection.h" - -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::ProjectionConcept) diff --git a/src/core/elements/concepts/projection.h b/src/core/elements/concepts/projection.h index cb61d2a1..b5f5375f 100644 --- a/src/core/elements/concepts/projection.h +++ b/src/core/elements/concepts/projection.h @@ -4,12 +4,6 @@ #include "../utils.h" #include "../../../../include/dlplan/core.h" -#include -#include -#include -#include -#include - #include #include @@ -22,28 +16,6 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::core { -class ProjectionConcept; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::core::ProjectionConcept& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::ProjectionConcept* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::ProjectionConcept* t, const unsigned int version); - - template - void serialize(Archive& ar, std::pair>& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int version); - template - void load_construct_data(Archive& ar, std::pair>* t, const unsigned int version); -} - - namespace dlplan::core { class ProjectionConcept : public Concept { private: @@ -86,12 +58,6 @@ class ProjectionConcept : public Concept { } } - template - friend void boost::serialization::serialize(Archive& ar, ProjectionConcept& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const ProjectionConcept* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, ProjectionConcept* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -136,62 +102,6 @@ class ProjectionConcept : public Concept { } -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::ProjectionConcept& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& ar, const dlplan::core::ProjectionConcept* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; - ar << t->m_role; - ar << t->m_pos; -} - -template -void load_construct_data(Archive& ar, dlplan::core::ProjectionConcept* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - std::shared_ptr role; - int pos; - ar >> vocabulary; - ar >> index; - ar >> role; - ar >> pos; - ::new(t)dlplan::core::ProjectionConcept(index, vocabulary, role, pos); -} - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::core::ProjectionConcept* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -} - -BOOST_CLASS_EXPORT_KEY2(dlplan::core::ProjectionConcept, "dlplan::core::ProjectionConcept") - - namespace std { template<> struct less> diff --git a/src/core/elements/concepts/some.cpp b/src/core/elements/concepts/some.cpp index 666f2f44..4a66c4df 100644 --- a/src/core/elements/concepts/some.cpp +++ b/src/core/elements/concepts/some.cpp @@ -1,3 +1,2 @@ #include "some.h" -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::SomeConcept) diff --git a/src/core/elements/concepts/some.h b/src/core/elements/concepts/some.h index b5c34578..2a661915 100644 --- a/src/core/elements/concepts/some.h +++ b/src/core/elements/concepts/some.h @@ -22,22 +22,6 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::core { -class SomeConcept; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::core::SomeConcept& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::SomeConcept* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::SomeConcept* t, const unsigned int version); - -} - - namespace dlplan::core { class SomeConcept : public Concept { private: @@ -81,12 +65,6 @@ class SomeConcept : public Concept { SomeConcept(ElementIndex index, std::shared_ptr vocabulary_info, std::shared_ptr role, std::shared_ptr concept) : Concept(vocabulary_info, index, role->is_static() && concept->is_static()), m_role(role), m_concept(concept) { } - template - friend void boost::serialization::serialize(Archive& ar, SomeConcept& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const SomeConcept* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, SomeConcept* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -134,63 +112,6 @@ class SomeConcept : public Concept { } -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::SomeConcept& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& ar, const dlplan::core::SomeConcept* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; - ar << t->m_role; - ar << t->m_concept; -} - -template -void load_construct_data(Archive& ar, dlplan::core::SomeConcept* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - std::shared_ptr role; - std::shared_ptr concept_; - ar >> vocabulary; - ar >> index; - ar >> role; - ar >> concept_; - ::new(t)dlplan::core::SomeConcept(index, vocabulary, role, concept_); -} - - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::core::SomeConcept* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -} - -BOOST_CLASS_EXPORT_KEY2(dlplan::core::SomeConcept, "dlplan::core::SomeConcept") - - namespace std { template<> struct less> diff --git a/src/core/elements/concepts/subset.cpp b/src/core/elements/concepts/subset.cpp index 2d00101b..d3b3fdf5 100644 --- a/src/core/elements/concepts/subset.cpp +++ b/src/core/elements/concepts/subset.cpp @@ -1,3 +1 @@ #include "subset.h" - -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::SubsetConcept) diff --git a/src/core/elements/concepts/subset.h b/src/core/elements/concepts/subset.h index cf465418..4c212ec1 100644 --- a/src/core/elements/concepts/subset.h +++ b/src/core/elements/concepts/subset.h @@ -4,12 +4,6 @@ #include "../utils.h" #include "../../../../include/dlplan/core.h" -#include -#include -#include -#include -#include - #include #include @@ -22,22 +16,6 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::core { -class SubsetConcept; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::core::SubsetConcept& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::SubsetConcept* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::SubsetConcept* t, const unsigned int version); - -} - - namespace dlplan::core { class SubsetConcept : public Concept { private: @@ -81,12 +59,6 @@ class SubsetConcept : public Concept { SubsetConcept(ElementIndex index, std::shared_ptr vocabulary_info, std::shared_ptr role_left, std::shared_ptr role_right) : Concept(vocabulary_info, index, role_left->is_static() && role_right->is_static()), m_role_left(role_left), m_role_right(role_right) { } - template - friend void boost::serialization::serialize(Archive& ar, SubsetConcept& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const SubsetConcept* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, SubsetConcept* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -134,63 +106,6 @@ class SubsetConcept : public Concept { } -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::SubsetConcept& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& ar, const dlplan::core::SubsetConcept* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; - ar << t->m_role_left; - ar << t->m_role_right; -} - -template -void load_construct_data(Archive& ar, dlplan::core::SubsetConcept* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - std::shared_ptr role_left; - std::shared_ptr role_right; - ar >> vocabulary; - ar >> index; - ar >> role_left; - ar >> role_right; - ::new(t)dlplan::core::SubsetConcept(index, vocabulary, role_left, role_right); -} - - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::core::SubsetConcept* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -} - -BOOST_CLASS_EXPORT_KEY2(dlplan::core::SubsetConcept, "dlplan::core::SubsetConcept") - - namespace std { template<> struct less> diff --git a/src/core/elements/concepts/top.cpp b/src/core/elements/concepts/top.cpp index 527928af..16ec9e05 100644 --- a/src/core/elements/concepts/top.cpp +++ b/src/core/elements/concepts/top.cpp @@ -1,3 +1 @@ #include "top.h" - -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::TopConcept) diff --git a/src/core/elements/concepts/top.h b/src/core/elements/concepts/top.h index 3b8f8ecd..288c08a6 100644 --- a/src/core/elements/concepts/top.h +++ b/src/core/elements/concepts/top.h @@ -4,12 +4,6 @@ #include "../utils.h" #include "../../../../include/dlplan/core.h" -#include -#include -#include -#include -#include - #include #include @@ -22,22 +16,6 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::core { -class TopConcept; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::core::TopConcept& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::TopConcept* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::TopConcept* t, const unsigned int version); - -} - - namespace dlplan::core { class TopConcept : public Concept { private: @@ -62,12 +40,6 @@ class TopConcept : public Concept { : Concept(vocabulary_info, index, true) { } - template - friend void boost::serialization::serialize(Archive& ar, TopConcept& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const TopConcept* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, TopConcept* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -106,57 +78,6 @@ class TopConcept : public Concept { } -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::TopConcept& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& ar, const dlplan::core::TopConcept* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; -} - -template -void load_construct_data(Archive& ar, dlplan::core::TopConcept* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - ar >> vocabulary; - ar >> index; - ::new(t)dlplan::core::TopConcept(index, vocabulary); -} - - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::core::TopConcept* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -} - -BOOST_CLASS_EXPORT_KEY2(dlplan::core::TopConcept, "dlplan::core::TopConcept") - - namespace std { template<> struct less> diff --git a/src/core/elements/numericals/concept_distance.cpp b/src/core/elements/numericals/concept_distance.cpp index 3428b6d0..e9512354 100644 --- a/src/core/elements/numericals/concept_distance.cpp +++ b/src/core/elements/numericals/concept_distance.cpp @@ -1,3 +1,2 @@ #include "concept_distance.h" -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::ConceptDistanceNumerical) diff --git a/src/core/elements/numericals/concept_distance.h b/src/core/elements/numericals/concept_distance.h index d4aabdf4..7b531699 100644 --- a/src/core/elements/numericals/concept_distance.h +++ b/src/core/elements/numericals/concept_distance.h @@ -4,12 +4,6 @@ #include "../utils.h" #include "../../../../include/dlplan/core.h" -#include -#include -#include -#include -#include - #include #include @@ -22,28 +16,6 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::core { -class ConceptDistanceNumerical; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::core::ConceptDistanceNumerical& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::ConceptDistanceNumerical* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::ConceptDistanceNumerical* t, const unsigned int version); - - template - void serialize(Archive& ar, std::pair>& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int version); - template - void load_construct_data(Archive& ar, std::pair>* t, const unsigned int version); -} - - namespace dlplan::core { class ConceptDistanceNumerical : public Numerical { @@ -111,12 +83,6 @@ class ConceptDistanceNumerical : public Numerical { : Numerical(vocabulary_info, index, concept_from->is_static() && role->is_static() && concept_to->is_static()), m_concept_from(concept_from), m_role(role), m_concept_to(concept_to) { } - template - friend void boost::serialization::serialize(Archive& ar, ConceptDistanceNumerical& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const ConceptDistanceNumerical* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, ConceptDistanceNumerical* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -176,66 +142,6 @@ class ConceptDistanceNumerical : public Numerical { } -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::ConceptDistanceNumerical& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& ar, const dlplan::core::ConceptDistanceNumerical* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; - ar << t->m_concept_from; - ar << t->m_role; - ar << t->m_concept_to; -} - -template -void load_construct_data(Archive& ar, dlplan::core::ConceptDistanceNumerical* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - std::shared_ptr concept_from; - std::shared_ptr role; - std::shared_ptr concept_to; - ar >> vocabulary; - ar >> index; - ar >> concept_from; - ar >> role; - ar >> concept_to; - ::new(t)dlplan::core::ConceptDistanceNumerical(index, vocabulary, concept_from, role, concept_to); -} - - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::core::ConceptDistanceNumerical* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -} - -BOOST_CLASS_EXPORT_KEY2(dlplan::core::ConceptDistanceNumerical, "dlplan::core::ConceptDistanceNumerical") - - namespace std { template<> struct less> diff --git a/src/core/elements/numericals/count.cpp b/src/core/elements/numericals/count.cpp index 46140934..11496392 100644 --- a/src/core/elements/numericals/count.cpp +++ b/src/core/elements/numericals/count.cpp @@ -1,4 +1,6 @@ #include "count.h" -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::CountNumerical) -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::CountNumerical) + +namespace dlplan::core { + +} diff --git a/src/core/elements/numericals/count.h b/src/core/elements/numericals/count.h index 5ae30425..859ecdbb 100644 --- a/src/core/elements/numericals/count.h +++ b/src/core/elements/numericals/count.h @@ -22,28 +22,6 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::core { -template -class CountNumerical; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::core::CountNumerical& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::CountNumerical* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::CountNumerical* t, const unsigned int version); - - template - void serialize(Archive& ar, std::pair, std::weak_ptr>>& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const std::pair, std::weak_ptr>>* t, const unsigned int version); - template - void load_construct_data(Archive& ar, std::pair, std::weak_ptr>>* t, const unsigned int version); -} - namespace dlplan::core { template @@ -81,12 +59,6 @@ class CountNumerical : public Numerical { CountNumerical(ElementIndex index, std::shared_ptr vocabulary_info, std::shared_ptr element) : Numerical(vocabulary_info, index, element->is_static()), m_element(element) { } - template - friend void boost::serialization::serialize(Archive& ar, CountNumerical& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const CountNumerical* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, CountNumerical* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -138,64 +110,6 @@ class CountNumerical : public Numerical { } -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::CountNumerical& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive & ar, const dlplan::core::CountNumerical* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; - ar << t->m_element; - std::cout << "serialize count numerical" << std::endl; -} - -template -void load_construct_data(Archive & ar, dlplan::core::CountNumerical* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - std::shared_ptr element; - ar >> vocabulary; - ar >> index; - ar >> element; - ::new(t)dlplan::core::CountNumerical(index, vocabulary, element); -} - - -template -void serialize(Archive& /*ar*/, std::pair, std::weak_ptr>>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair, std::weak_ptr>>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair, std::weak_ptr>>* t, const unsigned int /*version*/) { - dlplan::core::CountNumerical* first = nullptr; - std::weak_ptr>* second = nullptr; - ar >> const_cast&>(*first); - ar >> second; - ::new(t)std::pair, std::weak_ptr>>(*first, *second); - delete first; - delete second; -} - - - -} - -BOOST_CLASS_EXPORT_KEY2(dlplan::core::CountNumerical, "dlplan::core::CountNumerical") -BOOST_CLASS_EXPORT_KEY2(dlplan::core::CountNumerical, "dlplan::core::CountNumerical") - - namespace std { template struct less>> diff --git a/src/core/elements/numericals/role_distance.cpp b/src/core/elements/numericals/role_distance.cpp index 44b81c97..981e137c 100644 --- a/src/core/elements/numericals/role_distance.cpp +++ b/src/core/elements/numericals/role_distance.cpp @@ -1,3 +1 @@ #include "role_distance.h" - -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::RoleDistanceNumerical) diff --git a/src/core/elements/numericals/role_distance.h b/src/core/elements/numericals/role_distance.h index 7e3aebd5..8c689166 100644 --- a/src/core/elements/numericals/role_distance.h +++ b/src/core/elements/numericals/role_distance.h @@ -4,12 +4,6 @@ #include "../utils.h" #include "../../../../include/dlplan/core.h" -#include -#include -#include -#include -#include - #include #include @@ -27,23 +21,6 @@ class RoleDistanceNumerical; } -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::core::RoleDistanceNumerical& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::RoleDistanceNumerical* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::RoleDistanceNumerical* t, const unsigned int version); - - template - void serialize(Archive& ar, std::pair>& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int version); - template - void load_construct_data(Archive& ar, std::pair>* t, const unsigned int version); -} - - namespace dlplan::core { class RoleDistanceNumerical : public Numerical { private: @@ -113,12 +90,6 @@ class RoleDistanceNumerical : public Numerical { : Numerical(vocabulary_info, index, role_from->is_static() && role->is_static() && role_to->is_static()), m_role_from(role_from), m_role(role), m_role_to(role_to) { } - template - friend void boost::serialization::serialize(Archive& ar, RoleDistanceNumerical& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const RoleDistanceNumerical* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, RoleDistanceNumerical* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -175,66 +146,6 @@ class RoleDistanceNumerical : public Numerical { } -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::RoleDistanceNumerical& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive & ar, const dlplan::core::RoleDistanceNumerical* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; - ar << t->m_role_from; - ar << t->m_role; - ar << t->m_role_to; -} - -template -void load_construct_data(Archive & ar, dlplan::core::RoleDistanceNumerical* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - std::shared_ptr role_from; - std::shared_ptr role; - std::shared_ptr role_to; - ar >> vocabulary; - ar >> index; - ar >> role_from; - ar >> role; - ar >> role_to; - ::new(t)dlplan::core::RoleDistanceNumerical(index, vocabulary, role_from, role, role_to); -} - - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::core::RoleDistanceNumerical* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -} - -BOOST_CLASS_EXPORT_KEY2(dlplan::core::RoleDistanceNumerical, "dlplan::core::RoleDistanceNumerical") - - namespace std { template<> struct less> diff --git a/src/core/elements/numericals/sum_concept_distance.cpp b/src/core/elements/numericals/sum_concept_distance.cpp index 11cf6d94..87f982ec 100644 --- a/src/core/elements/numericals/sum_concept_distance.cpp +++ b/src/core/elements/numericals/sum_concept_distance.cpp @@ -1,3 +1 @@ #include "sum_concept_distance.h" - -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::SumConceptDistanceNumerical) diff --git a/src/core/elements/numericals/sum_concept_distance.h b/src/core/elements/numericals/sum_concept_distance.h index 447bb67f..48b40d36 100644 --- a/src/core/elements/numericals/sum_concept_distance.h +++ b/src/core/elements/numericals/sum_concept_distance.h @@ -4,12 +4,6 @@ #include "../utils.h" #include "../../../../include/dlplan/core.h" -#include -#include -#include -#include -#include - #include #include @@ -22,21 +16,6 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::core { -class SumConceptDistanceNumerical; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::core::SumConceptDistanceNumerical& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::SumConceptDistanceNumerical* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::SumConceptDistanceNumerical* t, const unsigned int version); -} - - namespace dlplan::core { class SumConceptDistanceNumerical : public Numerical { private: @@ -103,12 +82,6 @@ class SumConceptDistanceNumerical : public Numerical { : Numerical(vocabulary_info, index, concept_from->is_static() && role->is_static() && concept_to->is_static()), m_concept_from(concept_from), m_role(role), m_concept_to(concept_to) { } - template - friend void boost::serialization::serialize(Archive& ar, SumConceptDistanceNumerical& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const SumConceptDistanceNumerical* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, SumConceptDistanceNumerical* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -165,66 +138,6 @@ class SumConceptDistanceNumerical : public Numerical { } -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::SumConceptDistanceNumerical& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive & ar, const dlplan::core::SumConceptDistanceNumerical* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; - ar << t->m_concept_from; - ar << t->m_role; - ar << t->m_concept_to; -} - -template -void load_construct_data(Archive & ar, dlplan::core::SumConceptDistanceNumerical* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - std::shared_ptr concept_from; - std::shared_ptr role; - std::shared_ptr concept_to; - ar >> vocabulary; - ar >> index; - ar >> concept_from; - ar >> role; - ar >> concept_to; - ::new(t)dlplan::core::SumConceptDistanceNumerical(index, vocabulary, concept_from, role, concept_to); -} - - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::core::SumConceptDistanceNumerical* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -} - -BOOST_CLASS_EXPORT_KEY2(dlplan::core::SumConceptDistanceNumerical, "dlplan::core::SumConceptDistanceNumerical") - - namespace std { template<> struct less> diff --git a/src/core/elements/numericals/sum_role_distance.cpp b/src/core/elements/numericals/sum_role_distance.cpp index 5cbdf2a3..4a8ff3ae 100644 --- a/src/core/elements/numericals/sum_role_distance.cpp +++ b/src/core/elements/numericals/sum_role_distance.cpp @@ -1,3 +1,2 @@ #include "sum_role_distance.h" -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::SumRoleDistanceNumerical) diff --git a/src/core/elements/numericals/sum_role_distance.h b/src/core/elements/numericals/sum_role_distance.h index a9317fb8..c13fd99a 100644 --- a/src/core/elements/numericals/sum_role_distance.h +++ b/src/core/elements/numericals/sum_role_distance.h @@ -4,12 +4,6 @@ #include "../utils.h" #include "../../../../include/dlplan/core.h" -#include -#include -#include -#include -#include - #include #include @@ -22,22 +16,6 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::core { -class SumRoleDistanceNumerical; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::core::SumRoleDistanceNumerical& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::SumRoleDistanceNumerical* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::SumRoleDistanceNumerical* t, const unsigned int version); - -} - - namespace dlplan::core { class SumRoleDistanceNumerical : public Numerical { private: @@ -109,12 +87,6 @@ class SumRoleDistanceNumerical : public Numerical { : Numerical(vocabulary_info, index, role_from->is_static() && role->is_static() && role_to->is_static()), m_role_from(role_from), m_role(role), m_role_to(role_to) { } - template - friend void boost::serialization::serialize(Archive& ar, SumRoleDistanceNumerical& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const SumRoleDistanceNumerical* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, SumRoleDistanceNumerical* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -171,66 +143,6 @@ class SumRoleDistanceNumerical : public Numerical { } -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::SumRoleDistanceNumerical& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& ar, const dlplan::core::SumRoleDistanceNumerical* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; - ar << t->m_role_from; - ar << t->m_role; - ar << t->m_role_to; -} - -template -void load_construct_data(Archive & ar, dlplan::core::SumRoleDistanceNumerical* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - std::shared_ptr role_from; - std::shared_ptr role; - std::shared_ptr role_to; - ar >> vocabulary; - ar >> index; - ar >> role_from; - ar >> role; - ar >> role_to; - ::new(t)dlplan::core::SumRoleDistanceNumerical(index, vocabulary, role_from, role, role_to); -} - - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::core::SumRoleDistanceNumerical* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -} - -BOOST_CLASS_EXPORT_KEY2(dlplan::core::SumRoleDistanceNumerical, "dlplan::core::SumRoleDistanceNumerical") - - namespace std { template<> struct less> diff --git a/src/core/elements/roles/and.cpp b/src/core/elements/roles/and.cpp index f28bbd75..b5b1aa51 100644 --- a/src/core/elements/roles/and.cpp +++ b/src/core/elements/roles/and.cpp @@ -1,11 +1,5 @@ #include "and.h" -#include -#include -#include -#include -#include - namespace dlplan::core { @@ -84,79 +78,3 @@ int AndRole::compute_evaluate_time_score() const { } } - - - -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::AndRole& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive & ar, const dlplan::core::AndRole* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; - ar << t->m_role_left; - ar << t->m_role_right; -} - -template -void load_construct_data(Archive & ar, dlplan::core::AndRole* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - std::shared_ptr role_left; - std::shared_ptr role_right; - ar >> vocabulary; - ar >> index; - ar >> role_left; - ar >> role_right; - ::new(t)dlplan::core::AndRole(index, vocabulary, role_left, role_right); -} - - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::core::AndRole* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::core::AndRole& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::core::AndRole& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const dlplan::core::AndRole* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - dlplan::core::AndRole* t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - std::pair>& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - std::pair>& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const std::pair>* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - std::pair>* t, const unsigned int version); -} - -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::AndRole) - diff --git a/src/core/elements/roles/and.h b/src/core/elements/roles/and.h index bdb7fba1..669d8bef 100644 --- a/src/core/elements/roles/and.h +++ b/src/core/elements/roles/and.h @@ -4,8 +4,6 @@ #include "../utils.h" #include "../../../../include/dlplan/core.h" -#include - #include #include @@ -18,28 +16,6 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::core { -class AndRole; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::core::AndRole& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::AndRole* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::AndRole* t, const unsigned int version); - - template - void serialize(Archive& ar, std::pair>& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int version); - template - void load_construct_data(Archive& ar, std::pair>* t, const unsigned int version); -} - - namespace dlplan::core { class AndRole : public Role { private: @@ -53,12 +29,6 @@ class AndRole : public Role { RoleDenotations evaluate_impl(const States& states, DenotationsCaches& caches) const override; AndRole(ElementIndex index, std::shared_ptr vocabulary_info, std::shared_ptr role_1, std::shared_ptr role_2); - template - friend void boost::serialization::serialize(Archive& ar, AndRole& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const AndRole* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, AndRole* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -78,8 +48,6 @@ class AndRole : public Role { } -BOOST_CLASS_EXPORT_KEY2(dlplan::core::AndRole, "dlplan::core::AndRole") - namespace std { template<> diff --git a/src/core/elements/roles/compose.cpp b/src/core/elements/roles/compose.cpp index 77f97cee..9ef56b53 100644 --- a/src/core/elements/roles/compose.cpp +++ b/src/core/elements/roles/compose.cpp @@ -1,3 +1 @@ #include "compose.h" - -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::ComposeRole) diff --git a/src/core/elements/roles/compose.h b/src/core/elements/roles/compose.h index 4b9b4c31..fd68ff08 100644 --- a/src/core/elements/roles/compose.h +++ b/src/core/elements/roles/compose.h @@ -4,12 +4,6 @@ #include "../utils.h" #include "../../../../include/dlplan/core.h" -#include -#include -#include -#include -#include - #include #include @@ -22,22 +16,6 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::core { -class ComposeRole; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::core::ComposeRole& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::ComposeRole* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::ComposeRole* t, const unsigned int version); - -} - - namespace dlplan::core { class ComposeRole : public Role { private: @@ -85,12 +63,6 @@ class ComposeRole : public Role { ComposeRole(ElementIndex index, std::shared_ptr vocabulary_info, std::shared_ptr role_left, std::shared_ptr role_right) : Role(vocabulary_info, index, role_left->is_static() && role_right->is_static()), m_role_left(role_left), m_role_right(role_right) { } - template - friend void boost::serialization::serialize(Archive& ar, ComposeRole& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const ComposeRole* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, ComposeRole* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -138,63 +110,6 @@ class ComposeRole : public Role { } -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::ComposeRole& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive & ar, const dlplan::core::ComposeRole* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; - ar << t->m_role_left; - ar << t->m_role_right; -} - -template -void load_construct_data(Archive & ar, dlplan::core::ComposeRole* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - std::shared_ptr role_left; - std::shared_ptr role_right; - ar >> vocabulary; - ar >> index; - ar >> role_left; - ar >> role_right; - ::new(t)dlplan::core::ComposeRole(index, vocabulary, role_left, role_right); -} - - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::core::ComposeRole* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -} - -BOOST_CLASS_EXPORT_KEY2(dlplan::core::ComposeRole, "dlplan::core::ComposeRole") - - namespace std { template<> struct less> diff --git a/src/core/elements/roles/diff.cpp b/src/core/elements/roles/diff.cpp index c858f3d6..713485ac 100644 --- a/src/core/elements/roles/diff.cpp +++ b/src/core/elements/roles/diff.cpp @@ -1,3 +1 @@ #include "diff.h" - -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::DiffRole) diff --git a/src/core/elements/roles/diff.h b/src/core/elements/roles/diff.h index 401d2063..1b471731 100644 --- a/src/core/elements/roles/diff.h +++ b/src/core/elements/roles/diff.h @@ -4,12 +4,6 @@ #include "../utils.h" #include "../../../../include/dlplan/core.h" -#include -#include -#include -#include -#include - #include #include @@ -22,21 +16,6 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::core { -class DiffRole; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::core::DiffRole& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::DiffRole* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::DiffRole* t, const unsigned int version); - -} - namespace dlplan::core { class DiffRole : public Role { @@ -77,12 +56,6 @@ class DiffRole : public Role { DiffRole(ElementIndex index, std::shared_ptr vocabulary_info, std::shared_ptr role_left, std::shared_ptr role_right) : Role(vocabulary_info, index, (role_left->is_static() && role_right->is_static())), m_role_left(role_left), m_role_right(role_right) { } - template - friend void boost::serialization::serialize(Archive& ar, DiffRole& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const DiffRole* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, DiffRole* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -130,63 +103,6 @@ class DiffRole : public Role { } -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::DiffRole& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive & ar, const dlplan::core::DiffRole* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; - ar << t->m_role_left; - ar << t->m_role_right; -} - -template -void load_construct_data(Archive & ar, dlplan::core::DiffRole* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - std::shared_ptr role_left; - std::shared_ptr role_right; - ar >> vocabulary; - ar >> index; - ar >> role_left; - ar >> role_right; - ::new(t)dlplan::core::DiffRole(index, vocabulary, role_left, role_right); -} - - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::core::DiffRole* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -} - -BOOST_CLASS_EXPORT_KEY2(dlplan::core::DiffRole, "dlplan::core::DiffRole") - - namespace std { template<> struct less> diff --git a/src/core/elements/roles/identity.cpp b/src/core/elements/roles/identity.cpp index 81e7bf86..6f5a7abc 100644 --- a/src/core/elements/roles/identity.cpp +++ b/src/core/elements/roles/identity.cpp @@ -1,3 +1,2 @@ #include "identity.h" -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::IdentityRole) diff --git a/src/core/elements/roles/identity.h b/src/core/elements/roles/identity.h index 03e4824b..7a2bab58 100644 --- a/src/core/elements/roles/identity.h +++ b/src/core/elements/roles/identity.h @@ -4,12 +4,6 @@ #include "../utils.h" #include "../../../../include/dlplan/core.h" -#include -#include -#include -#include -#include - #include #include @@ -22,21 +16,6 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::core { -class IdentityRole; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::core::IdentityRole& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::IdentityRole* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::IdentityRole* t, const unsigned int version); -} - - namespace dlplan::core { class IdentityRole : public Role { @@ -74,12 +53,6 @@ class IdentityRole : public Role { IdentityRole(ElementIndex index, std::shared_ptr vocabulary_info, std::shared_ptr concept) : Role(vocabulary_info, index, concept->is_static()), m_concept(concept) { } - template - friend void boost::serialization::serialize(Archive& ar, IdentityRole& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const IdentityRole* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, IdentityRole* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -123,60 +96,6 @@ class IdentityRole : public Role { } -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::IdentityRole& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive & ar, const dlplan::core::IdentityRole* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; - ar << t->m_concept; -} - -template -void load_construct_data(Archive & ar, dlplan::core::IdentityRole* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - std::shared_ptr concept_; - ar >> vocabulary; - ar >> index; - ar >> concept_; - ::new(t)dlplan::core::IdentityRole(index, vocabulary, concept_); -} - - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::core::IdentityRole* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -} - -BOOST_CLASS_EXPORT_KEY2(dlplan::core::IdentityRole, "dlplan::core::IdentityRole") - - namespace std { template<> struct less> diff --git a/src/core/elements/roles/inverse.cpp b/src/core/elements/roles/inverse.cpp index 24e0ba21..298bfea9 100644 --- a/src/core/elements/roles/inverse.cpp +++ b/src/core/elements/roles/inverse.cpp @@ -1,3 +1 @@ #include "inverse.h" - -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::InverseRole) diff --git a/src/core/elements/roles/inverse.h b/src/core/elements/roles/inverse.h index b99d5498..152eaf30 100644 --- a/src/core/elements/roles/inverse.h +++ b/src/core/elements/roles/inverse.h @@ -4,12 +4,6 @@ #include "../utils.h" #include "../../../../include/dlplan/core.h" -#include -#include -#include -#include -#include - #include #include @@ -22,21 +16,6 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::core { -class InverseRole; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::core::InverseRole& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::InverseRole* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::InverseRole* t, const unsigned int version); -} - - namespace dlplan::core { class InverseRole : public Role { private: @@ -73,12 +52,6 @@ class InverseRole : public Role { InverseRole(ElementIndex index, std::shared_ptr vocabulary_info, std::shared_ptr role) : Role(vocabulary_info, index, role->is_static()), m_role(role) { } - template - friend void boost::serialization::serialize(Archive& ar, InverseRole& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const InverseRole* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, InverseRole* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -122,60 +95,6 @@ class InverseRole : public Role { } -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::InverseRole& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive & ar, const dlplan::core::InverseRole* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; - ar << t->m_role; -} - -template -void load_construct_data(Archive & ar, dlplan::core::InverseRole* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - std::shared_ptr role; - ar >> vocabulary; - ar >> index; - ar >> role; - ::new(t)dlplan::core::InverseRole(index, vocabulary, role); -} - - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::core::InverseRole* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -} - -BOOST_CLASS_EXPORT_KEY2(dlplan::core::InverseRole, "dlplan::core::InverseRole") - - namespace std { template<> struct less> diff --git a/src/core/elements/roles/not.cpp b/src/core/elements/roles/not.cpp index 40268cf2..77795366 100644 --- a/src/core/elements/roles/not.cpp +++ b/src/core/elements/roles/not.cpp @@ -1,3 +1 @@ #include "not.h" - -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::NotRole) diff --git a/src/core/elements/roles/not.h b/src/core/elements/roles/not.h index a6534983..8b3e24da 100644 --- a/src/core/elements/roles/not.h +++ b/src/core/elements/roles/not.h @@ -4,12 +4,6 @@ #include "../utils.h" #include "../../../../include/dlplan/core.h" -#include -#include -#include -#include -#include - #include #include @@ -22,21 +16,6 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::core { -class NotRole; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::core::NotRole& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::NotRole* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::NotRole* t, const unsigned int version); -} - - namespace dlplan::core { class NotRole : public Role { private: @@ -72,12 +51,6 @@ class NotRole : public Role { NotRole(ElementIndex index, std::shared_ptr vocabulary_info, std::shared_ptr role) : Role(vocabulary_info, index, role->is_static()), m_role(role) { } - template - friend void boost::serialization::serialize(Archive& ar, NotRole& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const NotRole* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, NotRole* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -121,60 +94,6 @@ class NotRole : public Role { } -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::NotRole& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive & ar, const dlplan::core::NotRole* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; - ar << t->m_role; -} - -template -void load_construct_data(Archive & ar, dlplan::core::NotRole* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - std::shared_ptr role; - ar >> vocabulary; - ar >> index; - ar >> role; - ::new(t)dlplan::core::NotRole(index, vocabulary, role); -} - - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::core::NotRole* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -} - -BOOST_CLASS_EXPORT_KEY2(dlplan::core::NotRole, "dlplan::core::NotRole") - - namespace std { template<> struct less> diff --git a/src/core/elements/roles/or.cpp b/src/core/elements/roles/or.cpp index e4c00535..6205c39e 100644 --- a/src/core/elements/roles/or.cpp +++ b/src/core/elements/roles/or.cpp @@ -1,3 +1 @@ #include "or.h" - -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::OrRole) diff --git a/src/core/elements/roles/or.h b/src/core/elements/roles/or.h index 09d0bcf0..1897e9ac 100644 --- a/src/core/elements/roles/or.h +++ b/src/core/elements/roles/or.h @@ -4,12 +4,6 @@ #include "../utils.h" #include "../../../../include/dlplan/core.h" -#include -#include -#include -#include -#include - #include #include @@ -22,21 +16,6 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::core { -class OrRole; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::core::OrRole& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::OrRole* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::OrRole* t, const unsigned int version); -} - - namespace dlplan::core { class OrRole : public Role { private: @@ -78,12 +57,6 @@ class OrRole : public Role { m_role_left(role_1->get_index() < role_2->get_index() ? role_1 : role_2), m_role_right(role_1->get_index() < role_2->get_index() ? role_2 : role_1) { } - template - friend void boost::serialization::serialize(Archive& ar, OrRole& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const OrRole* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, OrRole* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -131,63 +104,6 @@ class OrRole : public Role { } -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::OrRole& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive & ar, const dlplan::core::OrRole* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; - ar << t->m_role_left; - ar << t->m_role_right; -} - -template -void load_construct_data(Archive & ar, dlplan::core::OrRole* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - std::shared_ptr role_left; - std::shared_ptr role_right; - ar >> vocabulary; - ar >> index; - ar >> role_left; - ar >> role_right; - ::new(t)dlplan::core::OrRole(index, vocabulary, role_left, role_right); -} - - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::core::OrRole* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -} - -BOOST_CLASS_EXPORT_KEY2(dlplan::core::OrRole, "dlplan::core::OrRole") - - namespace std { template<> struct less> diff --git a/src/core/elements/roles/primitive.cpp b/src/core/elements/roles/primitive.cpp index 1a9be270..ca8121b4 100644 --- a/src/core/elements/roles/primitive.cpp +++ b/src/core/elements/roles/primitive.cpp @@ -4,12 +4,6 @@ #include "../../../utils/collections.h" #include "../../../../include/dlplan/core.h" -#include -#include -#include -#include -#include - using namespace std::string_literals; @@ -103,83 +97,6 @@ const Predicate& PrimitiveRole::get_predicate() const { } -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::PrimitiveRole& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive & ar, const dlplan::core::PrimitiveRole* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; - ar << &t->m_predicate; - ar << t->m_pos_1; - ar << t->m_pos_2; -} - -template -void load_construct_data(Archive & ar, dlplan::core::PrimitiveRole* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - dlplan::core::Predicate* predicate; - int pos_1; - int pos_2; - ar >> vocabulary; - ar >> index; - ar >> predicate; - ar >> pos_1; - ar >> pos_2; - ::new(t)dlplan::core::PrimitiveRole(index, vocabulary, *predicate, pos_1, pos_2); - delete predicate; -} - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::core::PrimitiveRole* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::core::PrimitiveRole& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::core::PrimitiveRole& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const dlplan::core::PrimitiveRole* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - dlplan::core::PrimitiveRole* t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - std::pair>& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - std::pair>& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const std::pair>* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - std::pair>* t, const unsigned int version); -} - -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::PrimitiveRole) - - namespace std { bool less>::operator()( const std::shared_ptr& left_role, diff --git a/src/core/elements/roles/primitive.h b/src/core/elements/roles/primitive.h index 2c8ce4de..b0e6071f 100644 --- a/src/core/elements/roles/primitive.h +++ b/src/core/elements/roles/primitive.h @@ -3,10 +3,6 @@ #include "../../../../include/dlplan/core.h" -#include -#include -#include - #include #include @@ -17,29 +13,6 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::core { -class PrimitiveRole; -} - - -namespace boost::serialization { - class access; - template - void serialize(Archive& ar, dlplan::core::PrimitiveRole& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::PrimitiveRole* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::PrimitiveRole* t, const unsigned int version); - - template - void serialize(Archive& ar, std::pair>& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int version); - template - void load_construct_data(Archive& ar, std::pair>* t, const unsigned int version); -} - - namespace dlplan::core { class PrimitiveRole : public Role { private: @@ -55,13 +28,6 @@ class PrimitiveRole : public Role { PrimitiveRole(ElementIndex index, std::shared_ptr vocabulary_info, const Predicate& predicate, int pos_1, int pos_2); - friend class boost::serialization::access; - template - friend void boost::serialization::serialize(Archive& ar, PrimitiveRole& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const PrimitiveRole* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, PrimitiveRole* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -82,7 +48,6 @@ class PrimitiveRole : public Role { } -BOOST_CLASS_EXPORT_KEY2(dlplan::core::PrimitiveRole, "dlplan::core::PrimitiveRole") namespace std { template<> diff --git a/src/core/elements/roles/restrict.cpp b/src/core/elements/roles/restrict.cpp index 30701551..cd554e31 100644 --- a/src/core/elements/roles/restrict.cpp +++ b/src/core/elements/roles/restrict.cpp @@ -1,3 +1 @@ #include "restrict.h" - -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::RestrictRole) diff --git a/src/core/elements/roles/restrict.h b/src/core/elements/roles/restrict.h index dd39a4dd..c8a7f420 100644 --- a/src/core/elements/roles/restrict.h +++ b/src/core/elements/roles/restrict.h @@ -4,12 +4,6 @@ #include "../utils.h" #include "../../../../include/dlplan/core.h" -#include -#include -#include -#include -#include - #include #include @@ -22,21 +16,6 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::core { -class RestrictRole; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::core::RestrictRole& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::RestrictRole* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::RestrictRole* t, const unsigned int version); -} - - namespace dlplan::core { class RestrictRole : public Role { private: @@ -80,12 +59,6 @@ class RestrictRole : public Role { RestrictRole(ElementIndex index, std::shared_ptr vocabulary_info, std::shared_ptr role, std::shared_ptr concept) : Role(vocabulary_info, index, role->is_static() && concept->is_static()), m_role(role), m_concept(concept) { } - template - friend void boost::serialization::serialize(Archive& ar, RestrictRole& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const RestrictRole* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, RestrictRole* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -135,63 +108,6 @@ class RestrictRole : public Role { } -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::RestrictRole& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive & ar, const dlplan::core::RestrictRole* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; - ar << t->m_role; - ar << t->m_concept; -} - -template -void load_construct_data(Archive & ar, dlplan::core::RestrictRole* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - std::shared_ptr role; - std::shared_ptr concept_; - ar >> vocabulary; - ar >> index; - ar >> role; - ar >> concept_; - ::new(t)dlplan::core::RestrictRole(index, vocabulary, role, concept_); -} - - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::core::RestrictRole* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -} - -BOOST_CLASS_EXPORT_KEY2(dlplan::core::RestrictRole, "dlplan::core::RestrictRole") - - namespace std { template<> struct less> diff --git a/src/core/elements/roles/top.cpp b/src/core/elements/roles/top.cpp index a0d21b86..16ec9e05 100644 --- a/src/core/elements/roles/top.cpp +++ b/src/core/elements/roles/top.cpp @@ -1,3 +1 @@ #include "top.h" - -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::TopRole) diff --git a/src/core/elements/roles/top.h b/src/core/elements/roles/top.h index eaa221c3..d272fa45 100644 --- a/src/core/elements/roles/top.h +++ b/src/core/elements/roles/top.h @@ -4,12 +4,6 @@ #include "../utils.h" #include "../../../../include/dlplan/core.h" -#include -#include -#include -#include -#include - #include #include @@ -22,21 +16,6 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::core { -class TopRole; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::core::TopRole& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::TopRole* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::TopRole* t, const unsigned int version); -} - - namespace dlplan::core { class TopRole : public Role { private: @@ -60,12 +39,6 @@ class TopRole : public Role { TopRole(ElementIndex index, std::shared_ptr vocabulary_info) : Role(vocabulary_info, index, true) { } - template - friend void boost::serialization::serialize(Archive& ar, TopRole& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const TopRole* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, TopRole* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -105,57 +78,6 @@ class TopRole : public Role { } -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::TopRole& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive & ar, const dlplan::core::TopRole* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; -} - -template -void load_construct_data(Archive & ar, dlplan::core::TopRole* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - ar >> vocabulary; - ar >> index; - ::new(t)dlplan::core::TopRole(index, vocabulary); -} - - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::core::TopRole* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -} - -BOOST_CLASS_EXPORT_KEY2(dlplan::core::TopRole, "dlplan::core::TopRole") - - namespace std { template<> struct less> diff --git a/src/core/elements/roles/transitive_closure.cpp b/src/core/elements/roles/transitive_closure.cpp index 87f21400..01ce6d06 100644 --- a/src/core/elements/roles/transitive_closure.cpp +++ b/src/core/elements/roles/transitive_closure.cpp @@ -1,3 +1 @@ #include "transitive_closure.h" - -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::TransitiveClosureRole) diff --git a/src/core/elements/roles/transitive_closure.h b/src/core/elements/roles/transitive_closure.h index ba05b92f..790603a4 100644 --- a/src/core/elements/roles/transitive_closure.h +++ b/src/core/elements/roles/transitive_closure.h @@ -4,12 +4,6 @@ #include "../utils.h" #include "../../../../include/dlplan/core.h" -#include -#include -#include -#include -#include - #include #include @@ -22,21 +16,6 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::core { -class TransitiveClosureRole; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::core::TransitiveClosureRole& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::TransitiveClosureRole* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::TransitiveClosureRole* t, const unsigned int version); -} - - namespace dlplan::core { // https://stackoverflow.com/questions/3517524/what-is-the-best-known-transitive-closure-algorithm-for-a-directed-graph class TransitiveClosureRole : public Role { @@ -85,12 +64,6 @@ class TransitiveClosureRole : public Role { TransitiveClosureRole(ElementIndex index, std::shared_ptr vocabulary_info, std::shared_ptr role) : Role(vocabulary_info, index, role->is_static()), m_role(role) { } - template - friend void boost::serialization::serialize(Archive& ar, TransitiveClosureRole& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const TransitiveClosureRole* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, TransitiveClosureRole* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -134,60 +107,6 @@ class TransitiveClosureRole : public Role { } -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::TransitiveClosureRole& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive & ar, const dlplan::core::TransitiveClosureRole* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; - ar << t->m_role; -} - -template -void load_construct_data(Archive & ar, dlplan::core::TransitiveClosureRole* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - std::shared_ptr role; - ar >> vocabulary; - ar >> index; - ar >> role; - ::new(t)dlplan::core::TransitiveClosureRole(index, vocabulary, role); -} - - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::core::TransitiveClosureRole* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -} - -BOOST_CLASS_EXPORT_KEY2(dlplan::core::TransitiveClosureRole, "dlplan::core::TransitiveClosureRole") - - namespace std { template<> struct less> diff --git a/src/core/elements/roles/transitive_reflexive_closure.cpp b/src/core/elements/roles/transitive_reflexive_closure.cpp index dc05d2a8..b73db41a 100644 --- a/src/core/elements/roles/transitive_reflexive_closure.cpp +++ b/src/core/elements/roles/transitive_reflexive_closure.cpp @@ -1,3 +1,2 @@ #include "transitive_reflexive_closure.h" -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::core::TransitiveReflexiveClosureRole) diff --git a/src/core/elements/roles/transitive_reflexive_closure.h b/src/core/elements/roles/transitive_reflexive_closure.h index 68176e08..bea2f1b4 100644 --- a/src/core/elements/roles/transitive_reflexive_closure.h +++ b/src/core/elements/roles/transitive_reflexive_closure.h @@ -4,12 +4,6 @@ #include "../utils.h" #include "../../../../include/dlplan/core.h" -#include -#include -#include -#include -#include - #include #include @@ -22,21 +16,6 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::core { -class TransitiveReflexiveClosureRole; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::core::TransitiveReflexiveClosureRole& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::core::TransitiveReflexiveClosureRole* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::core::TransitiveReflexiveClosureRole* t, const unsigned int version); -} - - namespace dlplan::core { class TransitiveReflexiveClosureRole : public Role { private: @@ -90,12 +69,6 @@ class TransitiveReflexiveClosureRole : public Role { TransitiveReflexiveClosureRole(ElementIndex index, std::shared_ptr vocabulary_info, std::shared_ptr role) : Role(vocabulary_info, index, role->is_static()), m_role(role) { } - template - friend void boost::serialization::serialize(Archive& ar, TransitiveReflexiveClosureRole& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const TransitiveReflexiveClosureRole* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, TransitiveReflexiveClosureRole* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -141,60 +114,6 @@ class TransitiveReflexiveClosureRole : public Role { } -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::TransitiveReflexiveClosureRole& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive & ar, const dlplan::core::TransitiveReflexiveClosureRole* t, const unsigned int /* version */ ) -{ - ar << t->m_vocabulary_info; - ar << t->m_index; - ar << t->m_role; -} - -template -void load_construct_data(Archive & ar, dlplan::core::TransitiveReflexiveClosureRole* t, const unsigned int /* version */ ) -{ - std::shared_ptr vocabulary; - int index; - std::shared_ptr role; - ar >> vocabulary; - ar >> index; - ar >> role; - ::new(t)dlplan::core::TransitiveReflexiveClosureRole(index, vocabulary, role); -} - - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::core::TransitiveReflexiveClosureRole* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -} - -BOOST_CLASS_EXPORT_KEY2(dlplan::core::TransitiveReflexiveClosureRole, "dlplan::core::TransitiveReflexiveClosureRole") - - namespace std { template<> struct less> diff --git a/src/core/instance_info.cpp b/src/core/instance_info.cpp index 919b59d6..4be3de5c 100644 --- a/src/core/instance_info.cpp +++ b/src/core/instance_info.cpp @@ -3,12 +3,6 @@ #include "../utils/collections.h" #include "../utils/logging.h" -#include -#include -#include -#include -#include - #include #include #include @@ -203,23 +197,3 @@ void InstanceInfo::clear_static_atoms() { } } - - -namespace boost::serialization { -template -void serialize(Archive& ar, dlplan::core::InstanceInfo& t, const unsigned int /* version */) { - ar & t.m_vocabulary_info; - ar & t.m_index; - ar & t.m_objects; - ar & t.m_object_name_to_index; - ar & t.m_atoms; - ar & t.m_atom_name_to_index; - ar & t.m_static_atoms; - ar & t.m_static_atom_name_to_index; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::core::InstanceInfo& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::core::InstanceInfo& t, const unsigned int version); -} \ No newline at end of file diff --git a/src/core/numerical.cpp b/src/core/numerical.cpp index e62a6394..c7e406c2 100644 --- a/src/core/numerical.cpp +++ b/src/core/numerical.cpp @@ -1,7 +1,5 @@ #include "../../include/dlplan/core.h" -#include - namespace dlplan::core { Numerical::Numerical() { } @@ -48,22 +46,3 @@ const NumericalDenotations* Numerical::evaluate(const States& states, Denotation } } - - -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::Numerical& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& /* ar */ , const dlplan::core::Numerical* /* t */ , const unsigned int /* version */ ) -{ -} - -template -void load_construct_data(Archive& /* ar */ , dlplan::core::Numerical* /* t */ , const unsigned int /* version */ ) -{ -} -} diff --git a/src/core/object.cpp b/src/core/object.cpp index 4ed43c45..8340d349 100644 --- a/src/core/object.cpp +++ b/src/core/object.cpp @@ -1,8 +1,5 @@ #include "../../include/dlplan/core.h" -#include -#include - #include @@ -57,17 +54,3 @@ ObjectIndex Object::get_index() const { } } - - -namespace boost::serialization { -template -void serialize(Archive& ar, dlplan::core::Object& t, const unsigned int /* version */) { - ar & t.m_name; - ar & t.m_index; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::core::Object& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::core::Object& t, const unsigned int version); -} \ No newline at end of file diff --git a/src/core/predicate.cpp b/src/core/predicate.cpp index fa052507..d1aa5e73 100644 --- a/src/core/predicate.cpp +++ b/src/core/predicate.cpp @@ -1,8 +1,5 @@ #include "../../include/dlplan/core.h" -#include -#include - #include @@ -71,20 +68,3 @@ bool Predicate::is_static() const { } } - - -namespace boost::serialization { - -template -void serialize(Archive& ar, dlplan::core::Predicate& t, const unsigned int /* version */) { - ar & t.m_name; - ar & t.m_index; - ar & t.m_arity; - ar & t.m_is_static; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::core::Predicate& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::core::Predicate& t, const unsigned int version); -} \ No newline at end of file diff --git a/src/core/role.cpp b/src/core/role.cpp index ce48951b..7abb0cd7 100644 --- a/src/core/role.cpp +++ b/src/core/role.cpp @@ -1,7 +1,5 @@ #include "../../include/dlplan/core.h" -#include - namespace dlplan::core { Role::Role() { } @@ -48,24 +46,3 @@ const RoleDenotations* Role::evaluate(const States& states, DenotationsCaches& c } } - - -namespace boost::serialization { -template -void serialize(Archive& /* ar */ , dlplan::core::Role& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& /* ar */ , const dlplan::core::Role* /* t */ , const unsigned int /* version */ ) -{ -} - -template -void load_construct_data(Archive& /* ar */ , dlplan::core::Role* /* t */ , const unsigned int /* version */ ) -{ -} - -} - diff --git a/src/core/role_denotation.cpp b/src/core/role_denotation.cpp index 2b157b4c..25b3d0be 100644 --- a/src/core/role_denotation.cpp +++ b/src/core/role_denotation.cpp @@ -4,9 +4,6 @@ #include "../../include/dlplan/utils/hash.h" #include "../../include/dlplan/utils/dynamic_bitset.h" -#include -#include - #include @@ -136,18 +133,3 @@ int RoleDenotation::get_num_objects() const { } } - - -namespace boost::serialization { -template -void serialize(Archive& ar, dlplan::core::RoleDenotation& t, const unsigned int /* version */) { - ar & t.m_num_objects; - ar & t.m_data; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::core::RoleDenotation& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::core::RoleDenotation& t, const unsigned int version); - -} diff --git a/src/core/state.cpp b/src/core/state.cpp index aa07347d..37618456 100644 --- a/src/core/state.cpp +++ b/src/core/state.cpp @@ -4,11 +4,6 @@ #include "../utils/logging.h" #include "../../include/dlplan/utils/hash.h" -#include -#include -#include -#include - #include #include #include @@ -132,50 +127,3 @@ size_t State::hash() const { } } - -namespace boost::serialization { -template -void serialize(Archive& ar , dlplan::core::State& t, const unsigned int /* version */ ) -{ - ar & t.m_index; - ar & t.m_instance_info; - ar & t.m_atom_indices; -} - -template -void serialize(Archive& /* ar */ , std::pair& /* t */, const unsigned int /* version */ ) -{ -} - -template -void save_construct_data( - Archive & ar, const std::pair* t, const unsigned int /* version */ ){ - ar << t->first; - ar << &t->second; -} - -template -void load_construct_data( - Archive & ar, std::pair* t, const unsigned int /* version */ ){ - int first; - dlplan::core::State* second; - ar >> first; - ar >> second; - ::new(t)std::pair(first, std::move(*second)); - delete second; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::core::State& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::core::State& t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - std::pair& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - std::pair& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const std::pair* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - std::pair* t, const unsigned int version); -} diff --git a/src/core/vocabulary_info.cpp b/src/core/vocabulary_info.cpp index ea3dd7ec..a3e659e1 100644 --- a/src/core/vocabulary_info.cpp +++ b/src/core/vocabulary_info.cpp @@ -3,10 +3,6 @@ #include "../utils/collections.h" #include "../utils/logging.h" -#include -#include -#include - #include using namespace std::string_literals; @@ -97,20 +93,3 @@ std::string VocabularyInfo::str() const { } } - - -namespace boost::serialization { -template -void serialize( Archive& ar, dlplan::core::VocabularyInfo& t, const unsigned int /* version */ ) -{ - ar & t.m_constants; - ar & t.m_constant_name_to_index; - ar & t.m_predicates; - ar & t.m_predicate_name_to_index; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::core::VocabularyInfo& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::core::VocabularyInfo& t, const unsigned int version); -} diff --git a/src/novelty/novelty_base.cpp b/src/novelty/novelty_base.cpp index 9bc691b7..c21d06af 100644 --- a/src/novelty/novelty_base.cpp +++ b/src/novelty/novelty_base.cpp @@ -3,10 +3,6 @@ #include "../utils/math.h" #include "../utils/logging.h" -#include -#include -#include - #include #include #include @@ -75,19 +71,3 @@ int NoveltyBase::get_arity() const { } } - - -namespace boost::serialization { -template -void serialize(Archive& ar, dlplan::novelty::NoveltyBase& t, const unsigned int /* version */ ) -{ - ar & t.m_factors; - ar & t.m_num_atoms; - ar & t.m_arity; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::novelty::NoveltyBase& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::novelty::NoveltyBase& t, const unsigned int version); -} \ No newline at end of file diff --git a/src/novelty/tuple_graph.cpp b/src/novelty/tuple_graph.cpp index 8e77c243..abcb5bad 100644 --- a/src/novelty/tuple_graph.cpp +++ b/src/novelty/tuple_graph.cpp @@ -4,11 +4,6 @@ #include "tuple_index_generator.h" #include "../utils/logging.h" -#include -#include -#include -#include - #include #include @@ -230,21 +225,3 @@ const std::vector& TupleGraph::get_state_indices_by_d } - -namespace boost::serialization { -template -void serialize(Archive& ar, dlplan::novelty::TupleGraph& t, const unsigned int /* version */ ) -{ - ar & t.m_novelty_base; - ar & t.m_state_space; - ar & t.m_root_state_index; - ar & t.m_nodes; - ar & t.m_node_indices_by_distance; - ar & t.m_state_indices_by_distance; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::novelty::TupleGraph& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::novelty::TupleGraph& t, const unsigned int version); -} \ No newline at end of file diff --git a/src/novelty/tuple_node.cpp b/src/novelty/tuple_node.cpp index 5eeda900..555cdfae 100644 --- a/src/novelty/tuple_node.cpp +++ b/src/novelty/tuple_node.cpp @@ -2,10 +2,6 @@ #include "../utils/logging.h" -#include -#include -#include - #include using namespace dlplan::state_space; @@ -95,21 +91,3 @@ const TupleIndices& TupleNode::get_successors() const { } } - - -namespace boost::serialization { -template -void serialize(Archive& ar, dlplan::novelty::TupleNode& t, const unsigned int /* version */ ) -{ - ar & t.m_index; - ar & t.m_tuple_index; - ar & t.m_state_indices; - ar & t.m_predecessors; - ar & t.m_successors; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::novelty::TupleNode& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::novelty::TupleNode& t, const unsigned int version); -} \ No newline at end of file diff --git a/src/policy/CMakeLists.txt b/src/policy/CMakeLists.txt index 5a93086a..4c61df08 100644 --- a/src/policy/CMakeLists.txt +++ b/src/policy/CMakeLists.txt @@ -19,8 +19,6 @@ target_sources(dlplanpolicy ../common/parsers/filesystem.cpp) target_link_libraries(dlplanpolicy - PRIVATE - Boost::serialization PUBLIC dlplan::core) diff --git a/src/policy/boolean.cpp b/src/policy/boolean.cpp index d23969ba..68887c8f 100644 --- a/src/policy/boolean.cpp +++ b/src/policy/boolean.cpp @@ -3,18 +3,10 @@ #include "../../include/dlplan/core.h" #include "../../include/dlplan/utils/hash.h" -#include -#include -#include -#include -#include - #include namespace dlplan::policy { -NamedBoolean::NamedBoolean() : m_identifier(-1), m_key(""), m_boolean(nullptr) { } - NamedBoolean::NamedBoolean(int identifier, const std::string& key, std::shared_ptr boolean) : m_identifier(identifier), m_key(key), m_boolean(boolean) { } @@ -35,7 +27,9 @@ bool NamedBoolean::operator==(const NamedBoolean& other) const { } return true; } + bool NamedBoolean::operator<(const NamedBoolean& other) const { + return m_identifier < other.m_identifier; } size_t NamedBoolean::hash() const { @@ -63,49 +57,3 @@ std::shared_ptr NamedBoolean::get_boolean() const { } } - - -namespace boost::serialization { -template -void serialize(Archive& ar, dlplan::policy::NamedBoolean& t, const unsigned int /* version */ ) -{ - ar & t.m_identifier; - ar & t.m_key; - ar & t.m_boolean; -} - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::policy::NamedBoolean* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::policy::NamedBoolean& t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - std::pair>& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - std::pair>& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const std::pair>* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - std::pair>* t, const unsigned int version); -} - - diff --git a/src/policy/concept.cpp b/src/policy/concept.cpp index 71918337..b6716fb8 100644 --- a/src/policy/concept.cpp +++ b/src/policy/concept.cpp @@ -3,18 +3,10 @@ #include "../../include/dlplan/core.h" #include "../../include/dlplan/utils/hash.h" -#include -#include -#include -#include -#include - #include namespace dlplan::policy { -NamedConcept::NamedConcept() : m_identifier(-1), m_key(""), m_concept(nullptr) { } - NamedConcept::NamedConcept(int identifier, const std::string& key, std::shared_ptr concept) : m_identifier(identifier), m_key(key), m_concept(concept) { } @@ -35,7 +27,9 @@ bool NamedConcept::operator==(const NamedConcept& other) const { } return true; } + bool NamedConcept::operator<(const NamedConcept& other) const { + return m_identifier < other.m_identifier; } size_t NamedConcept::hash() const { @@ -63,50 +57,3 @@ std::shared_ptr NamedConcept::get_concept() const { } } - - -namespace boost::serialization { -template -void serialize(Archive& ar, dlplan::policy::NamedConcept& t, const unsigned int /* version */ ) -{ - ar & t.m_identifier; - ar & t.m_key; - ar & t.m_concept; -} - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::policy::NamedConcept* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::policy::NamedConcept& t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - std::pair>& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - std::pair>& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const std::pair>* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - std::pair>* t, const unsigned int version); - -} - - diff --git a/src/policy/condition.cpp b/src/policy/condition.cpp index d88cdc06..bebbbd53 100644 --- a/src/policy/condition.cpp +++ b/src/policy/condition.cpp @@ -4,11 +4,6 @@ #include "../../include/dlplan/core.h" #include "../../include/dlplan/utils/hash.h" -#include -#include -#include -#include - using namespace dlplan; @@ -188,313 +183,6 @@ std::string GreaterNumericalCondition::str() const { } -namespace boost::serialization { - -template -void serialize( Archive& /* ar */ , dlplan::policy::BooleanCondition& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& /* ar */ , const dlplan::policy::BooleanCondition* /* t */ , const unsigned int /* version */ ) -{ -} - -template -void load_construct_data(Archive& /* ar */ , dlplan::policy::BooleanCondition* /* t */ , const unsigned int /* version */ ) -{ -} - -template -void serialize( Archive& /* ar */ , dlplan::policy::NumericalCondition& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& /* ar */ , const dlplan::policy::NumericalCondition* /* t */ , const unsigned int /* version */ ) -{ -} - -template -void load_construct_data(Archive& /* ar */ , dlplan::policy::NumericalCondition* /* t */ , const unsigned int /* version */ ) -{ -} - -template -void serialize(Archive& /* ar */ , dlplan::policy::PositiveBooleanCondition& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& ar, const dlplan::policy::PositiveBooleanCondition* t, const unsigned int /* version */ ) -{ - ar << t->m_identifier; - ar << t->m_boolean; -} - -template -void load_construct_data(Archive& ar, dlplan::policy::PositiveBooleanCondition* t, const unsigned int /* version */ ) -{ - int identifier; - std::shared_ptr boolean; - ar >> identifier; - ar >> boolean; - ::new(t)dlplan::policy::PositiveBooleanCondition(identifier, boolean); -} - -template -void serialize(Archive& /* ar */ , dlplan::policy::NegativeBooleanCondition& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive & ar, const dlplan::policy::NegativeBooleanCondition* t, const unsigned int /* version */ ) -{ - ar << t->m_identifier; - ar << t->m_boolean; -} - -template -void load_construct_data(Archive & ar, dlplan::policy::NegativeBooleanCondition* t, const unsigned int /* version */ ) -{ - int identifier; - std::shared_ptr boolean; - ar >> identifier; - ar >> boolean; - ::new(t)dlplan::policy::NegativeBooleanCondition(identifier, boolean); -} - -template -void serialize(Archive& /* ar */ , dlplan::policy::GreaterNumericalCondition& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& ar, const dlplan::policy::GreaterNumericalCondition* t, const unsigned int /* version */ ) -{ - ar << t->m_identifier; - ar << t->m_numerical; -} - -template -void load_construct_data(Archive& ar, dlplan::policy::GreaterNumericalCondition* t, const unsigned int /* version */ ) -{ - int identifier; - std::shared_ptr numerical; - ar >> identifier; - ar >> numerical; - ::new(t)dlplan::policy::GreaterNumericalCondition(identifier, numerical); -} - -template -void serialize(Archive& /* ar */ , dlplan::policy::EqualNumericalCondition& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& ar, const dlplan::policy::EqualNumericalCondition* t, const unsigned int /* version */ ) -{ - ar << t->m_identifier; - ar << t->m_numerical; -} - -template -void load_construct_data(Archive& ar, dlplan::policy::EqualNumericalCondition* t, const unsigned int /* version */ ) -{ - int identifier; - std::shared_ptr numerical; - ar >> identifier; - ar >> numerical; - ::new(t)dlplan::policy::EqualNumericalCondition(identifier, numerical); -} - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::policy::PositiveBooleanCondition* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::policy::NegativeBooleanCondition* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::policy::GreaterNumericalCondition* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::policy::EqualNumericalCondition* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::policy::BooleanCondition& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::policy::BooleanCondition& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const dlplan::policy::BooleanCondition* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - dlplan::policy::BooleanCondition* t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::policy::PositiveBooleanCondition& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::policy::PositiveBooleanCondition& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const dlplan::policy::PositiveBooleanCondition* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - dlplan::policy::PositiveBooleanCondition* t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::policy::NegativeBooleanCondition& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::policy::NegativeBooleanCondition& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const dlplan::policy::NegativeBooleanCondition* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - dlplan::policy::NegativeBooleanCondition* t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::policy::NumericalCondition& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::policy::NumericalCondition& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const dlplan::policy::NumericalCondition* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - dlplan::policy::NumericalCondition* t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::policy::GreaterNumericalCondition& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::policy::GreaterNumericalCondition& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const dlplan::policy::GreaterNumericalCondition* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - dlplan::policy::GreaterNumericalCondition* t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::policy::EqualNumericalCondition& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::policy::EqualNumericalCondition& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const dlplan::policy::EqualNumericalCondition* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - dlplan::policy::EqualNumericalCondition* t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - std::pair>& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - std::pair>& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const std::pair>* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - std::pair>* t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - std::pair>& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - std::pair>& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const std::pair>* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - std::pair>* t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - std::pair>& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - std::pair>& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const std::pair>* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - std::pair>* t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - std::pair>& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - std::pair>& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const std::pair>* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - std::pair>* t, const unsigned int version); -} - -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::policy::PositiveBooleanCondition) -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::policy::NegativeBooleanCondition) -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::policy::GreaterNumericalCondition) -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::policy::EqualNumericalCondition) - - namespace std { bool less>::operator()( const std::shared_ptr& left_condition, diff --git a/src/policy/condition.h b/src/policy/condition.h index a57455c3..3a5da7ec 100644 --- a/src/policy/condition.h +++ b/src/policy/condition.h @@ -3,8 +3,6 @@ #include "../../include/dlplan/policy.h" -#include - #include #include @@ -17,100 +15,9 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::policy { -class BooleanCondition; -class NumericalCondition; -class PositiveBooleanCondition; -class NegativeBooleanCondition; -class EqualNumericalCondition; -class GreaterNumericalCondition; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::policy::BooleanCondition& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::policy::BooleanCondition* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::policy::BooleanCondition* t, const unsigned int version); - - template - void serialize(Archive& ar, dlplan::policy::NumericalCondition& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::policy::NumericalCondition* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::policy::NumericalCondition* t, const unsigned int version); - - template - void serialize(Archive& ar, dlplan::policy::PositiveBooleanCondition& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::policy::PositiveBooleanCondition* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::policy::PositiveBooleanCondition* t, const unsigned int version); - - template - void serialize(Archive& ar, dlplan::policy::NegativeBooleanCondition& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::policy::NegativeBooleanCondition* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::policy::NegativeBooleanCondition* t, const unsigned int version); - - template - void serialize(Archive& ar, dlplan::policy::EqualNumericalCondition& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::policy::EqualNumericalCondition* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::policy::EqualNumericalCondition* t, const unsigned int version); - - template - void serialize(Archive& ar, dlplan::policy::GreaterNumericalCondition& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::policy::GreaterNumericalCondition* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::policy::GreaterNumericalCondition* t, const unsigned int version); - - template - void serialize(Archive& ar, std::pair>& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int version); - template - void load_construct_data(Archive& ar, std::pair>* t, const unsigned int version); - - template - void serialize(Archive& ar, std::pair>& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int version); - template - void load_construct_data(Archive& ar, std::pair>* t, const unsigned int version); - - template - void serialize(Archive& ar, std::pair>& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int version); - template - void load_construct_data(Archive& ar, std::pair>* t, const unsigned int version); - - template - void serialize(Archive& ar, std::pair>& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int version); - template - void load_construct_data(Archive& ar, std::pair>* t, const unsigned int version); -} - - namespace dlplan::policy { class BooleanCondition : public BaseCondition { -private: - template - friend void boost::serialization::serialize(Archive& ar, BooleanCondition& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const BooleanCondition* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, BooleanCondition* t, const unsigned int version); - protected: const std::shared_ptr m_boolean; @@ -125,14 +32,6 @@ class BooleanCondition : public BaseCondition { class NumericalCondition : public BaseCondition { -private: - template - friend void boost::serialization::serialize(Archive& ar, NumericalCondition& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const NumericalCondition* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, NumericalCondition* t, const unsigned int version); - protected: const std::shared_ptr m_numerical; @@ -149,12 +48,6 @@ class PositiveBooleanCondition : public BooleanCondition { private: PositiveBooleanCondition(int identifier, std::shared_ptr boolean); - template - friend void boost::serialization::serialize(Archive& ar, PositiveBooleanCondition& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const PositiveBooleanCondition* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, PositiveBooleanCondition* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -174,12 +67,6 @@ class NegativeBooleanCondition : public BooleanCondition { private: NegativeBooleanCondition(int identifier, std::shared_ptr boolean); - template - friend void boost::serialization::serialize(Archive& ar, NegativeBooleanCondition& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const NegativeBooleanCondition* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, NegativeBooleanCondition* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -199,12 +86,6 @@ class EqualNumericalCondition : public NumericalCondition { private: EqualNumericalCondition(int identifier, std::shared_ptr numerical); - template - friend void boost::serialization::serialize(Archive& ar, EqualNumericalCondition& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const EqualNumericalCondition* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, EqualNumericalCondition* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -224,12 +105,6 @@ class GreaterNumericalCondition : public NumericalCondition { private: GreaterNumericalCondition(int identifier, std::shared_ptr numerical); - template - friend void boost::serialization::serialize(Archive& ar, GreaterNumericalCondition& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const GreaterNumericalCondition* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, GreaterNumericalCondition* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -247,11 +122,6 @@ class GreaterNumericalCondition : public NumericalCondition { } -BOOST_CLASS_EXPORT_KEY2(dlplan::policy::PositiveBooleanCondition, "dlplan::policy::PositiveBooleanCondition") -BOOST_CLASS_EXPORT_KEY2(dlplan::policy::NegativeBooleanCondition, "dlplan::policy::NegativeBooleanCondition") -BOOST_CLASS_EXPORT_KEY2(dlplan::policy::GreaterNumericalCondition, "dlplan::policy::GreaterNumericalCondition") -BOOST_CLASS_EXPORT_KEY2(dlplan::policy::EqualNumericalCondition, "dlplan::policy::EqualNumericalCondition") - namespace std { template<> diff --git a/src/policy/effect.cpp b/src/policy/effect.cpp index dcf0d876..d2cd1316 100644 --- a/src/policy/effect.cpp +++ b/src/policy/effect.cpp @@ -4,10 +4,6 @@ #include "../../include/dlplan/core.h" #include "../../include/dlplan/utils/hash.h" -#include -#include -#include -#include using namespace dlplan; @@ -263,437 +259,6 @@ std::string UnchangedNumericalEffect::str() const { } -namespace boost::serialization { -template -void serialize( Archive& /* ar */ , dlplan::policy::BooleanEffect& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& /* ar */ , const dlplan::policy::BooleanEffect* /* t */ , const unsigned int /* version */ ) -{ -} - -template -void load_construct_data(Archive& /* ar */ , dlplan::policy::BooleanEffect* /* t */ , const unsigned int /* version */ ) -{ -} - -template -void serialize( Archive& /* ar */ , dlplan::policy::NumericalEffect& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& /* ar */ , const dlplan::policy::NumericalEffect* /* t */ , const unsigned int /* version */ ) -{ -} - -template -void load_construct_data(Archive& /* ar */ , dlplan::policy::NumericalEffect* /* t */ , const unsigned int /* version */ ) -{ -} - -template -void serialize(Archive& /* ar */ , dlplan::policy::PositiveBooleanEffect& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& ar, const dlplan::policy::PositiveBooleanEffect* t, const unsigned int /* version */ ) -{ - ar << t->m_identifier; - ar << t->m_boolean; -} - -template -void load_construct_data(Archive& ar, dlplan::policy::PositiveBooleanEffect* t, const unsigned int /* version */ ) -{ - int identifier; - std::shared_ptr boolean; - ar >> identifier; - ar >> boolean; - ::new(t)dlplan::policy::PositiveBooleanEffect(identifier, boolean); -} - -template -void serialize(Archive& /* ar */ , dlplan::policy::NegativeBooleanEffect& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& ar, const dlplan::policy::NegativeBooleanEffect* t, const unsigned int /* version */ ) -{ - ar << t->m_identifier; - ar << t->m_boolean; -} - -template -void load_construct_data(Archive& ar, dlplan::policy::NegativeBooleanEffect* t, const unsigned int /* version */ ) -{ - int identifier; - std::shared_ptr boolean; - ar >> identifier; - ar >> boolean; - ::new(t)dlplan::policy::NegativeBooleanEffect(identifier, boolean); -} - -template -void serialize( Archive& /* ar */ , dlplan::policy::UnchangedBooleanEffect& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& ar, const dlplan::policy::UnchangedBooleanEffect* t, const unsigned int /* version */ ) -{ - ar << t->m_identifier; - ar << t->m_boolean; -} - -template -void load_construct_data(Archive& ar, dlplan::policy::UnchangedBooleanEffect* t, const unsigned int /* version */ ) -{ - int identifier; - std::shared_ptr boolean; - ar >> identifier; - ar >> boolean; - ::new(t)dlplan::policy::UnchangedBooleanEffect(identifier, boolean); -} - -template -void serialize(Archive& /* ar */ , dlplan::policy::IncrementNumericalEffect& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& ar, const dlplan::policy::IncrementNumericalEffect* t, const unsigned int /* version */ ) -{ - ar << t->m_identifier; - ar << t->m_numerical; -} - -template -void load_construct_data(Archive& ar, dlplan::policy::IncrementNumericalEffect* t, const unsigned int /* version */ ) -{ - int identifier; - std::shared_ptr numerical; - ar >> identifier; - ar >> numerical; - ::new(t)dlplan::policy::IncrementNumericalEffect(identifier, numerical); -} - -template -void serialize(Archive& /* ar */ , dlplan::policy::DecrementNumericalEffect& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& ar, const dlplan::policy::DecrementNumericalEffect* t, const unsigned int /* version */ ) -{ - ar << t->m_identifier; - ar << t->m_numerical; -} - -template -void load_construct_data(Archive& ar, dlplan::policy::DecrementNumericalEffect* t, const unsigned int /* version */ ) -{ - int identifier; - std::shared_ptr numerical; - ar >> identifier; - ar >> numerical; - ::new(t)dlplan::policy::DecrementNumericalEffect(identifier, numerical); -} - -template -void serialize(Archive& /* ar */ , dlplan::policy::UnchangedNumericalEffect& t, const unsigned int /* version */ ) -{ - boost::serialization::base_object(t); -} - -template -void save_construct_data(Archive& ar, const dlplan::policy::UnchangedNumericalEffect* t, const unsigned int /* version */ ) -{ - ar << t->m_identifier; - ar << t->m_numerical; -} - -template -void load_construct_data(Archive& ar, dlplan::policy::UnchangedNumericalEffect* t, const unsigned int /* version */ ) -{ - int identifier; - std::shared_ptr numerical; - ar >> identifier; - ar >> numerical; - ::new(t)dlplan::policy::UnchangedNumericalEffect(identifier, numerical); -} - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::policy::PositiveBooleanEffect* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::policy::NegativeBooleanEffect* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::policy::UnchangedBooleanEffect* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::policy::IncrementNumericalEffect* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::policy::DecrementNumericalEffect* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::policy::UnchangedNumericalEffect* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::policy::BooleanEffect& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::policy::BooleanEffect& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const dlplan::policy::BooleanEffect* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - dlplan::policy::BooleanEffect* t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::policy::PositiveBooleanEffect& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::policy::PositiveBooleanEffect& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const dlplan::policy::PositiveBooleanEffect* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - dlplan::policy::PositiveBooleanEffect* t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::policy::NegativeBooleanEffect& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::policy::NegativeBooleanEffect& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const dlplan::policy::NegativeBooleanEffect* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - dlplan::policy::NegativeBooleanEffect* t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::policy::UnchangedBooleanEffect& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::policy::UnchangedBooleanEffect& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const dlplan::policy::UnchangedBooleanEffect* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - dlplan::policy::UnchangedBooleanEffect* t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::policy::NumericalEffect& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::policy::NumericalEffect& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const dlplan::policy::NumericalEffect* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - dlplan::policy::NumericalEffect* t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::policy::IncrementNumericalEffect& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::policy::IncrementNumericalEffect& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const dlplan::policy::IncrementNumericalEffect* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - dlplan::policy::IncrementNumericalEffect* t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::policy::DecrementNumericalEffect& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::policy::DecrementNumericalEffect& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const dlplan::policy::DecrementNumericalEffect* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - dlplan::policy::DecrementNumericalEffect* t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::policy::UnchangedNumericalEffect& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::policy::UnchangedNumericalEffect& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const dlplan::policy::UnchangedNumericalEffect* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - dlplan::policy::UnchangedNumericalEffect* t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - std::pair>& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - std::pair>& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const std::pair>* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - std::pair>* t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - std::pair>& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - std::pair>& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const std::pair>* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - std::pair>* t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - std::pair>& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - std::pair>& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const std::pair>* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - std::pair>* t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - std::pair>& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - std::pair>& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const std::pair>* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - std::pair>* t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - std::pair>& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - std::pair>& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const std::pair>* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - std::pair>* t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - std::pair>& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - std::pair>& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const std::pair>* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - std::pair>* t, const unsigned int version); -} - -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::policy::PositiveBooleanEffect) -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::policy::NegativeBooleanEffect) -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::policy::UnchangedBooleanEffect) -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::policy::IncrementNumericalEffect) -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::policy::DecrementNumericalEffect) -BOOST_CLASS_EXPORT_IMPLEMENT(dlplan::policy::UnchangedNumericalEffect) - namespace std { bool less>::operator()( diff --git a/src/policy/effect.h b/src/policy/effect.h index 96d0fffb..ce5c6b6c 100644 --- a/src/policy/effect.h +++ b/src/policy/effect.h @@ -3,8 +3,6 @@ #include "../../include/dlplan/policy.h" -#include - #include #include #include @@ -16,130 +14,8 @@ class ReferenceCountedObjectFactory; } -namespace dlplan::policy { -class BooleanEffect; -class NumericalEffect; -class PositiveBooleanEffect; -class NegativeBooleanEffect; -class UnchangedBooleanEffect; -class IncrementNumericalEffect; -class DecrementNumericalEffect; -class UnchangedNumericalEffect; -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::policy::BooleanEffect& effect, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::policy::BooleanEffect* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::policy::BooleanEffect* t, const unsigned int version); - - template - void serialize(Archive& ar, dlplan::policy::NumericalEffect& effect, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::policy::NumericalEffect* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::policy::NumericalEffect* t, const unsigned int version); - - template - void serialize(Archive& ar, dlplan::policy::PositiveBooleanEffect& effect, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::policy::PositiveBooleanEffect* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::policy::PositiveBooleanEffect* t, const unsigned int version); - - template - void serialize(Archive& ar, dlplan::policy::NegativeBooleanEffect& effect, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::policy::NegativeBooleanEffect* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::policy::NegativeBooleanEffect* t, const unsigned int version); - - template - void serialize(Archive& ar, dlplan::policy::UnchangedBooleanEffect& effect, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::policy::UnchangedBooleanEffect* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::policy::UnchangedBooleanEffect* t, const unsigned int version); - - template - void serialize(Archive& ar, dlplan::policy::IncrementNumericalEffect& effect, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::policy::IncrementNumericalEffect* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::policy::IncrementNumericalEffect* t, const unsigned int version); - - template - void serialize(Archive& ar, dlplan::policy::DecrementNumericalEffect& effect, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::policy::DecrementNumericalEffect* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::policy::DecrementNumericalEffect* t, const unsigned int version); - - template - void serialize(Archive& ar, dlplan::policy::UnchangedNumericalEffect& effect, const unsigned int version); - template - void save_construct_data(Archive& ar, const dlplan::policy::UnchangedNumericalEffect* t, const unsigned int version); - template - void load_construct_data(Archive& ar, dlplan::policy::UnchangedNumericalEffect* t, const unsigned int version); - - template - void serialize(Archive& ar, std::pair>& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int version); - template - void load_construct_data(Archive& ar, std::pair>* t, const unsigned int version); - - template - void serialize(Archive& ar, std::pair>& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int version); - template - void load_construct_data(Archive& ar, std::pair>* t, const unsigned int version); - - template - void serialize(Archive& ar, std::pair>& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int version); - template - void load_construct_data(Archive& ar, std::pair>* t, const unsigned int version); - - template - void serialize(Archive& ar, std::pair>& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int version); - template - void load_construct_data(Archive& ar, std::pair>* t, const unsigned int version); - - template - void serialize(Archive& ar, std::pair>& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int version); - template - void load_construct_data(Archive& ar, std::pair>* t, const unsigned int version); - - - template - void serialize(Archive& ar, std::pair>& t, const unsigned int version); - template - void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int version); - template - void load_construct_data(Archive& ar, std::pair>* t, const unsigned int version); -} - - namespace dlplan::policy { class BooleanEffect : public BaseEffect { -private: - template - friend void boost::serialization::serialize(Archive& ar, BooleanEffect& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const BooleanEffect* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, BooleanEffect* t, const unsigned int version); - protected: std::shared_ptr m_boolean; @@ -153,14 +29,6 @@ class BooleanEffect : public BaseEffect { class NumericalEffect : public BaseEffect { -private: - template - friend void boost::serialization::serialize(Archive& ar, NumericalEffect& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const NumericalEffect* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, NumericalEffect* t, const unsigned int version); - protected: std::shared_ptr m_numerical; @@ -177,12 +45,6 @@ class PositiveBooleanEffect : public BooleanEffect { private: PositiveBooleanEffect(int identifier, std::shared_ptr boolean); - template - friend void boost::serialization::serialize(Archive& ar, PositiveBooleanEffect& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const PositiveBooleanEffect* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, PositiveBooleanEffect* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -202,12 +64,6 @@ class NegativeBooleanEffect : public BooleanEffect { private: NegativeBooleanEffect(int identifier, std::shared_ptr boolean); - template - friend void boost::serialization::serialize(Archive& ar, NegativeBooleanEffect& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const NegativeBooleanEffect* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, NegativeBooleanEffect* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -227,12 +83,6 @@ class UnchangedBooleanEffect : public BooleanEffect { private: UnchangedBooleanEffect(int identifier, std::shared_ptr boolean); - template - friend void boost::serialization::serialize(Archive& ar, UnchangedBooleanEffect& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const UnchangedBooleanEffect* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, UnchangedBooleanEffect* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -252,12 +102,6 @@ class IncrementNumericalEffect : public NumericalEffect { private: IncrementNumericalEffect(int identifier, std::shared_ptr numerical); - template - friend void boost::serialization::serialize(Archive& ar, IncrementNumericalEffect& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const IncrementNumericalEffect* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, IncrementNumericalEffect* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -277,12 +121,6 @@ class DecrementNumericalEffect : public NumericalEffect { private: DecrementNumericalEffect(int identifier, std::shared_ptr numerical); - template - friend void boost::serialization::serialize(Archive& ar, DecrementNumericalEffect& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const DecrementNumericalEffect* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, DecrementNumericalEffect* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -302,12 +140,6 @@ class UnchangedNumericalEffect : public NumericalEffect { private: UnchangedNumericalEffect(int identifier, std::shared_ptr numerical); - template - friend void boost::serialization::serialize(Archive& ar, UnchangedNumericalEffect& t, const unsigned int version); - template - friend void boost::serialization::save_construct_data(Archive& ar, const UnchangedNumericalEffect* t, const unsigned int version); - template - friend void boost::serialization::load_construct_data(Archive& ar, UnchangedNumericalEffect* t, const unsigned int version); template friend class dlplan::utils::ReferenceCountedObjectFactory; @@ -325,13 +157,6 @@ class UnchangedNumericalEffect : public NumericalEffect { } -BOOST_CLASS_EXPORT_KEY2(dlplan::policy::PositiveBooleanEffect, "dlplan::policy::PositiveBooleanEffect") -BOOST_CLASS_EXPORT_KEY2(dlplan::policy::NegativeBooleanEffect, "dlplan::policy::NegativeBooleanEffect") -BOOST_CLASS_EXPORT_KEY2(dlplan::policy::UnchangedBooleanEffect, "dlplan::policy::UnchangedBooleanEffect") -BOOST_CLASS_EXPORT_KEY2(dlplan::policy::IncrementNumericalEffect, "dlplan::policy::IncrementNumericalEffect") -BOOST_CLASS_EXPORT_KEY2(dlplan::policy::DecrementNumericalEffect, "dlplan::policy::DecrementNumericalEffect") -BOOST_CLASS_EXPORT_KEY2(dlplan::policy::UnchangedNumericalEffect, "dlplan::policy::UnchangedNumericalEffect") - namespace std { template<> diff --git a/src/policy/numerical.cpp b/src/policy/numerical.cpp index 8bca096e..c7eb7703 100644 --- a/src/policy/numerical.cpp +++ b/src/policy/numerical.cpp @@ -3,18 +3,10 @@ #include "../../include/dlplan/core.h" #include "../../include/dlplan/utils/hash.h" -#include -#include -#include -#include -#include - #include namespace dlplan::policy { -NamedNumerical::NamedNumerical() : m_identifier(-1), m_key(""), m_numerical(nullptr) { } - NamedNumerical::NamedNumerical(int identifier, const std::string& key, std::shared_ptr numerical) : m_identifier(identifier), m_key(key), m_numerical(numerical) { } @@ -35,7 +27,9 @@ bool NamedNumerical::operator==(const NamedNumerical& other) const { } return true; } + bool NamedNumerical::operator<(const NamedNumerical& other) const { + return m_identifier < other.m_identifier; } size_t NamedNumerical::hash() const { @@ -63,48 +57,3 @@ std::shared_ptr NamedNumerical::get_numerical() const { } } - - -namespace boost::serialization { -template -void serialize(Archive& ar, dlplan::policy::NamedNumerical& t, const unsigned int /* version */ ) -{ - ar & t.m_identifier; - ar & t.m_key; - ar & t.m_numerical; -} - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::policy::NamedNumerical* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::policy::NamedNumerical& t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - std::pair>& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - std::pair>& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const std::pair>* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - std::pair>* t, const unsigned int version); - -} diff --git a/src/policy/policy.cpp b/src/policy/policy.cpp index 98bbf460..57eee622 100644 --- a/src/policy/policy.cpp +++ b/src/policy/policy.cpp @@ -44,8 +44,6 @@ int BaseEffect::get_index() const { } -PolicyFactory::PolicyFactory() : m_pImpl(nullptr) { } - PolicyFactory::PolicyFactory(std::shared_ptr element_factory) : m_pImpl(PolicyFactoryImpl(element_factory)) { } @@ -157,68 +155,6 @@ std::shared_ptr PolicyFactory::get_element_factor } -namespace boost::serialization { -template -void serialize( Archive& /* ar */ , dlplan::policy::BaseCondition& /* t */ , const unsigned int /* version */ ) -{ -} - -template -void save_construct_data(Archive& /* ar */ , const dlplan::policy::BaseCondition* /* t */ , const unsigned int /* version */ ) -{ -} - -template -void load_construct_data(Archive& /* ar */ , dlplan::policy::BaseCondition* /* t */ , const unsigned int /* version */ ) -{ -} - -template -void serialize( Archive& /* ar */ , dlplan::policy::BaseEffect& /* t */ , const unsigned int /* version */ ) -{ -} - -template -void save_construct_data(Archive& /* ar */ , const dlplan::policy::BaseEffect* /* t */ , const unsigned int /* version */ ) -{ -} - -template -void load_construct_data(Archive& /* ar */ , dlplan::policy::BaseEffect* /* t */ , const unsigned int /* version */ ) -{ -} - -template -void serialize( Archive& ar, dlplan::policy::PolicyFactory& t, const unsigned int /* version */ ) -{ - ar & t.m_pImpl; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::policy::BaseCondition& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::policy::BaseCondition& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const dlplan::policy::BaseCondition* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - dlplan::policy::BaseCondition* t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::policy::BaseEffect& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::policy::BaseEffect& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const dlplan::policy::BaseEffect* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - dlplan::policy::BaseEffect* t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::policy::PolicyFactory& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::policy::PolicyFactory& t, const unsigned int version); -} - - namespace std { bool less>::operator()( const std::shared_ptr& left_boolean, diff --git a/src/policy/policy_factory.cpp b/src/policy/policy_factory.cpp index a8bce9e8..d8fe5632 100644 --- a/src/policy/policy_factory.cpp +++ b/src/policy/policy_factory.cpp @@ -7,8 +7,6 @@ #include "../../include/dlplan/policy/parsers/semantic/context.hpp" #include "../../include/dlplan/policy/parsers/semantic/parser.hpp" -#include -#include #include @@ -17,9 +15,6 @@ using namespace dlplan; namespace dlplan::policy { - -PolicyFactoryImpl::PolicyFactoryImpl() : m_element_factory(nullptr) { } - PolicyFactoryImpl::PolicyFactoryImpl(std::shared_ptr element_factory) : m_element_factory(element_factory) { } @@ -151,18 +146,3 @@ std::shared_ptr PolicyFactoryImpl::get_element_fa } } - - -namespace boost::serialization { -template -void serialize( Archive& ar, dlplan::policy::PolicyFactoryImpl& t, const unsigned int /* version */ ) -{ - ar & t.m_cache; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::policy::PolicyFactoryImpl& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::policy::PolicyFactoryImpl& t, const unsigned int version); - -} \ No newline at end of file diff --git a/src/policy/policy_factory.h b/src/policy/policy_factory.h index 202cb85c..1c36eefe 100644 --- a/src/policy/policy_factory.h +++ b/src/policy/policy_factory.h @@ -15,19 +15,6 @@ #include -namespace dlplan::policy { -class PolicyFactoryImpl; -} - - -namespace boost::serialization { - class access; - - template - void serialize(Archive& ar, dlplan::policy::PolicyFactoryImpl& t, const unsigned int version); -} - - namespace dlplan::policy { class PolicyFactoryImpl { private: @@ -50,13 +37,6 @@ class PolicyFactoryImpl { , Rule , Policy> m_cache; - /// @brief Constructor for serialization. - PolicyFactoryImpl(); - - friend class boost::serialization::access; - template - friend void boost::serialization::serialize(Archive& ar, PolicyFactoryImpl& t, const unsigned int version); - public: explicit PolicyFactoryImpl(std::shared_ptr element_factory); diff --git a/src/policy/policy_impl.cpp b/src/policy/policy_impl.cpp index ba571970..1ca6bcad 100644 --- a/src/policy/policy_impl.cpp +++ b/src/policy/policy_impl.cpp @@ -6,24 +6,12 @@ #include "../../include/dlplan/core.h" #include "../../include/dlplan/utils/hash.h" -#include -#include -#include -#include -#include - #include #include namespace dlplan::policy { -Policy::Policy() - : m_identifier(-1), - m_booleans(Booleans()), - m_numericals(Numericals()), - m_rules(Rules()) { } - Policy::Policy(int identifier, const Rules& rules) : m_identifier(identifier), m_rules(rules) { // Retrieve boolean and numericals from the rules. @@ -197,49 +185,3 @@ const Rules& Policy::get_rules() const { } } - - -namespace boost::serialization { -template -void serialize(Archive& ar, dlplan::policy::Policy& t, const unsigned int /* version */ ) -{ - ar & t.m_identifier; - ar & t.m_booleans; - ar & t.m_numericals; - ar & t.m_rules; -} - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::policy::Policy* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::policy::Policy& t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - std::pair>& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - std::pair>& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const std::pair>* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - std::pair>* t, const unsigned int version); - -} \ No newline at end of file diff --git a/src/policy/role.cpp b/src/policy/role.cpp index 10e1b2a0..7fc7c682 100644 --- a/src/policy/role.cpp +++ b/src/policy/role.cpp @@ -13,8 +13,6 @@ namespace dlplan::policy { -NamedRole::NamedRole() : m_identifier(-1), m_key(""), m_role(nullptr) { } - NamedRole::NamedRole(int identifier, const std::string& key, std::shared_ptr role) : m_identifier(identifier), m_key(key), m_role(role) { } @@ -35,7 +33,9 @@ bool NamedRole::operator==(const NamedRole& other) const { } return true; } + bool NamedRole::operator<(const NamedRole& other) const { + return m_identifier < other.m_identifier; } size_t NamedRole::hash() const { @@ -63,50 +63,3 @@ std::shared_ptr NamedRole::get_role() const { } } - - -namespace boost::serialization { -template -void serialize(Archive& ar, dlplan::policy::NamedRole& t, const unsigned int /* version */ ) -{ - ar & t.m_identifier; - ar & t.m_key; - ar & t.m_role; -} - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::policy::NamedRole* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::policy::NamedRole& t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - std::pair>& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - std::pair>& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const std::pair>* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - std::pair>* t, const unsigned int version); - -} - - diff --git a/src/policy/rule.cpp b/src/policy/rule.cpp index ebebdff9..28dc86a7 100644 --- a/src/policy/rule.cpp +++ b/src/policy/rule.cpp @@ -5,19 +5,11 @@ #include "../../include/dlplan/utils/hash.h" -#include -#include -#include -#include -#include - #include #include namespace dlplan::policy { -Rule::Rule() : m_identifier(-1), m_conditions(Conditions()), m_effects(Effects()) { } - Rule::Rule(int identifier, const Conditions& conditions, const Effects& effects) : m_identifier(identifier), m_conditions(conditions), m_effects(effects) { } @@ -151,47 +143,3 @@ const Effects& Rule::get_effects() const { } } - - -namespace boost::serialization { -template -void serialize(Archive& ar, dlplan::policy::Rule& t, const unsigned int /* version */ ) -{ - ar & t.m_identifier; - ar & t.m_conditions; - ar & t.m_effects; -} - -template -void serialize(Archive& /*ar*/, std::pair>& /*t*/, const unsigned int /*version*/) { -} - -template -void save_construct_data(Archive& ar, const std::pair>* t, const unsigned int /*version*/) { - ar << t->first; - ar << t->second; -} - -template -void load_construct_data(Archive& ar, std::pair>* t, const unsigned int /*version*/) { - dlplan::policy::Rule* first = nullptr; - std::weak_ptr* second = nullptr; - ar >> const_cast(*first); - ar >> second; - ::new(t)std::pair>(*first, *second); - delete first; - delete second; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::policy::Rule& t, const unsigned int version); - -template void serialize(boost::archive::text_iarchive& ar, - std::pair>& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - std::pair>& t, const unsigned int version); -template void save_construct_data(boost::archive::text_oarchive& ar, - const std::pair>* t, const unsigned int version); -template void load_construct_data(boost::archive::text_iarchive& ar, - std::pair>* t, const unsigned int version); -} \ No newline at end of file diff --git a/src/serialization/CMakeLists.txt b/src/serialization/CMakeLists.txt deleted file mode 100644 index 90cfc93c..00000000 --- a/src/serialization/CMakeLists.txt +++ /dev/null @@ -1,49 +0,0 @@ -add_library(dlplanserialization STATIC) -target_link_libraries(dlplanserialization - PRIVATE - Boost::serialization - PUBLIC - dlplan::novelty - dlplan::statespace - dlplan::novelty - dlplan::policy) - -# Create an alias for simpler reference -add_library(dlplan::serialization ALIAS dlplanserialization) -# Export component with simple name -set_property(TARGET dlplanserialization PROPERTY EXPORT_NAME serialization) - -target_sources(dlplanserialization - PRIVATE - serialization.cpp) - -# Use include depending on building or using from installed location -target_include_directories(dlplanserialization - PUBLIC - "$" - "$" -) - -# Install the target and create export-set -install( - TARGETS dlplanserialization - EXPORT dlplanserializationTargets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} -) - -# Generate and install export file -install(EXPORT dlplanserializationTargets - NAMESPACE dlplan:: - COMPONENT serialization - FILE dlplanserializationTargets.cmake - DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/dlplan" -) - -# Generate build tree export file -export(EXPORT dlplanserializationTargets - FILE "${CMAKE_CURRENT_BINARY_DIR}/cmake/dlplanserializationTargets.cmake" - NAMESPACE dlplan:: -) diff --git a/src/serialization/serialization.cpp b/src/serialization/serialization.cpp deleted file mode 100644 index 0c1da9bf..00000000 --- a/src/serialization/serialization.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include "../../include/dlplan/serialization.h" - -#include "../../include/dlplan/core.h" -#include "../../include/dlplan/novelty.h" -#include "../../include/dlplan/policy.h" -#include "../../include/dlplan/state_space.h" - -#include -#include -#include -#include -#include -#include - - - -namespace boost::serialization { -template -void serialize( Archive& ar, dlplan::serialization::Data& t, const unsigned int /* version */ ) -{ - //ar & t.vocabulary_infos; - //ar & t.instance_infos; - ar & t.syntatic_element_factories; - //ar & t.denotations_caches; - //ar & t.state_spaces; - //ar & t.tuple_graphs; - //ar & t.policies; - //ar & t.policy_factories; -} - -} - - - -namespace dlplan::serialization { - -void serialize(const Data& data, std::ostream& out_buffer) { - boost::archive::text_oarchive oa(out_buffer); - oa << data; -} - -Data deserialize(std::istream& buffer) { - boost::archive::text_iarchive ia(buffer); - Data data; - ia >> data; - return data; -} - -} - diff --git a/src/state_space/state_space.cpp b/src/state_space/state_space.cpp index 3c47107c..495bb638 100644 --- a/src/state_space/state_space.cpp +++ b/src/state_space/state_space.cpp @@ -5,14 +5,6 @@ #include "../utils/collections.h" #include "../utils/memory.h" -#include -#include -#include -#include -#include -#include -#include - #include #include #include @@ -35,13 +27,6 @@ static AdjacencyList compute_inverse_successor_state_indices(const AdjacencyList return inverse_successor_state_indices; } -StateSpace::StateSpace() - : m_instance_info(nullptr), - m_states(StateMapping()), - m_initial_state_index(-1), - m_forward_successor_state_indices(AdjacencyList()), - m_backward_successor_state_indices(AdjacencyList()) { } - StateSpace::StateSpace( std::shared_ptr&& instance_info, StateMapping&& states, @@ -376,23 +361,3 @@ GeneratorResult generate_state_space( } } - - -namespace boost::serialization { -template -void serialize( Archive& ar, dlplan::state_space::StateSpace& t, const unsigned int /* version */ ) -{ - ar & t.m_instance_info; - ar & t.m_states; - ar & t.m_initial_state_index; - ar & t.m_goal_state_indices; - ar & t.m_forward_successor_state_indices; - ar & t.m_backward_successor_state_indices; -} - -template void serialize(boost::archive::text_iarchive& ar, - dlplan::state_space::StateSpace& t, const unsigned int version); -template void serialize(boost::archive::text_oarchive& ar, - dlplan::state_space::StateSpace& t, const unsigned int version); - -} \ No newline at end of file diff --git a/src/utils/factory.h b/src/utils/factory.h index 7c723eb3..133416f5 100644 --- a/src/utils/factory.h +++ b/src/utils/factory.h @@ -1,8 +1,6 @@ #ifndef DLPLAN_SRC_UTILS_FACTORY_H_ #define DLPLAN_SRC_UTILS_FACTORY_H_ -#include -#include #include #include @@ -11,33 +9,6 @@ #include -namespace dlplan::utils { -template -class ReferenceCountedObjectFactory; - -template -struct PerTypeCache; -} - - -template -void boost::serialization::serialize(Archive &ar, std::tuple &t, const unsigned int) -{ - std::apply([&](auto &...element) - { ((ar & element), ...); }, - t); -} - - -namespace boost::serialization { - template - void serialize(Archive& ar, dlplan::utils::PerTypeCache& t, const unsigned int version); - - template - void serialize(Archive& ar, dlplan::utils::ReferenceCountedObjectFactory& t, const unsigned int version); -} - - namespace dlplan::utils { template struct PerTypeCache { @@ -63,9 +34,6 @@ class ReferenceCountedObjectFactory { // Identifiers are shared since types can be polymorphic int m_count = -1; - template - friend void boost::serialization::serialize(Archive& ar, ReferenceCountedObjectFactory& t, const unsigned int version); - public: ReferenceCountedObjectFactory() : m_cache((std::make_shared>())...) { } @@ -112,20 +80,4 @@ class ReferenceCountedObjectFactory { } - -namespace boost::serialization { -template -void serialize(Archive& ar, dlplan::utils::PerTypeCache& t, const unsigned int /*version*/) { - ar & t.data; -} - -template -void serialize(Archive& ar, dlplan::utils::ReferenceCountedObjectFactory& t, const unsigned int /* version */ ) -{ - ar & t.m_cache; - ar & t.m_count; -} - -} - #endif \ No newline at end of file diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b1cdee1a..3c929dfb 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -19,5 +19,4 @@ add_subdirectory(core) add_subdirectory(generator) add_subdirectory(novelty) add_subdirectory(policy) -add_subdirectory(serialization) add_subdirectory(state_space) diff --git a/tests/serialization/CMakeLists.txt b/tests/serialization/CMakeLists.txt deleted file mode 100644 index 6606c40d..00000000 --- a/tests/serialization/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -add_executable( - serialization_tests -) -target_sources( - serialization_tests - PRIVATE - serialization.cpp -) -target_link_libraries(serialization_tests - PRIVATE - dlplan::serialization - GTest::GTest) - -add_test(serialization_gtests serialization_tests) - -add_subdirectory(gripper) diff --git a/tests/serialization/gripper/CMakeLists.txt b/tests/serialization/gripper/CMakeLists.txt deleted file mode 100644 index fc3f94a2..00000000 --- a/tests/serialization/gripper/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -add_executable( - serialization_gripper_tests -) -target_sources( - serialization_gripper_tests - PRIVATE - gripper.cpp -) -add_custom_target(serialization_gripper_domain ALL - COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/domain.pddl" "${CMAKE_BINARY_DIR}/tests/serialization/gripper/domain.pddl") -add_custom_target(serialization_gripper_instance_1 ALL - COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/p-1-0.pddl" "${CMAKE_BINARY_DIR}/tests/serialization/gripper/p-1-0.pddl") - add_custom_target(serialization_gripper_instance_2 ALL - COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/p-2-0.pddl" "${CMAKE_BINARY_DIR}/tests/serialization/gripper/p-2-0.pddl") - - -target_link_libraries(serialization_gripper_tests - PRIVATE - dlplan::serialization - GTest::GTest) - -add_test(serialization_gtests serialization_gripper_tests) diff --git a/tests/serialization/gripper/domain.pddl b/tests/serialization/gripper/domain.pddl deleted file mode 100644 index 20f8f284..00000000 --- a/tests/serialization/gripper/domain.pddl +++ /dev/null @@ -1,35 +0,0 @@ -(define (domain gripper-strips) - (:constants rooma roomb) - (:predicates (room ?r) - (ball ?b) - (gripper ?g) - (at-robby ?r) - (at ?b ?r) - (free ?g) - (carry ?o ?g)) - - (:action move - :parameters (?from ?to) - :precondition (and (room ?from) (room ?to) (at-robby ?from)) - :effect (and (at-robby ?to) - (not (at-robby ?from)))) - - - - (:action pick - :parameters (?obj ?room ?gripper) - :precondition (and (ball ?obj) (room ?room) (gripper ?gripper) - (at ?obj ?room) (at-robby ?room) (free ?gripper)) - :effect (and (carry ?obj ?gripper) - (not (at ?obj ?room)) - (not (free ?gripper)))) - - - (:action drop - :parameters (?obj ?room ?gripper) - :precondition (and (ball ?obj) (room ?room) (gripper ?gripper) - (carry ?obj ?gripper) (at-robby ?room)) - :effect (and (at ?obj ?room) - (free ?gripper) - (not (carry ?obj ?gripper))))) - diff --git a/tests/serialization/gripper/gripper.cpp b/tests/serialization/gripper/gripper.cpp deleted file mode 100644 index b4177192..00000000 --- a/tests/serialization/gripper/gripper.cpp +++ /dev/null @@ -1,115 +0,0 @@ -#include - -#include "../../../include/dlplan/core.h" -#include "../../../include/dlplan/novelty.h" -#include "../../../include/dlplan/policy.h" -#include "../../../include/dlplan/state_space.h" -#include "../../../include/dlplan/serialization.h" - -#include - -using namespace dlplan::core; -using namespace dlplan::novelty; -using namespace dlplan::policy; -using namespace dlplan::state_space; -using namespace dlplan::serialization; - -namespace dlplan::serialization::tests { - -TEST(DLPTests, SerializationGripperTest) { - /* Serialization */ - auto result_1 = generate_state_space("domain.pddl", "p-1-0.pddl", nullptr, 0); - std::shared_ptr state_space_1 = std::move(result_1.state_space); - auto result_2 = generate_state_space("domain.pddl", "p-2-0.pddl", state_space_1->get_instance_info()->get_vocabulary_info(), 1); - std::shared_ptr state_space_2 = std::move(result_2.state_space); - Data out_data; - - // StateSpace - out_data.state_spaces.emplace("0", state_space_1); - out_data.state_spaces.emplace("1", state_space_2); - - // TupleGraph - auto novelty_base = std::make_shared(state_space_1->get_instance_info()->get_atoms().size(), 1); - for (const auto& pair : state_space_1->get_states()) { - out_data.tuple_graphs.emplace(std::to_string(state_space_1->get_instance_info()->get_index()) + "_" + std::to_string(pair.first), std::make_shared(novelty_base, state_space_1, pair.first)); - } - novelty_base = std::make_shared(state_space_2->get_instance_info()->get_atoms().size(), 1); - for (const auto& pair : state_space_2->get_states()) { - out_data.tuple_graphs.emplace(std::to_string(state_space_2->get_instance_info()->get_index()) + "_" + std::to_string(pair.first), std::make_shared(novelty_base, state_space_2, pair.first)); - } - - // VocabularyInfo - out_data.vocabulary_infos.emplace("0", state_space_1->get_instance_info()->get_vocabulary_info()); - out_data.vocabulary_infos.emplace("1", state_space_2->get_instance_info()->get_vocabulary_info()); - - // InstanceData - out_data.instance_infos.emplace("0", state_space_1->get_instance_info()); - out_data.instance_infos.emplace("1", state_space_2->get_instance_info()); - - // SyntacticElementFactory - auto element_factory = std::make_shared(state_space_1->get_instance_info()->get_vocabulary_info()); - auto numerical = element_factory->parse_numerical("n_count(c_primitive(free, 0))"); - auto boolean = element_factory->parse_boolean("b_empty(r_and(r_primitive(at, 0, 1), r_primitive(at_g, 0, 1)))"); - out_data.syntatic_element_factories.emplace("0", element_factory); - - // PolicyFactory - auto policy_factory = std::make_shared(element_factory); - auto policy_boolean = policy_factory->make_boolean("b0", boolean); - auto policy_numerical = policy_factory->make_numerical("n0", numerical); - auto c_n_gt = policy_factory->make_gt_condition(policy_numerical); - //auto e_n_dec = policy_factory->make_dec_effect(policy_numerical); - //auto c_b_pos = policy_factory->make_pos_condition(policy_boolean); - //auto e_b_neg = policy_factory->make_neg_effect(policy_boolean); - auto rule_1 = policy_factory->make_rule({c_n_gt}, {}); - auto rule_2 = policy_factory->make_rule({}, {}); - auto policy = policy_factory->make_policy({rule_1, rule_2}); - out_data.policy_factories.emplace("0", policy_factory); - - // Policy - out_data.policies.emplace("0", policy); - - // DenotationsCaches - auto denotations_caches_1 = std::make_shared(); - for (const auto& pair : state_space_1->get_states()) { - numerical->evaluate(pair.second, *denotations_caches_1); - } - auto denotations_caches_2 = std::make_shared(); - for (const auto& pair : state_space_2->get_states()) { - numerical->evaluate(pair.second, *denotations_caches_2); - } - out_data.denotations_caches.emplace("0", denotations_caches_1); - out_data.denotations_caches.emplace("1", denotations_caches_2); - - /* Deserialization */ - std::stringstream buffer; - dlplan::serialization::serialize(out_data, buffer); - std::cout << buffer.str() << std::endl; - - std::cout << "deserializing..." << std::endl; - dlplan::serialization::Data in_data = dlplan::serialization::deserialize(buffer); - - std::cout << "deserialized" << std::endl; - EXPECT_EQ(in_data.state_spaces.size(), 2); - EXPECT_NE(in_data.state_spaces.at("0")->get_instance_info(), in_data.state_spaces.at("1")->get_instance_info()); - EXPECT_EQ(in_data.state_spaces.at("0")->get_instance_info()->get_vocabulary_info(), in_data.state_spaces.at("1")->get_instance_info()->get_vocabulary_info()); - - EXPECT_EQ(in_data.tuple_graphs.size(), state_space_1->get_states().size() + state_space_2->get_states().size()); - EXPECT_EQ(in_data.tuple_graphs.count("0_0"), 1); - EXPECT_EQ(in_data.tuple_graphs.count("1_0"), 1); - - EXPECT_EQ(in_data.vocabulary_infos.size(), 2); - EXPECT_EQ(in_data.vocabulary_infos["0"], in_data.vocabulary_infos["1"]); - - EXPECT_EQ(in_data.instance_infos.size(), 2); - EXPECT_NE(in_data.instance_infos["0"], in_data.instance_infos["1"]); - - EXPECT_EQ(in_data.denotations_caches.size(), 2); - - EXPECT_EQ(in_data.syntatic_element_factories.size(), 1); - - EXPECT_EQ(in_data.policies.size(), 1); - - EXPECT_EQ(in_data.policy_factories.size(), 1); -} - -} diff --git a/tests/serialization/gripper/p-1-0.pddl b/tests/serialization/gripper/p-1-0.pddl deleted file mode 100644 index 1ac2c116..00000000 --- a/tests/serialization/gripper/p-1-0.pddl +++ /dev/null @@ -1,25 +0,0 @@ - - - -(define (problem gripper-1) -(:domain gripper-strips) -(:objects left right ball1 ) -(:init -(room rooma) -(room roomb) -(gripper left) -(gripper right) -(ball ball1) -(free left) -(free right) -(at ball1 rooma) -(at-robby rooma) -) -(:goal -(and -(at ball1 roomb) -) -) -) - - diff --git a/tests/serialization/gripper/p-2-0.pddl b/tests/serialization/gripper/p-2-0.pddl deleted file mode 100644 index fbce5269..00000000 --- a/tests/serialization/gripper/p-2-0.pddl +++ /dev/null @@ -1,28 +0,0 @@ - - - -(define (problem gripper-2) -(:domain gripper-strips) -(:objects left right ball1 ball2 ) -(:init -(room rooma) -(room roomb) -(gripper left) -(gripper right) -(ball ball1) -(ball ball2) -(free left) -(free right) -(at ball1 rooma) -(at ball2 rooma) -(at-robby rooma) -) -(:goal -(and -(at ball1 roomb) -(at ball2 roomb) -) -) -) - - diff --git a/tests/serialization/serialization.cpp b/tests/serialization/serialization.cpp deleted file mode 100644 index 5ac7f3f6..00000000 --- a/tests/serialization/serialization.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include - -#include "../../include/dlplan/state_space.h" -#include "../../include/dlplan/serialization.h" - -#include - - -namespace dlplan::serialization::tests { - -TEST(DLPTests, SerializationTestEmpty) { - std::stringstream buffer; - dlplan::serialization::Data out_data{}; - dlplan::serialization::serialize(out_data, buffer); - dlplan::serialization::Data in_data = dlplan::serialization::deserialize(buffer); - EXPECT_EQ(in_data.state_spaces.size(), 0); -} - -}