Salome HOME
0020431: EDF 1020 SMESH : Radial Mesh of a cylinder
authoreap <eap@opencascade.com>
Fri, 22 Jan 2010 11:30:28 +0000 (11:30 +0000)
committereap <eap@opencascade.com>
Fri, 22 Jan 2010 11:30:28 +0000 (11:30 +0000)
+  virtual bool operator==(const SMESHDS_Hypothesis& other) const;
+  bool operator!=(const SMESHDS_Hypothesis& other) const { return !(*this==other); }

src/SMESHDS/SMESHDS_Hypothesis.cxx
src/SMESHDS/SMESHDS_Hypothesis.hxx

index 84b3a6c32b5ea3279e074069396c582db317b011..22311acee7ff5d5c35a433865caec6075ae8678c 100644 (file)
 //  File   : SMESHDS_Hypothesis.cxx
 //  Author : Paul RASCLE, EDF
 //  Module : SMESH
-//  $Header$
 //
 #include "SMESHDS_Hypothesis.hxx"
 
+#include <sstream>
+
 using namespace std;
 
 //=============================================================================
@@ -37,11 +38,8 @@ using namespace std;
 
 SMESHDS_Hypothesis::SMESHDS_Hypothesis(int hypId)
 {
-//   MESSAGE("SMESHDS_Hypothesis::SMESHDS_Hypothesis");
   _hypId = hypId;
   _name = "generic";
-//   SCRUTE(_name);
-//   SCRUTE(_hypId);
 }
 
 //=============================================================================
@@ -52,7 +50,6 @@ SMESHDS_Hypothesis::SMESHDS_Hypothesis(int hypId)
 
 SMESHDS_Hypothesis::~SMESHDS_Hypothesis()
 {
-//   MESSAGE("SMESHDS_Hypothesis::~SMESHDS_Hypothesis");
 }
 
 //=============================================================================
@@ -63,9 +60,6 @@ SMESHDS_Hypothesis::~SMESHDS_Hypothesis()
 
 const char* SMESHDS_Hypothesis::GetName() const
 {
-//   MESSAGE("SMESHDS_Hypothesis::GetName");
-//   SCRUTE(_name);
-//   SCRUTE(&_name);
   return _name.c_str();
 }
 
@@ -77,8 +71,6 @@ const char* SMESHDS_Hypothesis::GetName() const
 
 int SMESHDS_Hypothesis::GetID() const
 {
-//   MESSAGE("SMESHDS_Hypothesis::GetId");
-//   SCRUTE(_hypId);
   return _hypId;
 }
 
@@ -90,8 +82,23 @@ int SMESHDS_Hypothesis::GetID() const
 
 int SMESHDS_Hypothesis::GetType() const
 {
-//   MESSAGE("SMESHDS_Hypothesis::GetType");
-//   SCRUTE(_type);
   return _type;
 }
 
+//=============================================================================
+/*!
+ * Equality
+ */
+//=============================================================================
+
+bool SMESHDS_Hypothesis::operator==(const SMESHDS_Hypothesis& other) const
+{
+  if ( this == &other )
+    return true;
+  if ( _name != other._name )
+    return false;
+  ostringstream mySave, otherSave;
+  ((SMESHDS_Hypothesis*)this  )->SaveTo(mySave);
+  ((SMESHDS_Hypothesis*)&other)->SaveTo(otherSave);
+  return mySave.str() == otherSave.str();
+}
index 4478b4a0b9317d6860616bff6f63c313e976baf2..7060aa16ae34adcfe317b97d74b12a3d196c5bc3 100644 (file)
@@ -46,6 +46,9 @@ public:
   virtual std::ostream & SaveTo(std::ostream & save)=0;
   virtual std::istream & LoadFrom(std::istream & load)=0;
 
+  virtual bool operator==(const SMESHDS_Hypothesis& other) const;
+  bool operator!=(const SMESHDS_Hypothesis& other) const { return !(*this==other); }
+
 enum hypothesis_type {PARAM_ALGO, ALGO_0D, ALGO_1D, ALGO_2D, ALGO_3D};
 
 protected: