Remote Call Framework 3.2
Archive.hpp
1 
2 //******************************************************************************
3 // RCF - Remote Call Framework
4 //
5 // Copyright (c) 2005 - 2020, Delta V Software. All rights reserved.
6 // http://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
12 // under GPL terms.
13 //
14 // Version: 3.2
15 // Contact: support <at> deltavsoft.com
16 //
17 //******************************************************************************
18 
19 #ifndef INCLUDE_SF_ARCHIVE_HPP
20 #define INCLUDE_SF_ARCHIVE_HPP
21 
22 #include <RCF/Export.hpp>
23 #include <SF/DataPtr.hpp>
24 #include <RCF/Tools.hpp>
25 
26 namespace SF {
27 
28  class IStream;
29  class OStream;
30 
32  class RCF_EXPORT Archive : Noncopyable
33  {
34  public:
35 
36  enum Direction
37  {
38  READ,
39  WRITE
40  };
41 
42  enum Flag
43  {
44  PARENT = 1 << 0,
45  POINTER = 1 << 1,
46  NODE_ALREADY_READ = 1 << 2,
47  NO_BEGIN_END = 1 << 3,
48  POLYMORPHIC = 1 << 4
49  };
50 
51  Archive(Direction dir, IStream *stream);
52  Archive(Direction dir, OStream *stream);
53 
54  Archive & operator&(Flag flag);
55 
57  bool isRead() const;
58 
60  bool isWrite() const;
61 
62  IStream * getIstream() const;
63  OStream * getOstream() const;
64  bool isFlagSet(Flag flag) const;
65  void setFlag(Flag flag, bool bEnable = true);
66  void clearFlag(Flag flag);
67  void clearState();
68  DataPtr & getLabel();
69  bool verifyAgainstArchiveSize(std::size_t bytesToRead);
70 
72  int getRuntimeVersion();
73 
75  int getArchiveVersion();
76 
77  private:
78 
79  Direction mDir;
80  IStream * mIstream;
81  OStream * mOstream;
82  DataPtr mLabel;
83  unsigned int mFlags;
84  };
85 
86 }
87 
88 #include <SF/Serializer.hpp>
89 
90 #endif // ! INCLUDE_SF_ARCHIVE_HPP
Represents an archive, in which serialized objects are stored.
Definition: Archive.hpp:32
Definition: ByteBuffer.hpp:189
Base class for output streams using SF serialization. Use operator <<() to serialize objects into the...
Definition: Stream.hpp:236
Base class for input streams using SF serialization. Use operator >>() to deserialize objects from th...
Definition: Stream.hpp:138