Om
default_source.cpp
Go to the documentation of this file.
1 
15 #ifndef Om_Source_DefaultSource_
16 
18 
19 #else
20 
21 // MARK: - Om::Source::DefaultSource
22 
23  #define Template_ \
24  template < \
25  typename ThisItem, \
26  typename ThisImplementation \
27  >
28 
29  #define Type_ \
30  Om::Source::DefaultSource< \
31  ThisItem, \
32  ThisImplementation \
33  >
34 
35 // MARK: public (non-static)
36 
37 Template_
38 inline Type_::~DefaultSource() {}
39 
40 Template_
41 inline ThisImplementation & Type_::operator ++() {
42  assert(
43  dynamic_cast<ThisImplementation *>(this)
44  );
45  assert(*this);
46  this->Pop();
47  return static_cast<ThisImplementation &>(*this);
48 }
49 
50 Template_
51 inline ThisImplementation Type_::operator ++(int) {
52  assert(
53  dynamic_cast<ThisImplementation *>(this)
54  );
55  ThisImplementation theSource(
56  static_cast<ThisImplementation &>(*this)
57  );
58  ++*this;
59  return theSource;
60 }
61 
62 Template_
63 inline bool Type_::Equals(
64  Source<ThisItem> const & theSource
65 ) const {
66  assert(
67  dynamic_cast<ThisImplementation const *>(this)
68  );
69  ThisImplementation const * const theImplementation = dynamic_cast<ThisImplementation const *>(&theSource);
70  return (
71  theImplementation &&
72  theImplementation->Equals(
73  static_cast<ThisImplementation const &>(*this)
74  )
75  );
76 }
77 
78  #undef Type_
79  #undef Template_
80 
81 #endif
Om header file.