Salome HOME
10512cf025f8c102994b1403954308a3124b9122
[modules/med.git] / src / MEDCalculator / MEDCalculatorBrowserStep.hxx
1 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D
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.
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
20 #ifndef __MEDCALCULATORBROWSERSTEP_HXX__
21 #define __MEDCALCULATORBROWSERSTEP_HXX__
22
23 #include "MedCalculatorDefines.hxx"
24
25 #include <string>
26
27 //  This class corresponds to a time step (dt,it) of a field
28 //  It contains the time step (dt) and the corresponding time value
29 //  It also contains methods for selecting or unselecting this time step and it hold the name of the supporting mesh.
30 namespace ParaMEDMEM
31 {
32   class MEDCALCULATOR_EXPORT MEDCalculatorBrowserStep
33   {
34   public :
35     MEDCalculatorBrowserStep(int ts=0, int order=0, double tv=0.0, std::string m="") : _time_step(ts), _order(order), _time_value(tv), _selection(false), _mesh(m) { }
36     ~MEDCalculatorBrowserStep();
37     bool operator==(int);//  Equal to operator, to use with std::find on vector<CalculatorBrowserStep> to find a specific time step
38     bool operator==(int) const;//  Equal to operator, to use with std::find on vector< const CalculatorBrowserStep> to find a specific time step
39     bool operator==(bool);//  Equal to operator, to use with std::find on std::vector<CalculatorBrowseStep> to find selected time step
40     std::string str();//  Return a std::string corresponding to x/o (selected or not) timeStep ( timeValue )
41     void select();//  Set selection flag to True (select this time step)
42     void unselect();//  Set selection flag to False (unselect this time step)
43     bool isSelected();//  Return selection (is this time step selected or not?)
44     int getTimeStep() const;//  Return the time step id
45     int getOrder() const { return _order; }
46     const double& getTimeValue() const;//  Return the time Value
47     const std::string& getCorrespondingMeshFromStep() const;//  Return the name of the supporting mesh
48   private :
49     int _time_step;//  time step id
50     int _order;
51     double _time_value;//  time value for this time step
52     bool _selection;//  select flag
53     std::string _mesh;//  name of supporting mesh
54   };
55 }
56
57 #endif