Salome HOME
Updated copyright comment
[modules/med.git] / src / MEDCalculator / MEDCalculatorBrowserMesh.cxx
1 // Copyright (C) 2007-2024  CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Author : Anthony Geay (CEA/DEN)
20 #include "MEDCalculatorBrowserMesh.hxx"
21
22 #include <sstream>
23
24 using namespace MEDCoupling;
25
26 //  Default constructor
27 MEDCalculatorBrowserMesh::MEDCalculatorBrowserMesh() : _selection(false)
28 {
29
30 }
31
32 //  Destructor
33 MEDCalculatorBrowserMesh::~MEDCalculatorBrowserMesh()
34 {
35 }
36
37 MEDCalculatorBrowserMesh::MEDCalculatorBrowserMesh(const char *mname) : _name(mname), _selection(false)
38 {
39 }
40
41 //  str method
42 //  Construct a std::string to print mesh, using std::cout for example
43 //  Put x or o for selected or not
44 //  Add Mesh meshname
45 //  Return a std::string
46 std::string MEDCalculatorBrowserMesh::str()
47 {
48   std::ostringstream res;
49   _selection?res<<"x ":res<<"o ";
50   res<<"Mesh "<<_name;
51   return res.str();
52 }
53
54 //  Select this mesh setting selection flag to true
55 void MEDCalculatorBrowserMesh::select()
56 {
57   _selection = true;
58 }
59
60 //  Unselect this mesh setting selection flag to false
61 void MEDCalculatorBrowserMesh::unselect()
62 {
63   _selection = false;
64 }
65
66 //  Return if this mesh is selected or not
67 bool MEDCalculatorBrowserMesh::isSelected()
68 {
69   return _selection;
70 }
71
72 //  Return the mesh name
73 const std::string& MEDCalculatorBrowserMesh::getName() const
74 {
75   return _name;
76 }
77
78 //  Return if the mesh name is equal to input or not, useful for std::find for example
79 bool MEDCalculatorBrowserMesh::operator==(const std::string& nm)
80 {
81   return _name==nm;
82 }