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