1 // SMESH SMESH : implementaion of SMESH idl descriptions
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : StdMeshers_Arithmetic1D.cxx
25 // Author : Damien COQUERET, OCC
30 #include "StdMeshers_Arithmetic1D.hxx"
32 //=============================================================================
36 //=============================================================================
38 StdMeshers_Arithmetic1D::StdMeshers_Arithmetic1D(int hypId, int studyId,
39 SMESH_Gen * gen):SMESH_Hypothesis(hypId, studyId, gen)
43 _name = "Arithmetic1D";
47 //=============================================================================
51 //=============================================================================
53 StdMeshers_Arithmetic1D::~StdMeshers_Arithmetic1D()
57 //=============================================================================
61 //=============================================================================
63 void StdMeshers_Arithmetic1D::SetLength(double length, bool isStartLength)
64 throw(SALOME_Exception)
66 if ( (isStartLength ? _begLength : _endLength) != length ) {
68 throw SALOME_Exception(LOCALIZED("length must be positive"));
74 NotifySubMeshesHypothesisModification();
78 //=============================================================================
82 //=============================================================================
84 double StdMeshers_Arithmetic1D::GetLength(bool isStartLength) const
86 return isStartLength ? _begLength : _endLength;
89 //=============================================================================
93 //=============================================================================
95 ostream & StdMeshers_Arithmetic1D::SaveTo(ostream & save)
97 save << _begLength << " " << _endLength;
101 //=============================================================================
105 //=============================================================================
107 istream & StdMeshers_Arithmetic1D::LoadFrom(istream & load)
110 isOK = (load >> _begLength);
112 load.clear(ios::badbit | load.rdstate());
113 isOK = (load >> _endLength);
115 load.clear(ios::badbit | load.rdstate());
119 //=============================================================================
123 //=============================================================================
125 ostream & operator <<(ostream & save, StdMeshers_Arithmetic1D & hyp)
127 return hyp.SaveTo( save );
130 //=============================================================================
134 //=============================================================================
136 istream & operator >>(istream & load, StdMeshers_Arithmetic1D & hyp)
138 return hyp.LoadFrom( load );