Remote Call Framework 3.4
Archive.hpp
1 
2 //******************************************************************************
3 // RCF - Remote Call Framework
4 //
5 // Copyright (c) 2005 - 2023, Delta V Software. All rights reserved.
6 // https://www.deltavsoft.com
7 //
8 // RCF is distributed under dual licenses - closed source or GPL.
9 // Consult your particular license for conditions of use.
10 //
11 // If you have not purchased a commercial license, you are using RCF under GPL terms.
12 //
13 // Version: 3.4
14 // Contact: support <at> deltavsoft.com
15 //
16 //******************************************************************************
17 
18 #ifndef INCLUDE_SF_ARCHIVE_HPP
19 #define INCLUDE_SF_ARCHIVE_HPP
20 
21 #include <RCF/Export.hpp>
22 #include <SF/DataPtr.hpp>
23 #include <RCF/Tools.hpp>
24 
25 namespace SF {
26 
27  class IStream;
28  class OStream;
29 
31  class RCF_EXPORT Archive : Noncopyable
32  {
33  public:
34 
35  enum Direction
36  {
37  READ,
38  WRITE
39  };
40 
41  enum Flag
42  {
43  PARENT = 1 << 0,
44  POINTER = 1 << 1,
45  NODE_ALREADY_READ = 1 << 2,
46  NO_BEGIN_END = 1 << 3,
47  POLYMORPHIC = 1 << 4
48  };
49 
50  Archive(Direction dir, IStream *stream);
51  Archive(Direction dir, OStream *stream);
52 
53  Archive & operator&(Flag flag);
54 
56  bool isRead() const;
57 
59  bool isWrite() const;
60 
61  IStream * getIstream() const;
62  OStream * getOstream() const;
63  bool isFlagSet(Flag flag) const;
64  void setFlag(Flag flag, bool bEnable = true);
65  void clearFlag(Flag flag);
66  void clearState();
67  DataPtr & getLabel();
68  bool verifyAgainstArchiveSize(std::size_t bytesToRead);
69 
71  int getRuntimeVersion();
72 
74  int getArchiveVersion();
75 
76  private:
77 
78  Direction mDir;
79  IStream * mIstream;
80  OStream * mOstream;
81  DataPtr mLabel;
82  unsigned int mFlags;
83  };
84 
85 }
86 
87 #include <SF/Serializer.hpp>
88 
89 #endif // ! INCLUDE_SF_ARCHIVE_HPP
Represents an archive, in which serialized objects are stored.
Definition: Archive.hpp:31
Definition: ByteBuffer.hpp:188
Base class for output streams using SF serialization. Use operator <<() to serialize objects into the...
Definition: Stream.hpp:235
Base class for input streams using SF serialization. Use operator >>() to deserialize objects from th...
Definition: Stream.hpp:137