| 1 | #include <stdio.h>
|
|---|
| 2 | #include <tchar.h>
|
|---|
| 3 | #include <crtdbg.h>
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 | #include <boost/archive/text_oarchive.hpp>
|
|---|
| 7 | #include <boost/archive/text_iarchive.hpp>
|
|---|
| 8 | #include <boost/archive/binary_oarchive.hpp>
|
|---|
| 9 | #include <boost/archive/binary_iarchive.hpp>
|
|---|
| 10 | #include <boost/serialization/export.hpp>
|
|---|
| 11 | #include <boost/serialization/vector.hpp>
|
|---|
| 12 |
|
|---|
| 13 | #include <vector>
|
|---|
| 14 |
|
|---|
| 15 | #include "fstream"
|
|---|
| 16 |
|
|---|
| 17 | #include "serializationBase.hpp"
|
|---|
| 18 | #include "serializationDerived.hpp"
|
|---|
| 19 |
|
|---|
| 20 | int _tmain(int argc, _TCHAR* argv[])
|
|---|
| 21 | {
|
|---|
| 22 | Main
|
|---|
| 23 | mainObj;
|
|---|
| 24 |
|
|---|
| 25 | //_CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF);
|
|---|
| 26 |
|
|---|
| 27 | // create and open a character archive for output
|
|---|
| 28 | std::ofstream ofs("test.txt", std::ios_base::out | std::ios_base::binary);
|
|---|
| 29 |
|
|---|
| 30 | mainObj.m_objects.push_back(new Object());
|
|---|
| 31 |
|
|---|
| 32 | boost::archive::binary_oarchive oa(ofs);
|
|---|
| 33 | // write class instance to archive
|
|---|
| 34 | oa << mainObj;
|
|---|
| 35 | return 0;
|
|---|
| 36 | }
|
|---|