15 #ifndef Om_Language_Operation_EqualsOperation_
23 #ifndef Om_Macro_Precompilation_
25 #include "boost/test/unit_test.hpp"
35 BOOST_AUTO_TEST_SUITE(EqualsOperationTest)
37 BOOST_AUTO_TEST_CASE(DefinitionTest) {
44 BOOST_AUTO_TEST_CASE(GeneralTest) {
66 BOOST_AUTO_TEST_SUITE_END()
83 Om::Language::Operation::EqualsOperation
87 inline char const * Type_::GetName() {
91 template <
typename TheEqualsOperation>
92 inline void Type_::GiveElements(
93 TheEqualsOperation & theEqualsOperation,
94 Consumer & theConsumer
96 theConsumer.TakeElement(
100 !theEqualsOperation.thisOperand.IsEmpty()
102 theConsumer.TakeElement(theEqualsOperation.thisOperand);
108 inline Type_::EqualsOperation():
111 template <
typename TheOperand>
112 inline bool Type_::TakeOperand(
113 Evaluation & theEvaluation,
114 TheOperand & theOperand
117 !theOperand.IsEmpty()
120 this->thisOperand.IsEmpty()
122 this->thisOperand.Take(theOperand);
125 Expression theExpression;
126 if (this->thisOperand == theOperand) {
127 theExpression.TakeOperand(this->thisOperand);
129 theEvaluation.TakeQuotedProducer(theExpression);
133 template <
typename TheProducer>
134 inline bool Type_::TakeQuotedProducer(
135 Evaluation & theEvaluation,
136 TheProducer & theProducer
139 this->thisOperand.IsEmpty()
141 this->thisOperand.SetProgram(
142 theProducer.GiveProgram()
146 Expression theExpression;
148 this->IsMatch(theProducer)
150 theExpression.TakeOperand(this->thisOperand);
152 theEvaluation.TakeQuotedProducer(theExpression);
158 template <
typename TheProducer>
159 inline bool Type_::IsMatch(TheProducer & theProducer)
const {
161 this->thisOperand.GetProgram()
163 Program
const & theProgram = *this->thisOperand.GetProgram();
164 Program
const *
const theProducerProgram =
dynamic_cast<Program
const *
>(&theProducer);
165 if (theProducerProgram) {
166 return *theProducerProgram == theProgram;
168 Literal theProducerLiteral;
169 theProducerLiteral.TakeElements(theProducer);
170 return theProducerLiteral.Equals(theProgram);
#define Om_Language_Operation_EqualsOperation_GetName_()