stock.hpp 1022 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //
  2. // stock.hpp
  3. // ~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2019 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. #ifndef SERIALIZATION_STOCK_HPP
  11. #define SERIALIZATION_STOCK_HPP
  12. #include <string>
  13. namespace s11n_example {
  14. /// Structure to hold information about a single stock.
  15. struct stock
  16. {
  17. std::string code;
  18. std::string name;
  19. double open_price;
  20. double high_price;
  21. double low_price;
  22. double last_price;
  23. double buy_price;
  24. int buy_quantity;
  25. double sell_price;
  26. int sell_quantity;
  27. template <typename Archive>
  28. void serialize(Archive& ar, const unsigned int version)
  29. {
  30. ar & code;
  31. ar & name;
  32. ar & open_price;
  33. ar & high_price;
  34. ar & low_price;
  35. ar & last_price;
  36. ar & buy_price;
  37. ar & buy_quantity;
  38. ar & sell_price;
  39. ar & sell_quantity;
  40. }
  41. };
  42. } // namespace s11n_example
  43. #endif // SERIALIZATION_STOCK_HPP