TCopySerializedWrap.h
Go to the documentation of this file.
1 #ifndef iser_TCopySerializedWrap_included
2 #define iser_TCopySerializedWrap_included
3 
4 
5 // ACF includes
6 #include <istd/IChangeable.h>
7 
8 
9 namespace iser
10 {
11 
12 
14 
19 extern bool CopyByArchive(const istd::IChangeable& object, istd::IChangeable& result);
25 extern bool CompareByArchive(const istd::IChangeable& object1, const istd::IChangeable& object2);
27 
28 
29 template <class Base>
30 class TCopySerializedWrap: public Base
31 {
32 public:
33  typedef Base BaseClass;
34 
35  // pseudo-reimplemented (istd::IChangeable)
36  virtual int GetSupportedOperations() const;
38  virtual bool IsEqual(const istd::IChangeable& object) const;
39 };
40 
41 
42 // public methods
43 
44 // pseudo-reimplemented (istd::IChangeable)
45 
46 template <class Base>
48 {
49  return BaseClass::GetSupportedOperations() | istd::IChangeable::SO_COPY | istd::IChangeable::SO_COMPARE;
50 }
51 
52 
53 template <class Base>
55 {
56  if (BaseClass::CopyFrom(object, mode)){
57  return true;
58  }
59  else if (mode == BaseClass::CM_WITHOUT_REFS){
60  return CopyByArchive(object, *this);
61  }
62  else{
63  return false;
64  }
65 }
66 
67 
68 template <class Base>
70 {
71  if ((BaseClass::GetSupportedOperations() & istd::IChangeable::SO_COMPARE) != 0){
72  return BaseClass::IsEqual(object);
73  }
74 
75  return CompareByArchive(object, *this);
76 }
77 
78 
79 } // namespace iser
80 
81 
82 #endif // !iser_TCopySerializedWrap_included
83 
84 
virtual bool IsEqual(const istd::IChangeable &object) const
External references are simple ignored.
Definition: IChangeable.h:197
CompatibilityMode
Control how relationship betweeen objects are interpreted.
Definition: IChangeable.h:186
Comparison with another object.
Definition: IChangeable.h:174
virtual bool CopyFrom(const istd::IChangeable &object, istd::IChangeable::CompatibilityMode mode=istd::IChangeable::CM_WITHOUT_REFS)
Common interface for data model objects, which can be changed.
Definition: IChangeable.h:24
virtual int GetSupportedOperations() const
Copying from other object.
Definition: IChangeable.h:164

© 2007-2017 Witold Gantzke and Kirill Lepskiy