Add serialization functions that call base classes, to avoid "unregistered void cast" errors (in MATLAB, as flagged by issue #398), as mentioned in http://tb-nguyen.blogspot.com/2009/08/more-on-using-boost-serialization-and.html
parent
63acd1a50c
commit
3b3e393817
|
@ -266,6 +266,13 @@ class ExpressionFactor2 : public ExpressionFactor<T> {
|
||||||
virtual Expression<T> expression() const {
|
virtual Expression<T> expression() const {
|
||||||
return expression(this->keys_[0], this->keys_[1]);
|
return expression(this->keys_[0], this->keys_[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
friend class boost::serialization::access;
|
||||||
|
template <class ARCHIVE>
|
||||||
|
void serialize(ARCHIVE& ar, const unsigned int /*version*/) {
|
||||||
|
ar& boost::serialization::make_nvp(
|
||||||
|
"ExpressionFactor", boost::serialization::base_object<ExpressionFactor<T> >(*this));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
// ExpressionFactor2
|
// ExpressionFactor2
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,14 @@ struct BearingFactor : public ExpressionFactor2<T, A1, A2> {
|
||||||
std::cout << s << "BearingFactor" << std::endl;
|
std::cout << s << "BearingFactor" << std::endl;
|
||||||
Base::print(s, kf);
|
Base::print(s, kf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
friend class boost::serialization::access;
|
||||||
|
template <class ARCHIVE>
|
||||||
|
void serialize(ARCHIVE& ar, const unsigned int /*version*/) {
|
||||||
|
ar& boost::serialization::make_nvp(
|
||||||
|
"Base", boost::serialization::base_object<Base>(*this));
|
||||||
|
}
|
||||||
}; // BearingFactor
|
}; // BearingFactor
|
||||||
|
|
||||||
/// traits
|
/// traits
|
||||||
|
|
|
@ -73,6 +73,14 @@ class BearingRangeFactor
|
||||||
Base::print(s, kf);
|
Base::print(s, kf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
friend class boost::serialization::access;
|
||||||
|
template <class ARCHIVE>
|
||||||
|
void serialize(ARCHIVE& ar, const unsigned int /*version*/) {
|
||||||
|
ar& boost::serialization::make_nvp(
|
||||||
|
"Base", boost::serialization::base_object<Base>(*this));
|
||||||
|
}
|
||||||
}; // BearingRangeFactor
|
}; // BearingRangeFactor
|
||||||
|
|
||||||
/// traits
|
/// traits
|
||||||
|
|
|
@ -65,6 +65,14 @@ class RangeFactor : public ExpressionFactor2<T, A1, A2> {
|
||||||
std::cout << s << "RangeFactor" << std::endl;
|
std::cout << s << "RangeFactor" << std::endl;
|
||||||
Base::print(s, kf);
|
Base::print(s, kf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
friend class boost::serialization::access;
|
||||||
|
template <class ARCHIVE>
|
||||||
|
void serialize(ARCHIVE& ar, const unsigned int /*version*/) {
|
||||||
|
ar& boost::serialization::make_nvp(
|
||||||
|
"Base", boost::serialization::base_object<Base>(*this));
|
||||||
|
}
|
||||||
}; // \ RangeFactor
|
}; // \ RangeFactor
|
||||||
|
|
||||||
/// traits
|
/// traits
|
||||||
|
|
Loading…
Reference in New Issue