32 #ifndef RDK_SUBSTRUCT_LIBRARY_SERIALIZATION
33 #define RDK_SUBSTRUCT_LIBRARY_SERIALIZATION
35 #ifdef RDK_USE_BOOST_SERIALIZATION
37 #include <boost/archive/text_oarchive.hpp>
38 #include <boost/archive/text_iarchive.hpp>
39 #include <boost/serialization/vector.hpp>
40 #include <boost/serialization/shared_ptr.hpp>
47 namespace serialization {
49 template <
class Archive>
51 const unsigned int version) {
56 template <
class Archive>
58 const unsigned int version) {
60 ar &boost::serialization::base_object<RDKit::MolHolderBase>(molholder);
62 std::int64_t pkl_count = molholder.
getMols().size();
65 for (
auto &mol : molholder.
getMols()) {
72 template <
class Archive>
74 const unsigned int version) {
76 ar &boost::serialization::base_object<RDKit::MolHolderBase>(molholder);
78 std::vector<boost::shared_ptr<RDKit::ROMol>> &mols = molholder.
getMols();
81 std::int64_t pkl_count = -1;
84 for (std::int64_t i = 0; i < pkl_count; ++i) {
87 mols.push_back(boost::make_shared<RDKit::ROMol>(pkl));
91 template <
class Archive,
class MolHolder>
92 void serialize_strings(Archive &ar, MolHolder &molholder,
93 const unsigned int version) {
95 ar &boost::serialization::base_object<RDKit::MolHolderBase>(molholder);
96 ar &molholder.getMols();
99 template <
class Archive>
101 const unsigned int version) {
102 serialize_strings(ar, molholder, version);
105 template <
class Archive>
107 const unsigned int version) {
108 serialize_strings(ar, molholder, version);
111 template <
class Archive>
113 const unsigned int version) {
114 serialize_strings(ar, molholder, version);
117 template <
class Archive>
119 const unsigned int version) {
121 std::vector<std::string> pickles;
123 pickles.push_back(fp->toString());
128 template <
class Archive>
130 const unsigned int version) {
132 std::vector<std::string> pickles;
136 for (
size_t i = 0; i < fps.size(); ++i)
delete fps[i];
139 for (
auto &pkl : pickles) {
144 template <
class Archive>
146 const unsigned int version) {
148 ar &boost::serialization::base_object<RDKit::FPHolderBase>(pattern_holder);
151 template <
class Archive>
152 void registerSubstructLibraryTypes(Archive &ar) {
160 template <
class Archive>
162 const unsigned int version) {
164 registerSubstructLibraryTypes(ar);
169 template <
class Archive>
171 const unsigned int version) {
173 registerSubstructLibraryTypes(ar);