Salome HOME
Merge from V6_main_20120808 08Aug12
[modules/med.git] / src / MEDCalculator / MEDCalculatorBrowserLiteStruct.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 __MEDCALCULATORBROWSERLITESTRUCT_HXX__
21 #define __MEDCALCULATORBROWSERLITESTRUCT_HXX__
22
23 #include "MedCalculatorDefines.hxx"
24 #include "MEDCalculatorBrowserMesh.hxx"
25 #include "MEDCalculatorBrowserField.hxx"
26
27 #include <string>
28 #include <vector>
29
30 //  This class correspond to a MED File
31 //  It contains fields and meshes from a file
32 //  It also has methods for selecting/unselecting meshes, field and components from fields
33 namespace ParaMEDMEM
34 {
35   class MEDCALCULATOR_EXPORT MEDCalculatorBrowserLiteStruct
36   {
37   public :
38     MEDCalculatorBrowserLiteStruct();
39     ~MEDCalculatorBrowserLiteStruct();
40     MEDCalculatorBrowserLiteStruct(const char *);//  Constructor with a complet file name (with path) and simplified file name as parameters
41     bool operator==(const std::string&);//  Equal to string operator, compare simplified name to input
42     std::string str();//  Return a std::string corresponding to x/o (selected or not) File filename \n meshes \n fields
43     void setSelected(bool);//  Set selection to input bool
44     void selectAll();//  Select all meshes and fields
45     void selectAllMeshes();//  Select all meshes
46     void selectAllFields();//  Select all fields
47     void unselectAll();//  Unselect all meshes and fields
48     void unselectAllMeshes();//  Unselect all meshes
49     void unselectAllFields();//  Unselect all fields
50     bool isSelection();//  Return if there is selection or not (selection flag)
51     const std::string& getName() const;//  Return file simplified name
52     const std::string& getFile() const;//  Return full file name
53     unsigned int getNumberOfMeshes();//  Return number of meshes
54     unsigned int getNumberOfFields();//  Return number of fields
55     const std::string& getMeshName(int) const;//  Return a mesh name according to its id
56     const std::string& getFieldName(int) const;//  Return a field name according to its id
57     MEDCalculatorBrowserField& getField(int);//  Return a reference on a field according to its id
58     const MEDCalculatorBrowserField& getField(int) const;
59     MEDCalculatorBrowserField& getField(const std::string&);//  Return a reference on a field according to its name
60     MEDCalculatorBrowserMesh& getMesh(int);//  Return a reference on a mesh according to its id
61     MEDCalculatorBrowserMesh& getMesh(const std::string&);//  Return a reference on a mesh according to its name
62     void selectMesh(const std::string&);//  Select a specific mesh according to its name
63     void selectField(const std::string&);//  Select a specific field according to its name
64     void unselectMesh(const std::string&);//  Unselect a specific mesh according to its name
65     void unselectField(const std::string&);//  Unselect a specific field according to its name
66     std::vector<std::string> getCorrespondingMeshesFromField(int);//  Return a list of meshes names supporting time steps of a field
67     std::vector<std::string> getCorrespondingMeshesFromLS();//  Return a list of meshes supporting all fields of this file
68   private:
69     void computeBaseName();
70   private :
71     std::string _name;//  simplified file name
72     std::string _file;//  full path file name
73     std::vector<MEDCalculatorBrowserMesh> _meshes;//  list of all meshes from this file
74     std::vector<MEDCalculatorBrowserField> _fields;//  list of all fields from this file
75     bool _any_selection;//  selection flag
76   };
77 }
78
79 #endif