Salome HOME
Merge remote branch 'origin/V7_8_BR'
[modules/med.git] / src / MEDCalc / gui / XmedDataModel.hxx
1 // Copyright (C) 2007-2016  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 private:
44   MEDCALC::FieldHandler _fieldHandler;
45   string _getTypedFieldLabel();
46 };
47
48 //
49 // =================================================================
50 // Definition of the data model as an implementation of the virtual
51 // class DataModel. It implements the DataObject factory.
52 // =================================================================
53 //
54 #include "DataModel.hxx"
55 class MEDCALCGUI_EXPORT XmedDataModel: public DataModel {
56 public:
57   XmedDataModel():DataModel() {};
58   virtual DataObject * newDataObject();
59 };
60
61 //
62 // =================================================================
63 // Base class for data processing
64 // =================================================================
65 // Howto use it?
66 //
67 // 1) Create an instance, call the "process" function,
68 // then get the result you are interested in, using the corresponding
69 // "result*" function.
70 //
71 // 2) Alternativly, you can just call directly the suitable master
72 // "get*" function to process and get the result you are interested
73 // in.
74 //
75 #include "DataProcessor.hxx"
76
77 class MEDCALCGUI_EXPORT XmedDataProcessor : public DataProcessor {
78 public:
79   XmedDataProcessor(DataModel * dataModel):DataProcessor(dataModel) {};
80
81   MEDCALC::FieldHandlerList * getResultingFieldHandlerList();
82   MEDCALC::FieldIdList * getResultingFieldIdList();
83
84 protected:
85   virtual void preprocess(QStringList itemNameIdList);
86   virtual void processDataObject(DataObject * dataObject);
87
88 private:
89   MEDCALC::FieldHandlerList_var _resultingFieldHandlerList;
90   MEDCALC::FieldIdList_var _resultingFieldIdList;
91   int _objectIndex;
92
93 };
94
95
96 #endif // _XMEDDATAMODEL_H_