1 /* Copyright (C) 2014 InfiniDB, Inc.
2
3 This program is free software; you can redistribute it and/or
4 modify it under the terms of the GNU General Public License
5 as published by the Free Software Foundation; version 2 of
6 the License.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16 MA 02110-1301, USA. */
17
18 /***********************************************************************
19 * $Id: logicoperator.cpp 9210 2013-01-21 14:10:42Z rdempsey $
20 *
21 *
22 ***********************************************************************/
23 #include <iostream>
24
25 #include "bytestream.h"
26 #include "objectreader.h"
27 #include "logicoperator.h"
28
29 using namespace std;
30
31 namespace execplan
32 {
33
34 /**
35 * Constructors/Destructors
36 */
LogicOperator()37 LogicOperator::LogicOperator()
38 {
39 }
40
LogicOperator(const string & operatorName)41 LogicOperator::LogicOperator(const string& operatorName)
42 {
43 data(operatorName);
44 }
45
LogicOperator(const LogicOperator & rhs)46 LogicOperator::LogicOperator(const LogicOperator& rhs) : Operator(rhs)
47 {
48 data(rhs.fData);
49 }
50
~LogicOperator()51 LogicOperator:: ~LogicOperator()
52 {
53 }
54
55 /**
56 * Operations
57 */
58
59
60 /**
61 * friend function
62 */
operator <<(ostream & output,const LogicOperator & rhs)63 ostream& operator<<(ostream& output, const LogicOperator& rhs)
64 {
65 output << rhs.toString();
66 return output;
67 }
68
69 /**
70 * The serialization interface
71 */
serialize(messageqcpp::ByteStream & b) const72 void LogicOperator::serialize(messageqcpp::ByteStream& b) const
73 {
74 b << (ObjectReader::id_t) ObjectReader::LOGICOPERATOR;
75 //b << fData;
76 Operator::serialize(b);
77 }
78
unserialize(messageqcpp::ByteStream & b)79 void LogicOperator::unserialize(messageqcpp::ByteStream& b)
80 {
81 ObjectReader::checkType(b, ObjectReader::LOGICOPERATOR);
82 //b >> fData;
83 Operator::unserialize(b);
84 }
85
operator ==(const LogicOperator & t) const86 bool LogicOperator::operator==(const LogicOperator& t) const
87 {
88 if (data() == t.data())
89 return true;
90
91 return false;
92 }
93
operator ==(const TreeNode * t) const94 bool LogicOperator::operator==(const TreeNode* t) const
95 {
96 const LogicOperator* o;
97
98 o = dynamic_cast<const LogicOperator*>(t);
99
100 if (o == NULL)
101 return false;
102
103 return *this == *o;
104 }
105
operator !=(const LogicOperator & t) const106 bool LogicOperator::operator!=(const LogicOperator& t) const
107 {
108 return (!(*this == t));
109 }
110
operator !=(const TreeNode * t) const111 bool LogicOperator::operator!=(const TreeNode* t) const
112 {
113 return (!(*this == t));
114 }
115
116 } // namespace
117