]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/serialization/example/demo_trivial_archive.cpp
1 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
3 // demo_trivial_archive.cpp
5 // (C) Copyright 2009 Robert Ramey - http://www.rrsd.com .
6 // Use, modification and distribution is subject to the Boost Software
7 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
10 #include <cstddef> // std::size_t
11 #include <boost/mpl/bool.hpp>
13 /////////////////////////////////////////////////////////////////////////
14 // class trivial_oarchive
15 class trivial_oarchive
{
18 //////////////////////////////////////////////////////////
19 // public interface used by programs that use the
20 // serialization library
21 typedef boost::mpl::bool_
<true> is_saving
;
22 typedef boost::mpl::bool_
<false> is_loading
;
23 template<class T
> void register_type(){}
24 template<class T
> trivial_oarchive
& operator<<(const T
& t
){
27 template<class T
> trivial_oarchive
& operator&(const T
& t
){
30 void save_binary(void *address
, std::size_t count
){};
33 #include "demo_gps.hpp"
35 int main(int argc
, char *argv
[])
38 bus_schedule schedule
;
42 bus_stop
*bs0
= new bus_stop_corner(
43 gps_position(34, 135, 52.560f
),
44 gps_position(134, 22, 78.30f
),
45 "24th Street", "10th Avenue"
47 bus_stop
*bs1
= new bus_stop_corner(
48 gps_position(35, 137, 23.456f
),
49 gps_position(133, 35, 54.12f
),
50 "State street", "Cathedral Vista Lane"
52 bus_stop
*bs2
= new bus_stop_destination(
53 gps_position(35, 136, 15.456f
),
54 gps_position(133, 32, 15.300f
),
57 bus_stop
*bs3
= new bus_stop_destination(
58 gps_position(35, 134, 48.789f
),
59 gps_position(133, 32, 16.230f
),
69 // add trips to schedule
70 schedule
.append("bob", 6, 24, &route0
);
71 schedule
.append("bob", 9, 57, &route0
);
72 schedule
.append("alice", 11, 02, &route0
);
80 // add trips to schedule
81 schedule
.append("ted", 7, 17, &route1
);
82 schedule
.append("ted", 9, 38, &route1
);
83 schedule
.append("alice", 11, 47, &route1
);
85 // display the complete schedule