Salome HOME
Synchronize adm files
[modules/med.git] / src / MEDOP / cmp / MEDOPFactory_i.cxx
1 // Copyright (C) 2007-2014  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 "MEDOPFactory_i.hxx"
23 #include "utilities.h"
24
25 #include <string>
26
27 #include "MEDDataManager_i.hxx"
28 #include "MEDCalculator_i.hxx"
29
30 using namespace std;
31
32 //=============================================================================
33 /*!
34  *  standard constructor
35  */
36 //=============================================================================
37
38 MEDOPFactory_i::MEDOPFactory_i(CORBA::ORB_ptr orb,
39   PortableServer::POA_ptr poa,
40   PortableServer::ObjectId * contId,
41   const char *instanceName,
42   const char *interfaceName) :
43   Engines_Component_i(orb, poa, contId, instanceName, interfaceName)
44 {
45   MESSAGE("activate object");
46   _thisObj = this ;
47   _id = _poa->activate_object(_thisObj);
48 }
49
50 MEDOPFactory_i::~MEDOPFactory_i()
51 {
52 }
53
54 MEDOP::MEDDataManager_ptr MEDOPFactory_i::getDataManager() {
55   MEDDataManager_i * medDataManager = MEDDataManager_i::getInstance();
56   MEDOP::MEDDataManager_ptr medDataManagerPtr = medDataManager->_this();
57   return medDataManagerPtr;
58 }
59
60 MEDOP::MEDCalculator_ptr MEDOPFactory_i::getCalculator() {
61   MEDCalculator_i * medCalculator = MEDCalculator_i::getInstance();
62   MEDOP::MEDCalculator_ptr medCalculatorPtr = medCalculator->_this();
63   return medCalculatorPtr;
64 }
65
66 extern "C"
67 {
68   PortableServer::ObjectId * MEDOPFactoryEngine_factory(
69              CORBA::ORB_ptr orb,
70              PortableServer::POA_ptr poa,
71              PortableServer::ObjectId * contId,
72              const char *instanceName,
73                     const char *interfaceName)
74   {
75     MESSAGE("PortableServer::ObjectId * MEDOPEngine_factory()");
76     SCRUTE(interfaceName);
77     MEDOPFactory_i * factory = new MEDOPFactory_i(orb, poa, contId,
78               instanceName,
79               interfaceName);
80     return factory->getId() ;
81   }
82 }