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