1 // Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "ATOMSOLV.hxx"
21 #include "ATOMSOLV_version.h"
22 #include "utilities.h"
29 ATOMSOLV::ATOMSOLV(CORBA::ORB_ptr orb,
30 PortableServer::POA_ptr poa,
31 PortableServer::ObjectId * contId,
32 const char *instanceName,
33 const char *interfaceName) :
34 Engines_Component_i(orb, poa, contId, instanceName, interfaceName)
36 MESSAGE("activate object");
38 _id = _poa->activate_object(_thisObj);
39 myData = new ATOMSOLV_ORB::TMoleculeList();
46 CORBA::Boolean ATOMSOLV::setData( const ATOMSOLV_ORB::TMoleculeList& theData )
48 const int n = theData.length();
49 ATOMSOLV_ORB::TMoleculeList_var data = new ATOMSOLV_ORB::TMoleculeList();
51 for ( int i = 0; i < n; i++ )
52 data[ i ] = theData[ i ];
54 // printf( " -- ATOMSOLV::setData() length = %d\n", data->length() );
55 myData = data._retn();
60 CORBA::Boolean ATOMSOLV::getData( ATOMSOLV_ORB::TMoleculeList_out outData )
62 ATOMSOLV_ORB::TMoleculeList* data = myData;
63 // printf( " -- ATOMSOLV::getData() length = %d\n", data->length() );
64 const int n = data->length();
65 outData = new ATOMSOLV_ORB::TMoleculeList();
67 for ( int i = 0; i < n; i++ )
68 (*outData)[ i ] = (*data)[ i ];
72 CORBA::Boolean ATOMSOLV::processData()
74 ATOMSOLV_ORB::TMoleculeList* data = myData;
75 for ( int i = 0, n = data->length(); i < n; i++ )
76 (*data)[i].temperature = rand();
80 char* ATOMSOLV::getVersion()
82 #if defined(ATOMSOLV_DEVELOPMENT)
83 return CORBA::string_dup(ATOMSOLV_VERSION_STR"dev");
85 return CORBA::string_dup(ATOMSOLV_VERSION_STR);
91 PortableServer::ObjectId * ATOMSOLVEngine_factory(
93 PortableServer::POA_ptr poa,
94 PortableServer::ObjectId * contId,
95 const char *instanceName,
96 const char *interfaceName)
98 MESSAGE("PortableServer::ObjectId * ATOMSOLVEngine_factory()");
99 SCRUTE(interfaceName);
100 ATOMSOLV * myATOMSOLV
101 = new ATOMSOLV(orb, poa, contId, instanceName, interfaceName);
102 return myATOMSOLV->getId() ;