32 using namespace gtsam;
33 using namespace gtsam::serializationTestHelpers;
70 template<
class T>
struct pack {
82 static Rot3 rt3 = Rot3::RzRyRx(1.0, 3.0, 2.0);
86 static Cal3DS2 cal2(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0);
89 TEST (Serialization, TemplatedValues) {
119 TEST(Serialization, NoiseModelFactor1_backwards_compatibility) {
122 noiseModel::Unit::Create(6));
126 roundtrip(
factor, factor_deserialized_str_2);
129 #if !defined(GTSAM_USE_QUATERNIONS) && !defined(GTSAM_USE_TBB)
131 std::string serialized_str =
132 "22 serialization::archive 15 1 0\n"
133 "0 0 0 0 0 0 0 1 0 12345 0 1 6 21 gtsam_noiseModel_Unit 1 0\n"
136 "3 0 0 0 0 6 0 1 0 0 0 6 1.00000000000000000e+00 1.00000000000000000e+00 "
137 "1.00000000000000000e+00 1.00000000000000000e+00 1.00000000000000000e+00 "
138 "1.00000000000000000e+00 6 1.00000000000000000e+00 "
139 "1.00000000000000000e+00 1.00000000000000000e+00 1.00000000000000000e+00 "
140 "1.00000000000000000e+00 1.00000000000000000e+00 1.00000000000000000e+00 "
141 "1.00000000000000000e+00 0 0 0 0 4.11982245665682978e-01 "
142 "-8.33737651774156818e-01 -3.67630462924899259e-01 "
143 "-5.87266449276209815e-02 -4.26917621276207360e-01 "
144 "9.02381585483330806e-01 -9.09297426825681709e-01 "
145 "-3.50175488374014632e-01 -2.24845095366152908e-01 0 0 "
146 "4.00000000000000000e+00 5.00000000000000000e+00 "
147 "6.00000000000000000e+00\n";
150 deserializeFromString(serialized_str, factor_deserialized_str);
155 #if !defined(__QNX__)
156 deserializeFromXMLFile(GTSAM_SOURCE_TREE_DATASET_DIR
157 "/../../gtsam/nonlinear/tests/priorFactor.xml",
158 factor_deserialized_xml);
165 bool c = deserializeFromXMLFile(
167 factor_deserialized_xml);
178 initialValues.
clear();
180 gtsam::Vector6 temp6;
181 for (
int i = 0;
i < 6; ++
i) {
194 std::string binaryPath =
"saved_solver.dat";
196 std::ofstream outputStream(binaryPath,
std::ios::out | std::ios::binary);
197 boost::archive::binary_oarchive outputArchive(outputStream);
205 std::ifstream ifs(binaryPath, std::ios::in | std::ios::binary);
206 boost::archive::binary_iarchive inputArchive(ifs);
207 inputArchive >> solverFromDisk;
215 }
catch(std::exception &
e) {
221 }
catch(std::exception &
e) {