1 //                                               -*- C++ -*-
2 /**
3  *  @brief Abstract top-level class for all Equal
4  *
5  *  Copyright 2005-2021 Airbus-EDF-IMACS-ONERA-Phimeca
6  *
7  *  This library is free software: you can redistribute it and/or modify
8  *  it under the terms of the GNU Lesser General Public License as published by
9  *  the Free Software Foundation, either version 3 of the License, or
10  *  (at your option) any later version.
11  *
12  *  This library is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU Lesser General Public License for more details.
16  *
17  *  You should have received a copy of the GNU Lesser General Public License
18  *  along with this library.  If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 #include "openturns/Equal.hxx"
22 #include "openturns/PersistentObjectFactory.hxx"
23 
24 BEGIN_NAMESPACE_OPENTURNS
25 
26 CLASSNAMEINIT(Equal)
27 
28 static const Factory<Equal> Factory_Equal;
29 
30 /* Default constructor */
Equal()31 Equal::Equal()
32   : ComparisonOperatorImplementation()
33 {
34   // Nothing to do
35 }
36 
37 /* String converter */
__repr__() const38 String Equal::__repr__() const
39 {
40   return OSS() << "class=" << Equal::GetClassName()
41          << " name=" << getName();
42 }
43 
__str__(const String & offset) const44 String Equal::__str__(const String & offset) const
45 {
46   return OSS() << offset << "=";
47 }
48 
49 /* Here is the interface that all derived class must implement */
50 
51 /* Virtual constructor */
clone() const52 Equal * Equal::clone() const
53 {
54   return new Equal(*this);
55 }
56 
57 /* Return true if comparison succeeds */
operator ()(const Scalar a,const Scalar b) const58 Bool Equal::operator() (const Scalar a,
59                         const Scalar b) const
60 {
61   return (a == b);
62 }
63 
64 /* Method save() stores the object through the StorageManager */
save(Advocate & adv) const65 void Equal::save(Advocate & adv) const
66 {
67   ComparisonOperatorImplementation::save(adv);
68 }
69 
70 
71 /* Method load() reloads the object from the StorageManager */
load(Advocate & adv)72 void Equal::load(Advocate & adv)
73 {
74   ComparisonOperatorImplementation::load(adv);
75 }
76 
77 
78 
79 
80 END_NAMESPACE_OPENTURNS
81