PVData C++  8.0.5
noDefaultMethods.h
1 /* noDefaultMethods.h */
2 /*
3  * Copyright information and license terms for this software can be
4  * found in the file LICENSE that is included with the distribution
5  */
6 /**
7  * @author mrk
8  */
9 #ifndef NO_DEFAULT_METHODS_H
10 #define NO_DEFAULT_METHODS_H
11 
12 #include <shareLib.h>
13 
14 /** @macro EPICS_NOT_COPYABLE(CLASS)
15  * @brief Disable implicit copyable
16  *
17  * Prevent the default copy constructor and assignment
18  * operator from being usable.
19  *
20  * For >= C++11 explicitly disable. Attempts to copy/assign will
21  * fail to compile.
22  *
23  * For C++98 make these private, and don't implement them.
24  * User code will fail to compile, implementation code will fail to link.
25  @code
26  struct MyClass {
27  EPICS_NOT_COPYABLE(MyClass)
28  public:
29  ...
30  };
31  @endcode
32  *
33  * @note This macro contains 'private:'.
34  */
35 #if __cplusplus>=201103L
36 # define EPICS_NOT_COPYABLE(CLASS) private: CLASS(const CLASS&) = delete; CLASS& operator=(const CLASS&) = delete;
37 #else
38 # define EPICS_NOT_COPYABLE(CLASS) private: CLASS(const CLASS&); CLASS& operator=(const CLASS&);
39 #endif
40 
41 namespace epics { namespace pvData {
42 
43 /**
44  * @brief Base class for not allowing default methods.
45  *
46  * Note that copy constructor a copy methods are declared private.
47  *
48  * @deprecated Deprecated in favor of EPICS_NOT_COPYABLE() pvDataCPP 7.0.0
49  */
50 class NoDefaultMethods {
51 public:
52  NoDefaultMethods() {}
53 private:
54 #if __cplusplus>=201103L
55  NoDefaultMethods(const NoDefaultMethods&) = delete;
56  NoDefaultMethods & operator=(const NoDefaultMethods &) = delete;
57 #else
58  // do not implement
59  NoDefaultMethods(const NoDefaultMethods&);
60  NoDefaultMethods & operator=(const NoDefaultMethods &);
61 #endif
62 };
63 
64 }}
65 #endif /* NO_DEFAULT_METHODS_H */
virtual void serialize(ByteBuffer *buffer, SerializableControl *flusher, std::size_t offset, std::size_t count) const =0