pack_decl.hpp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. //
  2. // MessagePack for C++ serializing routine
  3. //
  4. // Copyright (C) 2008-2016 FURUHASHI Sadayuki and KONDO Takatoshi
  5. //
  6. // Distributed under the Boost Software License, Version 1.0.
  7. // (See accompanying file LICENSE_1_0.txt or copy at
  8. // http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. #ifndef MSGPACK_V1_PACK_DECL_HPP
  11. #define MSGPACK_V1_PACK_DECL_HPP
  12. #include "msgpack/versioning.hpp"
  13. #include "msgpack/cpp_config.hpp"
  14. #include "msgpack/sysdep.h"
  15. namespace msgpack {
  16. /// @cond
  17. MSGPACK_API_VERSION_NAMESPACE(v1) {
  18. /// @endcond
  19. /// The class template that supports continuous packing.
  20. /**
  21. * @tparam Stream Any type that have a member function `Stream write(const char*, size_t s)`
  22. *
  23. */
  24. template <typename Stream>
  25. class packer;
  26. /// Pack the value as MessagePack format into the stream
  27. /**
  28. * This function template is left for compatibility.
  29. * Use `void pack(Stream& s, const T& v)` instead of the function template.
  30. *
  31. * @tparam Stream Any type that have a member function `Stream write(const char*, size_t s)`
  32. * @tparam T Any type that is adapted to MessagePack
  33. * @param s The pointer to packing destination stream
  34. * @param v Packing value
  35. */
  36. template <typename Stream, typename T>
  37. void pack(Stream* s, const T& v);
  38. /// Pack the value as MessagePack format into the stream
  39. /**
  40. * @tparam Stream Any type that have a member function `Stream write(const char*, size_t s)`
  41. * @tparam T Any type that is adapted to MessagePack
  42. * @param s Packing destination stream
  43. * @param v Packing value
  44. */
  45. template <typename Stream, typename T>
  46. void pack(Stream& s, const T& v);
  47. #if MSGPACK_ENDIAN_LITTLE_BYTE
  48. template <typename T>
  49. char take8_8(T d);
  50. template <typename T>
  51. char take8_16(T d);
  52. template <typename T>
  53. char take8_32(T d);
  54. template <typename T>
  55. char take8_64(T d);
  56. #elif MSGPACK_ENDIAN_BIG_BYTE
  57. template <typename T>
  58. char take8_8(T d);
  59. template <typename T>
  60. char take8_16(T d);
  61. template <typename T>
  62. char take8_32(T d);
  63. template <typename T>
  64. char take8_64(T d);
  65. #else
  66. #error msgpack-c supports only big endian and little endian
  67. #endif
  68. /// @cond
  69. } // MSGPACK_API_VERSION_NAMESPACE(v1)
  70. /// @endcond
  71. } // namespace msgpack
  72. #endif // MSGPACK_V1_PACK_DECL_HPP