Om
source.cpp
Go to the documentation of this file.
1 
15 #ifndef Om_Source_Source_
16 
17  #include "om/source/source.hpp"
18 
19 #else
20 
21  #ifndef Om_Macro_Precompilation_
22 
23  #include <cassert>
24  #include <stdexcept>
25 
26  #endif
27 
28 // MARK: - Om::Source::Source
29 
30  #define Template_ \
31  template <typename ThisItem>
32 
33  #define Type_ \
34  Om::Source::Source<ThisItem>
35 
36 // MARK: public (non-static)
37 
38 Template_
39 inline Type_::~Source() {}
40 
41 Template_
42 inline ThisItem & Type_::operator *() const {
43  assert(0);
44  throw std::logic_error("Pure virtual function called.");
45 }
46 
47 Template_
48 inline ThisItem * Type_::operator ->() const {
49  return &**this;
50 }
51 
52 Template_
53 inline bool Type_::operator !() const {
54  assert(0);
55  throw std::logic_error("Pure virtual function called.");
56 }
57 
58 Template_
59 inline Type_::operator Boolean() const {
60  return (
61  !*this ?
62  0 :
63  &Source::UncomparableBoolean
64  );
65 }
66 
67 Template_
68 inline bool Type_::Equals(Source const &) const {
69  assert(0);
70  throw std::logic_error("Pure virtual function called.");
71 }
72 
73 Template_
74 inline void Type_::Pop() {
75  assert(0);
76  throw std::logic_error("Pure virtual function called.");
77 }
78 
79 // MARK: private (non-static)
80 
81 Template_
82 inline void Type_::UncomparableBoolean() const {}
83 
84  #undef Type_
85  #undef Template_
86 
87 // MARK: - Om::
88 
89  #define Template_ \
90  template <typename TheItem>
91 
92  #define Type_ \
93  Om::Source::Source<TheItem>
94 
95 Template_
96 inline bool Om::operator ==(
97  Type_ const & theFirst,
98  Type_ const & theSecond
99 ) {
100  return theFirst.Equals(theSecond);
101 }
102 
103 Template_
104 inline bool Om::operator !=(
105  Type_ const & theFirst,
106  Type_ const & theSecond
107 ) {
108  return !theFirst.Equals(theSecond);
109 }
110 
111  #undef Type_
112  #undef Template_
113 
114 #endif
bool operator!=(Source::Source< TheItem > const &, Source::Source< TheItem > const &)
bool operator==(Source::Source< TheItem > const &, Source::Source< TheItem > const &)
Om header file.