Salome HOME
Merge from V6_main (04/10/2012)
[modules/med.git] / src / MEDOP / gui / MEDEventListener_i.cxx
1 //  Copyright (C) 2011  CEA/DEN, EDF R&D, OPEN CASCADE
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 // Authors : Guillaume Boulant (EDF) - 01/06/2011
20
21 #include "MEDEventListener_i.hxx"
22 #include <Basics_Utils.hxx>
23
24 MEDEventListener_i * MEDEventListener_i::_instance = NULL;
25 MEDEventListener_i * MEDEventListener_i::getInstance() {
26   // _GBO_ we will certainly need to define one EventListener per
27   // DataManager or SALOME study and not one singleton for the whole
28   // session
29   if ( _instance == NULL ) {
30     _instance = new MEDEventListener_i();
31   }
32   return _instance;
33 }
34
35 void MEDEventListener_i::release() {
36   delete _instance;
37 }
38
39 MEDEventListener_i::MEDEventListener_i()
40 {
41   LOG("Creating a MEDEventListener_i instance");
42 }
43 MEDEventListener_i::~MEDEventListener_i()
44 {
45   LOG("Deleting MEDEventListener_i instance");
46 }
47
48 void MEDEventListener_i::processMedEvent(const MEDOP::MedEvent & event) {
49   LOG("Start processing event for field id="<<event.fieldid);
50
51   // This function must be executed as fast as possible because the
52   // CORBA request is a synchronous call. Then we just emit a Qt
53   // signal and exit. The Qt signal should be received by the
54   // WorkspaceController (connect to a slot of WorkspaceController).
55
56   emit medEventSignal(new MEDOP::MedEvent(event));
57   
58
59 }