asio 0.3.8rc3 Home | Reference | Tutorial | Examples | Design
Examples

serialization/stock.hpp

Go to the documentation of this file.
00001 //
00002 // stock.hpp
00003 // ~~~~~~~~~
00004 //
00005 // Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
00006 //
00007 // Distributed under the Boost Software License, Version 1.0. (See accompanying
00008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
00009 //
00010 
00011 #ifndef SERIALIZATION_STOCK_HPP
00012 #define SERIALIZATION_STOCK_HPP
00013 
00014 #include <string>
00015 
00016 namespace s11n_example {
00017 
00019 struct stock
00020 {
00021   std::string code;
00022   std::string name;
00023   double open_price;
00024   double high_price;
00025   double low_price;
00026   double last_price;
00027   double buy_price;
00028   int buy_quantity;
00029   double sell_price;
00030   int sell_quantity;
00031 
00032   template <typename Archive>
00033   void serialize(Archive& ar, const unsigned int version)
00034   {
00035     ar & code;
00036     ar & name;
00037     ar & open_price;
00038     ar & high_price;
00039     ar & low_price;
00040     ar & last_price;
00041     ar & buy_price;
00042     ar & buy_quantity;
00043     ar & sell_price;
00044     ar & sell_quantity;
00045   }
00046 };
00047 
00048 } // namespace s11n_example
00049 
00050 #endif // SERIALIZATION_STOCK_HPP
asio 0.3.8rc3 Home | Reference | Tutorial | Examples | Design