From: eap Date: Fri, 22 Jan 2010 11:30:28 +0000 (+0000) Subject: 0020431: EDF 1020 SMESH : Radial Mesh of a cylinder X-Git-Tag: PARAVIS_29012010~13 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=982b910458102ef516e208ccb175f9971007d4d6;p=modules%2Fsmesh.git 0020431: EDF 1020 SMESH : Radial Mesh of a cylinder + virtual bool operator==(const SMESHDS_Hypothesis& other) const; + bool operator!=(const SMESHDS_Hypothesis& other) const { return !(*this==other); } --- diff --git a/src/SMESHDS/SMESHDS_Hypothesis.cxx b/src/SMESHDS/SMESHDS_Hypothesis.cxx index 84b3a6c32..22311acee 100644 --- a/src/SMESHDS/SMESHDS_Hypothesis.cxx +++ b/src/SMESHDS/SMESHDS_Hypothesis.cxx @@ -23,10 +23,11 @@ // File : SMESHDS_Hypothesis.cxx // Author : Paul RASCLE, EDF // Module : SMESH -// $Header$ // #include "SMESHDS_Hypothesis.hxx" +#include + 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(); +} diff --git a/src/SMESHDS/SMESHDS_Hypothesis.hxx b/src/SMESHDS/SMESHDS_Hypothesis.hxx index 4478b4a0b..7060aa16a 100644 --- a/src/SMESHDS/SMESHDS_Hypothesis.hxx +++ b/src/SMESHDS/SMESHDS_Hypothesis.hxx @@ -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: