1 // SMESH StdMeshers_StartEndLength : 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_StartEndLength.cxx
30 #include "StdMeshers_StartEndLength.hxx"
31 #include "utilities.h"
34 //=============================================================================
38 //=============================================================================
40 StdMeshers_StartEndLength::StdMeshers_StartEndLength(int hypId,
43 :SMESH_Hypothesis(hypId, studyId, gen)
47 _name = "StartEndLength";
48 _param_algo_dim = 1; // is used by SMESH_Regular_1D
51 //=============================================================================
55 //=============================================================================
57 StdMeshers_StartEndLength::~StdMeshers_StartEndLength()
61 //=============================================================================
65 //=============================================================================
67 void StdMeshers_StartEndLength::SetLength(double length, bool isStartLength)
68 throw(SALOME_Exception)
70 if ( (isStartLength ? _begLength : _endLength) != length ) {
72 throw SALOME_Exception(LOCALIZED("length must be positive"));
78 NotifySubMeshesHypothesisModification();
82 //=============================================================================
86 //=============================================================================
88 double StdMeshers_StartEndLength::GetLength(bool isStartLength) const
90 return isStartLength ? _begLength : _endLength;
93 //=============================================================================
97 //=============================================================================
99 ostream & StdMeshers_StartEndLength::SaveTo(ostream & save)
101 save << _begLength << _endLength;
105 //=============================================================================
109 //=============================================================================
111 istream & StdMeshers_StartEndLength::LoadFrom(istream & load)
114 isOK = (load >> _begLength);
116 load.clear(ios::badbit | load.rdstate());
117 isOK = (load >> _endLength);
119 load.clear(ios::badbit | load.rdstate());
123 //=============================================================================
127 //=============================================================================
129 ostream & operator <<(ostream & save, StdMeshers_StartEndLength & hyp)
131 return hyp.SaveTo( save );
134 //=============================================================================
138 //=============================================================================
140 istream & operator >>(istream & load, StdMeshers_StartEndLength & hyp)
142 return hyp.LoadFrom( load );