當前位置: 首頁>>代碼示例>>C++>>正文


C++ BOOST_SERIALIZATION_NVP函數代碼示例

本文整理匯總了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()());
        }
    }
}
開發者ID:adrianbroher,項目名稱:freeorion,代碼行數:25,代碼來源:SerializeMultiplayerCommon.cpp

示例2: serialize

void 
SimplexWithVertices<V>::
serialize(Archive& ar, version_type )									
{ ar & BOOST_SERIALIZATION_NVP(vertices_); }
開發者ID:veldanie,項目名稱:Dionysus-python3,代碼行數:4,代碼來源:simplex.hpp

示例3: operator

 void operator()(T const & value) const
 {
     m_ar << BOOST_SERIALIZATION_NVP(value);
 }
開發者ID:Skovpin,項目名稱:CodeBlocks-RG,代碼行數:4,代碼來源:variant.hpp

示例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;
}
開發者ID:PandaPYH,項目名稱:boost-svn,代碼行數:81,代碼來源:test_no_rtti.cpp

示例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_);

	};
開發者ID:ailidani,項目名稱:dfs,代碼行數:15,代碼來源:message.hpp

示例6: serialize

			template<class ArchiveT> void serialize(ArchiveT & ar, unsigned int version){ ar & BOOST_SERIALIZATION_NVP(contact); ar & BOOST_SERIALIZATION_NVP(force); }
開發者ID:Azeko2xo,項目名稱:woodem,代碼行數:1,代碼來源:ContactContainer.hpp

示例7: serialize

 void serialize(Archive &ar, const unsigned int version)
 {
     ar & BOOST_SERIALIZATION_NVP(data_ptr);
 }                   
開發者ID:annaborn,項目名稱:slam-envire_maps,代碼行數:4,代碼來源:LocalMap.hpp

示例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);
    }
}
開發者ID:Mitten-O,項目名稱:freeorion,代碼行數:18,代碼來源:CombatEvents.cpp

示例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);
}
開發者ID:gehrinch,項目名稱:Schweizer-Messer,代碼行數:5,代碼來源:serialization.hpp

示例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);
}
開發者ID:0xDEC0DE8,項目名稱:mcsema,代碼行數:4,代碼來源:test_polymorphic_A.cpp

示例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 );
}
開發者ID:Deepsloth,項目名稱:freeorion,代碼行數:4,代碼來源:CombatEvents.cpp

示例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
 }
開發者ID:LancelotGHX,項目名稱:Simula,代碼行數:42,代碼來源:A.hpp

示例13: BOOST_SERIALIZATION_NVP

void A::serialize(
    boost::archive::polymorphic_iarchive &ar, 
    const unsigned int /*version*/
){
    ar & BOOST_SERIALIZATION_NVP(i);
}
開發者ID:pathscale,項目名稱:boost-testsuite,代碼行數:6,代碼來源:test_polymorphic2imp.cpp

示例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);
}
開發者ID:amireldor,項目名稱:freeorion,代碼行數:6,代碼來源:SaveGamePreviewUtils.cpp

示例15: BOOST_SERIALIZATION_NVP

void EnemyCheck::serialize(Archive& ar, const unsigned int version) {
  ar & BOOST_SERIALIZATION_NVP(weight);
}
開發者ID:hahahahaman,項目名稱:keeperrl,代碼行數:3,代碼來源:enemy_check.cpp


注:本文中的BOOST_SERIALIZATION_NVP函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。