Salome HOME
Copyright update 2020
[modules/med.git] / src / MEDCalc / cmp / MEDFactory_i.cxx
1 // Copyright (C) 2007-2020  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 // Authors : Guillaume Boulant (EDF) - 01/06/2011
21
22 #include "MEDFactory_i.hxx"
23 #include "utilities.h"
24
25 #include "MEDDataManager_i.hxx"
26 #include "MEDCalculator_i.hxx"
27 #include "MEDPresentationManager_i.hxx"
28 #include "MEDCommandsHistoryManager_i.hxx"
29
30 //=============================================================================
31 /*!
32  *  standard constructor
33  */
34 //=============================================================================
35
36 MEDFactory_i::MEDFactory_i(CORBA::ORB_ptr orb,
37                            PortableServer::POA_ptr poa,
38                            PortableServer::ObjectId* contId,
39                            const char* instanceName,
40                            const char* interfaceName)
41   : Engines_Component_i(orb, poa, contId, instanceName, interfaceName)
42 {
43   MESSAGE("activate object");
44   _thisObj = this ;
45   _id = _poa->activate_object(_thisObj);
46 }
47
48 MEDFactory_i::~MEDFactory_i()
49 {
50   // nothing to do
51 }
52
53 MEDCALC::MEDDataManager_ptr
54 MEDFactory_i::getDataManager()
55 {
56   MEDDataManager_i* medDataManager = MEDDataManager_i::getInstance();
57   MEDCALC::MEDDataManager_ptr medDataManagerPtr = medDataManager->_this();
58   return medDataManagerPtr;
59 }
60
61 MEDCALC::MEDCalculator_ptr
62 MEDFactory_i::getCalculator()
63 {
64   MEDCalculator_i* medCalculator = MEDCalculator_i::getInstance();
65   MEDCALC::MEDCalculator_ptr medCalculatorPtr = medCalculator->_this();
66   return medCalculatorPtr;
67 }
68
69 MEDCALC::MEDPresentationManager_ptr
70 MEDFactory_i::getPresentationManager()
71 {
72   MEDPresentationManager_i* manager = MEDPresentationManager_i::getInstance();
73   MEDCALC::MEDPresentationManager_ptr managerPtr = manager->_this();
74   return managerPtr;
75 }
76
77 MEDCALC::MEDCommandsHistoryManager_ptr
78 MEDFactory_i::getCommandsHistoryManager()
79 {
80   MEDCommandsHistoryManager_i* manager = MEDCommandsHistoryManager_i::getInstance();
81   MEDCALC::MEDCommandsHistoryManager_ptr managerPtr = manager->_this();
82   return managerPtr;
83 }
84
85 extern "C"
86 {
87   PortableServer::ObjectId* MEDFactoryEngine_factory(
88              CORBA::ORB_ptr orb,
89              PortableServer::POA_ptr poa,
90              PortableServer::ObjectId* contId,
91              const char* instanceName,
92              const char* interfaceName)
93   {
94     MESSAGE("PortableServer::ObjectId * MEDEngine_factory()");
95     SCRUTE(interfaceName);
96     MEDFactory_i* factory = new MEDFactory_i(orb, poa, contId,
97                                              instanceName,
98                                              interfaceName);
99     return factory->getId() ;
100   }
101 }