1 // 2 // stock.hpp 3 // ~~~~~~~~~ 4 // 5 // Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 // 7 // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 // 10 11 #ifndef SERIALIZATION_STOCK_HPP 12 #define SERIALIZATION_STOCK_HPP 13 14 #include <string> 15 16 namespace s11n_example { 17 18 /// Structure to hold information about a single stock. 19 struct stock 20 { 21 std::string code; 22 std::string name; 23 double open_price; 24 double high_price; 25 double low_price; 26 double last_price; 27 double buy_price; 28 int buy_quantity; 29 double sell_price; 30 int sell_quantity; 31 32 template <typename Archive> serializes11n_example::stock33 void serialize(Archive& ar, const unsigned int version) 34 { 35 ar & code; 36 ar & name; 37 ar & open_price; 38 ar & high_price; 39 ar & low_price; 40 ar & last_price; 41 ar & buy_price; 42 ar & buy_quantity; 43 ar & sell_price; 44 ar & sell_quantity; 45 } 46 }; 47 48 } // namespace s11n_example 49 50 #endif // SERIALIZATION_STOCK_HPP 51