make GetNumberOfSegments and GetScaleFactor const

This commit is contained in:
jrt 2003-09-04 09:13:24 +00:00
parent 5b889e3e3e
commit 0273fe09c6
2 changed files with 38 additions and 37 deletions

View File

@ -26,7 +26,6 @@
// Module : SMESH // Module : SMESH
// $Header$ // $Header$
using namespace std;
using namespace std; using namespace std;
#include "SMESH_NumberOfSegments.hxx" #include "SMESH_NumberOfSegments.hxx"
@ -36,8 +35,8 @@ using namespace std;
*/ */
//============================================================================= //=============================================================================
SMESH_NumberOfSegments::SMESH_NumberOfSegments(int hypId, int studyId, SMESH_Gen* gen) SMESH_NumberOfSegments::SMESH_NumberOfSegments(int hypId, int studyId,
: SMESH_Hypothesis(hypId, studyId, gen) SMESH_Gen * gen):SMESH_Hypothesis(hypId, studyId, gen)
{ {
_numberOfSegments = 1; _numberOfSegments = 1;
_scaleFactor = 1.0; _scaleFactor = 1.0;
@ -65,7 +64,8 @@ void SMESH_NumberOfSegments::SetNumberOfSegments(int segmentsNumber)
{ {
int oldNumberOfSegments = _numberOfSegments; int oldNumberOfSegments = _numberOfSegments;
if (segmentsNumber <= 0) if (segmentsNumber <= 0)
throw SALOME_Exception(LOCALIZED("number of segments must be positive")); throw
SALOME_Exception(LOCALIZED("number of segments must be positive"));
_numberOfSegments = segmentsNumber; _numberOfSegments = segmentsNumber;
if (oldNumberOfSegments != _numberOfSegments) if (oldNumberOfSegments != _numberOfSegments)
@ -78,7 +78,7 @@ void SMESH_NumberOfSegments::SetNumberOfSegments(int segmentsNumber)
*/ */
//============================================================================= //=============================================================================
int SMESH_NumberOfSegments::GetNumberOfSegments() int SMESH_NumberOfSegments::GetNumberOfSegments() const
{ {
return _numberOfSegments; return _numberOfSegments;
} }
@ -105,7 +105,7 @@ void SMESH_NumberOfSegments::SetScaleFactor(double scaleFactor)
*/ */
//============================================================================= //=============================================================================
double SMESH_NumberOfSegments::GetScaleFactor() double SMESH_NumberOfSegments::GetScaleFactor() const
{ {
return _scaleFactor; return _scaleFactor;
} }
@ -155,8 +155,9 @@ istream& operator >> (istream & load, SMESH_NumberOfSegments & hyp)
bool isOK = true; bool isOK = true;
int a; int a;
isOK = (load >> a); isOK = (load >> a);
if (isOK) hyp._numberOfSegments = a; if (isOK)
else load.clear(ios::badbit | load.rdstate()); hyp._numberOfSegments = a;
else
load.clear(ios::badbit | load.rdstate());
return load; return load;
} }

View File

@ -42,12 +42,12 @@ public:
void SetNumberOfSegments(int segmentsNumber) void SetNumberOfSegments(int segmentsNumber)
throw (SALOME_Exception); throw (SALOME_Exception);
int GetNumberOfSegments(); int GetNumberOfSegments() const;
void SetScaleFactor(double scaleFactor) void SetScaleFactor(double scaleFactor)
throw (SALOME_Exception); throw (SALOME_Exception);
double GetScaleFactor(); double GetScaleFactor() const;
virtual ostream & SaveTo(ostream & save); virtual ostream & SaveTo(ostream & save);
virtual istream & LoadFrom(istream & load); virtual istream & LoadFrom(istream & load);