#include "stdafx.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // For serialization of pointers to derived classes via key export. // LOOKOUT: export.hpp must not be included before any archive header #include #ifdef _DEBUG #define new DEBUG_NEW #endif // all these class need to be exported, because they might be serialized via a base class pointer // we MUST NOT EXPORT base class ==> BOOST_CLASS_EXPORT_GUID(fem::CTCBaseObj , "fem__CTCBaseObj"); <== we MUST NOT EXPORT base class //BOOST_CLASS_EXPORT_GUID(fem::CTCSoil , "fem__CTCSoil"); //BOOST_CLASS_EXPORT_GUID(fem::CTCBrickWall , "fem__CTCBrickWall"); BOOST_IS_ABSTRACT(fem::CTCBaseObj); BOOST_CLASS_EXPORT(fem::CTCSoil); BOOST_CLASS_EXPORT(fem::CTCBrickWall); void CTCDataBase::boost_serialize_open_txt(const char* filename) { try { std::ifstream ifs(filename); assert(ifs.good()); boost::archive::text_iarchive ia(ifs); ia >> BOOST_SERIALIZATION_NVP(m_lstSoils); ia >> BOOST_SERIALIZATION_NVP(m_lstBrickWalls); ia >> BOOST_SERIALIZATION_NVP(CTCFooting::s_bspSoil); ia >> BOOST_SERIALIZATION_NVP(CTCFrame::s_bspBrickWall); } catch (const boost::archive::archive_exception& e) { e; } } void CTCDataBase::boost_serialize_open_xml(const char* filename) { try { std::ifstream ifs(filename); assert(ifs.good()); boost::archive::xml_iarchive ia(ifs); ia >> BOOST_SERIALIZATION_NVP(m_lstSoils); ia >> BOOST_SERIALIZATION_NVP(m_lstBrickWalls); ia >> BOOST_SERIALIZATION_NVP(CTCFooting::s_bspSoil); ia >> BOOST_SERIALIZATION_NVP(CTCFrame::s_bspBrickWall); } catch (const boost::archive::archive_exception& e) { e; } } void CTCDataBase::boost_serialize_open_bin(const char* filename) { try { std::ifstream ifs(filename); assert(ifs.good()); boost::archive::binary_iarchive ia(ifs); ia >> BOOST_SERIALIZATION_NVP(m_lstSoils); ia >> BOOST_SERIALIZATION_NVP(m_lstBrickWalls); ia >> BOOST_SERIALIZATION_NVP(CTCFooting::s_bspSoil); ia >> BOOST_SERIALIZATION_NVP(CTCFrame::s_bspBrickWall); } catch (const boost::archive::archive_exception& e) { e; } } void CTCDataBase::boost_serialize_save_txt(const char* filename) { try { std::ofstream ofs(filename); assert(ofs.good()); boost::archive::text_oarchive oa(ofs); oa << BOOST_SERIALIZATION_NVP(m_lstSoils); oa << BOOST_SERIALIZATION_NVP(m_lstBrickWalls); oa << BOOST_SERIALIZATION_NVP(CTCFooting::s_bspSoil); oa << BOOST_SERIALIZATION_NVP(CTCFrame::s_bspBrickWall); } catch (const boost::archive::archive_exception& e) { e; } } void CTCDataBase::boost_serialize_save_xml(const char* filename) { try { std::ofstream ofs(filename); assert(ofs.good()); boost::archive::xml_oarchive oa(ofs); oa << BOOST_SERIALIZATION_NVP(m_lstSoils); oa << BOOST_SERIALIZATION_NVP(m_lstBrickWalls); oa << BOOST_SERIALIZATION_NVP(CTCFooting::s_bspSoil); oa << BOOST_SERIALIZATION_NVP(CTCFrame::s_bspBrickWall); } catch (const boost::archive::archive_exception& e) { e; } } void CTCDataBase::boost_serialize_save_bin(const char* filename) { try { std::ofstream ofs(filename); assert(ofs.good()); boost::archive::binary_oarchive oa(ofs); oa << BOOST_SERIALIZATION_NVP(m_lstSoils); oa << BOOST_SERIALIZATION_NVP(m_lstBrickWalls); oa << BOOST_SERIALIZATION_NVP(CTCFooting::s_bspSoil); oa << BOOST_SERIALIZATION_NVP(CTCFrame::s_bspBrickWall); } catch (const boost::archive::archive_exception& e) { e; } }