1 | //============================================================================ |
2 | // |
3 | // SSSS tt lll lll |
4 | // SS SS tt ll ll |
5 | // SS tttttt eeee ll ll aaaa |
6 | // SSSS tt ee ee ll ll aa |
7 | // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" |
8 | // SS SS tt ee ll ll aa aa |
9 | // SSSS ttt eeeee llll llll aaaaa |
10 | // |
11 | // Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony |
12 | // and the Stella Team |
13 | // |
14 | // See the file "License.txt" for information on usage and redistribution of |
15 | // this file, and for a DISCLAIMER OF ALL WARRANTIES. |
16 | //============================================================================ |
17 | |
18 | #ifndef SERIALIZABLE_HXX |
19 | #define SERIALIZABLE_HXX |
20 | |
21 | #include "Serializer.hxx" |
22 | |
23 | /** |
24 | This class provides an interface for (de)serializing objects. |
25 | It exists strictly to guarantee that all required classes use |
26 | method signatures as defined below. |
27 | |
28 | @author Stephen Anthony |
29 | */ |
30 | class Serializable |
31 | { |
32 | public: |
33 | Serializable() = default; |
34 | virtual ~Serializable() = default; |
35 | |
36 | Serializable(const Serializable&) = default; |
37 | Serializable(Serializable&&) = default; |
38 | Serializable& operator=(const Serializable&) = default; |
39 | Serializable& operator=(Serializable&&) = default; |
40 | |
41 | /** |
42 | Save the current state of the object to the given Serializer. |
43 | |
44 | @param out The Serializer object to use |
45 | @return False on any errors, else true |
46 | */ |
47 | virtual bool save(Serializer& out) const = 0; |
48 | |
49 | /** |
50 | Load the current state of the object from the given Serializer. |
51 | |
52 | @param in The Serializer object to use |
53 | @return False on any errors, else true |
54 | */ |
55 | virtual bool load(Serializer& in) = 0; |
56 | }; |
57 | |
58 | #endif |
59 | |