void test_template() { std::vector<char> buffer; { std::shared_ptr<C<float> > struct_a(new C<float>(777)); hpx::serialization::output_archive oarchive(buffer); oarchive << struct_a; } { std::shared_ptr<C<float> > struct_b; hpx::serialization::input_archive iarchive(buffer); iarchive >> struct_b; HPX_TEST_EQ(struct_b->c, 777); } }
void test_delegate() { std::vector<char> buffer; { std::shared_ptr<A> struct_a(new A(4711)); hpx::serialization::output_archive oarchive(buffer); oarchive << struct_a; } { std::shared_ptr<A> struct_b; hpx::serialization::input_archive iarchive(buffer); iarchive >> struct_b; HPX_TEST_EQ(struct_b->a, 4711); } }
void test_member() { std::vector<char> buffer; { boost::shared_ptr<A> struct_a(new E<float>(1, 2.3f)); hpx::serialization::output_archive oarchive(buffer); oarchive << struct_a; } { boost::shared_ptr<A> struct_b; hpx::serialization::input_archive iarchive(buffer); iarchive >> struct_b; HPX_TEST_EQ(struct_b->a, 1); HPX_TEST_EQ(dynamic_cast<E<float>*>(&*struct_b)->c.c, 2.3f); } }
void test_custom_factory() { std::vector<char> buffer; { std::shared_ptr<B> struct_a(new B(1981, false)); hpx::serialization::output_archive oarchive(buffer); oarchive << struct_a; } { std::shared_ptr<B> struct_b; hpx::serialization::input_archive iarchive(buffer); iarchive >> struct_b; HPX_TEST_EQ(struct_b->b, 1981); } }