中间件底层,websocket

Archive.hpp 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. //******************************************************************************
  2. // RCF - Remote Call Framework
  3. //
  4. // Copyright (c) 2005 - 2020, Delta V Software. All rights reserved.
  5. // http://www.deltavsoft.com
  6. //
  7. // RCF is distributed under dual licenses - closed source or GPL.
  8. // Consult your particular license for conditions of use.
  9. //
  10. // If you have not purchased a commercial license, you are using RCF
  11. // under GPL terms.
  12. //
  13. // Version: 3.2
  14. // Contact: support <at> deltavsoft.com
  15. //
  16. //******************************************************************************
  17. #ifndef INCLUDE_SF_ARCHIVE_HPP
  18. #define INCLUDE_SF_ARCHIVE_HPP
  19. #include <RCF/Export.hpp>
  20. #include <SF/DataPtr.hpp>
  21. #include <RCF/Tools.hpp>
  22. namespace SF {
  23. class IStream;
  24. class OStream;
  25. /// Represents an archive, in which serialized objects are stored.
  26. class RCF_EXPORT Archive : Noncopyable
  27. {
  28. public:
  29. enum Direction
  30. {
  31. READ,
  32. WRITE
  33. };
  34. enum Flag
  35. {
  36. PARENT = 1 << 0,
  37. POINTER = 1 << 1,
  38. NODE_ALREADY_READ = 1 << 2,
  39. NO_BEGIN_END = 1 << 3,
  40. POLYMORPHIC = 1 << 4
  41. };
  42. Archive(Direction dir, IStream *stream);
  43. Archive(Direction dir, OStream *stream);
  44. Archive & operator&(Flag flag);
  45. /// Returns true if this archive is being read from.
  46. bool isRead() const;
  47. /// Returns true if this archive is being written to.
  48. bool isWrite() const;
  49. IStream * getIstream() const;
  50. OStream * getOstream() const;
  51. bool isFlagSet(Flag flag) const;
  52. void setFlag(Flag flag, bool bEnable = true);
  53. void clearFlag(Flag flag);
  54. void clearState();
  55. DataPtr & getLabel();
  56. bool verifyAgainstArchiveSize(std::size_t bytesToRead);
  57. /// Gets the RCF runtime version associated with this archive.
  58. int getRuntimeVersion();
  59. /// Gets the archive version associated with this archive.
  60. int getArchiveVersion();
  61. private:
  62. Direction mDir;
  63. IStream * mIstream;
  64. OStream * mOstream;
  65. DataPtr mLabel;
  66. unsigned int mFlags;
  67. };
  68. }
  69. #include <SF/Serializer.hpp>
  70. #endif // ! INCLUDE_SF_ARCHIVE_HPP