Back to index

salome-med  6.5.0
MEDCalculatorBrowserMesh.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 #include "MEDCalculatorBrowserMesh.hxx"
00020 
00021 #include <sstream>
00022 
00023 using namespace ParaMEDMEM;
00024 
00025 //  Default constructor
00026 MEDCalculatorBrowserMesh::MEDCalculatorBrowserMesh() : _selection(false)
00027 {
00028 
00029 }
00030 
00031 //  Destructor
00032 MEDCalculatorBrowserMesh::~MEDCalculatorBrowserMesh()
00033 {
00034 }
00035 
00036 MEDCalculatorBrowserMesh::MEDCalculatorBrowserMesh(const char *mname) : _name(mname), _selection(false)
00037 {
00038 }
00039 
00040 //  str method
00041 //  Construct a std::string to print mesh, using std::cout for example
00042 //  Put x or o for selected or not
00043 //  Add Mesh meshname
00044 //  Return a std::string
00045 std::string MEDCalculatorBrowserMesh::str()
00046 {
00047   std::ostringstream res;
00048   _selection?res<<"x ":res<<"o ";
00049   res<<"Mesh "<<_name;
00050   return res.str();
00051 }
00052 
00053 //  Select this mesh setting selection flag to true
00054 void MEDCalculatorBrowserMesh::select()
00055 {
00056   _selection = true;
00057 }
00058 
00059 //  Unselect this mesh setting selection flag to false
00060 void MEDCalculatorBrowserMesh::unselect()
00061 {
00062   _selection = false;
00063 }
00064 
00065 //  Return if this mesh is selected or not
00066 bool MEDCalculatorBrowserMesh::isSelected()
00067 {
00068   return _selection;
00069 }
00070 
00071 //  Return the mesh name
00072 const std::string& MEDCalculatorBrowserMesh::getName() const
00073 {
00074   return _name;
00075 }
00076 
00077 //  Return if the mesh name is equal to input or not, usefull for std::find for example
00078 bool MEDCalculatorBrowserMesh::operator==(const std::string& nm)
00079 {
00080   return _name==nm;
00081 }