本文整理匯總了C++中BOOST_SERIALIZATION_NVP函數的典型用法代碼示例。如果您正苦於以下問題:C++ BOOST_SERIALIZATION_NVP函數的具體用法?C++ BOOST_SERIALIZATION_NVP怎麽用?C++ BOOST_SERIALIZATION_NVP使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了BOOST_SERIALIZATION_NVP函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: BOOST_SERIALIZATION_NVP
void GalaxySetupData::serialize(Archive& ar, const unsigned int version)
{
ar & BOOST_SERIALIZATION_NVP(m_seed)
& BOOST_SERIALIZATION_NVP(m_size)
& BOOST_SERIALIZATION_NVP(m_shape)
& BOOST_SERIALIZATION_NVP(m_age)
& BOOST_SERIALIZATION_NVP(m_starlane_freq)
& BOOST_SERIALIZATION_NVP(m_planet_density)
& BOOST_SERIALIZATION_NVP(m_specials_freq)
& BOOST_SERIALIZATION_NVP(m_monster_freq)
& BOOST_SERIALIZATION_NVP(m_native_freq)
& BOOST_SERIALIZATION_NVP(m_ai_aggr);
if (version >= 1) {
ar & BOOST_SERIALIZATION_NVP(m_game_rules);
}
if (version >= 2) {
ar & BOOST_SERIALIZATION_NVP(m_game_uid);
} else {
if (Archive::is_loading::value) {
m_game_uid = boost::uuids::to_string(boost::uuids::random_generator()());
}
}
}
示例2: serialize
void
SimplexWithVertices<V>::
serialize(Archive& ar, version_type )
{ ar & BOOST_SERIALIZATION_NVP(vertices_); }
示例3: operator
void operator()(T const & value) const
{
m_ar << BOOST_SERIALIZATION_NVP(value);
}
示例4: load_derived
void load_derived(const char *testfile)
{
test_istream is(testfile, TEST_STREAM_FLAGS);
test_iarchive ia(is);
polymorphic_derived1 *rd1 = NULL;
polymorphic_derived2 *rd2 = NULL;
std::cout << "loading polymorphic_derived1 (no_rtti)\n";
ia >> BOOST_SERIALIZATION_NVP(rd1);
BOOST_CHECK_MESSAGE(
boost::serialization::type_info_implementation<
polymorphic_derived1
>::type::get_const_instance()
==
* boost::serialization::type_info_implementation<
polymorphic_derived1
>::type::get_const_instance().get_derived_extended_type_info(*rd1)
,
"restored pointer d1 not of correct type"
);
std::cout << "loading polymorphic_derived2\n";
ia >> BOOST_SERIALIZATION_NVP(rd2);
BOOST_CHECK_MESSAGE(
boost::serialization::type_info_implementation<
polymorphic_derived2
>::type::get_const_instance()
==
* boost::serialization::type_info_implementation<
polymorphic_derived2
>::type::get_const_instance().get_derived_extended_type_info(*rd2)
,
"restored pointer d2 not of correct type"
);
polymorphic_base *rb1 = NULL;
polymorphic_base *rb2 = NULL;
// the above opereration registers the derived classes as a side
// effect. Hence, instances can now be correctly serialized through
// a base class pointer.
std::cout << "loading polymorphic_derived1 (no_rtti) through base (no_rtti)\n";
ia >> BOOST_SERIALIZATION_NVP(rb1);
BOOST_CHECK_MESSAGE(
rb1 == dynamic_cast<polymorphic_base *>(rd1),
"serialized pointers not correctly restored"
);
BOOST_CHECK_MESSAGE(
boost::serialization::type_info_implementation<
polymorphic_derived1
>::type::get_const_instance()
==
* boost::serialization::type_info_implementation<
polymorphic_base
>::type::get_const_instance().get_derived_extended_type_info(*rb1)
,
"restored pointer b1 not of correct type"
);
std::cout << "loading polymorphic_derived2 through base (no_rtti)\n";
ia >> BOOST_SERIALIZATION_NVP(rb2);
BOOST_CHECK_MESSAGE(
rb2 == dynamic_cast<polymorphic_base *>(rd2),
"serialized pointers not correctly restored"
);
BOOST_CHECK_MESSAGE(
boost::serialization::type_info_implementation<
polymorphic_derived2
>::type::get_const_instance()
==
* boost::serialization::type_info_implementation<
polymorphic_base
>::type::get_const_instance().get_derived_extended_type_info(*rb2)
,
"restored pointer b2 not of correct type"
);
delete rb1;
delete rb2;
}
示例5: serialize
void serialize( Archive & ar, const unsigned int version )
{
ar & BOOST_SERIALIZATION_NVP(m_type);
ar & BOOST_SERIALIZATION_NVP(m_seq);
ar & BOOST_SERIALIZATION_NVP(m_group);
ar & BOOST_SERIALIZATION_NVP(m_source);
ar & BOOST_SERIALIZATION_NVP(m_hostname);
ar & BOOST_SERIALIZATION_NVP(m_ResponseType);
ar & BOOST_SERIALIZATION_NVP(m_Response);
ar & BOOST_SERIALIZATION_NVP(cmd_);
ar & BOOST_SERIALIZATION_NVP(path_from_);
ar & BOOST_SERIALIZATION_NVP(path_to_);
ar & BOOST_SERIALIZATION_NVP(mode_);
};
示例6: serialize
template<class ArchiveT> void serialize(ArchiveT & ar, unsigned int version){ ar & BOOST_SERIALIZATION_NVP(contact); ar & BOOST_SERIALIZATION_NVP(force); }
示例7: serialize
void serialize(Archive &ar, const unsigned int version)
{
ar & BOOST_SERIALIZATION_NVP(data_ptr);
}
示例8: BOOST_SERIALIZATION_BASE_OBJECT_NVP
void WeaponFireEvent::serialize(Archive& ar, const unsigned int version) {
ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(CombatEvent);
ar & BOOST_SERIALIZATION_NVP(bout)
& BOOST_SERIALIZATION_NVP(round)
& BOOST_SERIALIZATION_NVP(attacker_id)
& BOOST_SERIALIZATION_NVP(target_id)
& BOOST_SERIALIZATION_NVP(weapon_name)
& BOOST_SERIALIZATION_NVP(power)
& BOOST_SERIALIZATION_NVP(shield)
& BOOST_SERIALIZATION_NVP(damage)
& BOOST_SERIALIZATION_NVP(target_owner_id)
& BOOST_SERIALIZATION_NVP(attacker_owner_id);
if (version < 3) {
int target_destroyed = 0;
ar & BOOST_SERIALIZATION_NVP (target_destroyed);
}
}
示例9: serialize
void serialize(Archive & ar, cv::Point2f & p, const unsigned int version)
{
ar & BOOST_SERIALIZATION_NVP(p.x);
ar & BOOST_SERIALIZATION_NVP(p.y);
}
示例10: BOOST_SERIALIZATION_NVP
// so use this
void data::serialize(boost::archive::polymorphic_oarchive & ar, const unsigned int /* file_version */){
ar & BOOST_SERIALIZATION_NVP(a);
}
示例11: BOOST_SERIALIZATION_BASE_OBJECT_NVP
void BoutBeginEvent::serialize ( Archive& ar, const unsigned int version ) {
ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(CombatEvent);
ar & BOOST_SERIALIZATION_NVP ( bout );
}
示例12: serialize
void serialize(
Archive &ar,
const unsigned int /* file_version */
){
ar & BOOST_SERIALIZATION_NVP(b);
#ifndef BOOST_NO_INT64_T
ar & BOOST_SERIALIZATION_NVP(f);
ar & BOOST_SERIALIZATION_NVP(g);
#endif
#if BOOST_WORKAROUND(__BORLANDC__, <= 0x551 )
int i;
if(BOOST_DEDUCED_TYPENAME Archive::is_saving::value){
i = l;
ar & BOOST_SERIALIZATION_NVP(i);
}
else{
ar & BOOST_SERIALIZATION_NVP(i);
l = i;
}
#else
ar & BOOST_SERIALIZATION_NVP(l);
#endif
ar & BOOST_SERIALIZATION_NVP(m);
ar & BOOST_SERIALIZATION_NVP(n);
ar & BOOST_SERIALIZATION_NVP(o);
ar & BOOST_SERIALIZATION_NVP(p);
ar & BOOST_SERIALIZATION_NVP(q);
#ifndef BOOST_NO_CWCHAR
ar & BOOST_SERIALIZATION_NVP(r);
#endif
ar & BOOST_SERIALIZATION_NVP(c);
ar & BOOST_SERIALIZATION_NVP(s);
ar & BOOST_SERIALIZATION_NVP(t);
ar & BOOST_SERIALIZATION_NVP(u);
ar & BOOST_SERIALIZATION_NVP(v);
ar & BOOST_SERIALIZATION_NVP(w);
ar & BOOST_SERIALIZATION_NVP(x);
ar & BOOST_SERIALIZATION_NVP(y);
#ifndef BOOST_NO_STD_WSTRING
ar & BOOST_SERIALIZATION_NVP(z);
#endif
}
示例13: BOOST_SERIALIZATION_NVP
void A::serialize(
boost::archive::polymorphic_iarchive &ar,
const unsigned int /*version*/
){
ar & BOOST_SERIALIZATION_NVP(i);
}
示例14: BOOST_SERIALIZATION_NVP
void FullPreview::serialize(Archive& ar, unsigned int version)
{
ar & BOOST_SERIALIZATION_NVP(filename)
& BOOST_SERIALIZATION_NVP(preview)
& BOOST_SERIALIZATION_NVP(galaxy);
}
示例15: BOOST_SERIALIZATION_NVP
void EnemyCheck::serialize(Archive& ar, const unsigned int version) {
ar & BOOST_SERIALIZATION_NVP(weight);
}