Salome HOME
[Huge] Introducing MEDCalc
[modules/med.git] / src / MEDCalc / gui / XmedDataModel.hxx
1 // Copyright (C) 2007-2015  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
20 #ifndef _XMEDDATAMODEL_H_
21 #define _XMEDDATAMODEL_H_
22
23 #include <SALOMEconfig.h>
24 #include CORBA_CLIENT_HEADER(MEDDataManager)
25
26 #include "MEDCALCGUI.hxx"
27
28 //
29 // =================================================================
30 // Definition of an atom in the data model as an implementation of
31 // the virtual class DataObject
32 // =================================================================
33 //
34 #include "DataObject.hxx"
35 class MEDCALCGUI_EXPORT XmedDataObject: public DataObject {
36 public:
37   XmedDataObject();
38   virtual string getPath();
39
40   void setFieldHandler(MEDCALC::FieldHandler fieldHandler);
41   MEDCALC::FieldHandler * getFieldHandler();
42
43   static const int NB_TYPE_OF_FIELDS = 4;
44   static const char *  mapTypeOfFieldLabel[NB_TYPE_OF_FIELDS];
45
46 private:
47   MEDCALC::FieldHandler _fieldHandler;
48   string _getTypedFieldLabel();
49 };
50
51 //
52 // =================================================================
53 // Definition of the data model as an implementation of the virtual
54 // class DataModel. It implements the DataObject factory.
55 // =================================================================
56 //
57 #include "DataModel.hxx"
58 class MEDCALCGUI_EXPORT XmedDataModel: public DataModel {
59 public:
60   XmedDataModel():DataModel() {};
61   virtual DataObject * newDataObject();
62 };
63
64 //
65 // =================================================================
66 // Base class for data processing
67 // =================================================================
68 // Howto use it?
69 //
70 // 1) Create an instance, call the "process" function,
71 // then get the result you are interested in, using the corresponding
72 // "result*" function.
73 //
74 // 2) Alternativly, you can just call directly the suitable master
75 // "get*" function to process and get the result you are interested
76 // in.
77 //
78 #include "DataProcessor.hxx"
79
80 class MEDCALCGUI_EXPORT XmedDataProcessor : public DataProcessor {
81 public:
82   XmedDataProcessor(DataModel * dataModel):DataProcessor(dataModel) {};
83
84   MEDCALC::FieldHandlerList * getResultingFieldHandlerList();
85   MEDCALC::FieldIdList * getResultingFieldIdList();
86
87 protected:
88   virtual void preprocess(QStringList itemNameIdList);
89   virtual void processDataObject(DataObject * dataObject);
90
91 private:
92   MEDCALC::FieldHandlerList_var _resultingFieldHandlerList;
93   MEDCALC::FieldIdList_var _resultingFieldIdList;
94   int _objectIndex;
95
96 };
97
98
99 #endif // _XMEDDATAMODEL_H_