diff --git a/src/OpaqueVal.cc b/src/OpaqueVal.cc index 694fa0ba77..8a94153014 100644 --- a/src/OpaqueVal.cc +++ b/src/OpaqueVal.cc @@ -1047,36 +1047,42 @@ bool ParaglobVal::operator==(const ParaglobVal& other) const return *(this->internal_paraglob) == *(other.internal_paraglob); } -IMPLEMENT_SERIAL(ParaglobVal, SER_PARAGLOB_VAL) +IMPLEMENT_OPAQUE_VALUE(ParaglobVal) -bool ParaglobVal::DoSerialize(SerialInfo* info) const +broker::expected ParaglobVal::DoSerialize() const { - DO_SERIALIZE(SER_PARAGLOB_VAL, OpaqueVal) - + broker::vector d; std::unique_ptr> iv = this->internal_paraglob->serialize(); - - return SERIALIZE(iv.get()); + for (uint8_t a : *(iv.get())) + d.emplace_back(static_cast(a)); + return {std::move(d)}; } -bool ParaglobVal::DoUnserialize(UnserialInfo* info) +bool ParaglobVal::DoUnserialize(const broker::data& data) { - DO_UNSERIALIZE(OpaqueVal) + auto d = caf::get_if(&data); + if ( ! d ) + return false; std::unique_ptr> iv (new std::vector); + iv->resize(d->size()); - bool success = UNSERIALIZE(iv.get()); + for (std::vector::size_type i = 0; i < d->size(); ++i) + { + get_vector_idx(*d, i, iv.get()->data() + i); + } try { this->internal_paraglob = build_unique(std::move(iv)); } catch (const paraglob::underflow_error& e) { - reporter->Error(e.what()); + reporter->Error("Paraglob underflow error -> %s", e.what()); return false; } catch (const paraglob::overflow_error& e) { - reporter->Error(e.what()); + reporter->Error("Paraglob overflow error -> %s", e.what()); return false; } - return success; + return true; } Val* ParaglobVal::DoClone(CloneState* state) diff --git a/src/OpaqueVal.h b/src/OpaqueVal.h index cc6d63a1e7..aa47efb49d 100644 --- a/src/OpaqueVal.h +++ b/src/OpaqueVal.h @@ -3,12 +3,9 @@ #ifndef OPAQUEVAL_H #define OPAQUEVAL_H -<<<<<<< HEAD #include #include // std::unique_ptr -======= ->>>>>>> upstream/master #include "RandTest.h" #include "Val.h" #include "digest.h" @@ -333,6 +330,8 @@ public: protected: ParaglobVal() : OpaqueVal(paraglob_type) {} + DECLARE_OPAQUE_VALUE(ParaglobVal) + private: std::unique_ptr internal_paraglob; // Small convenience function. Does what std::make_unique does in C++14. Wont @@ -341,8 +340,6 @@ private: std::unique_ptr build_unique (Args&&... args) { return std::unique_ptr(new T(std::forward(args)...)); } - - DECLARE_SERIAL(ParaglobVal) }; #endif