1 // Copyright (C) 2007-2012 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.
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
21 #include "ATOMSOLV.hxx"
22 #include "utilities.h"
27 ATOMSOLV::ATOMSOLV(CORBA::ORB_ptr orb,
28 PortableServer::POA_ptr poa,
29 PortableServer::ObjectId * contId,
30 const char *instanceName,
31 const char *interfaceName) :
32 Engines_Component_i(orb, poa, contId, instanceName, interfaceName)
34 MESSAGE("activate object");
36 _id = _poa->activate_object(_thisObj);
43 CORBA::Boolean ATOMSOLV::setData( CORBA::Long studyID, const ATOMSOLV_ORB::TMoleculeList& theData )
45 const int n = theData.length();
46 ATOMSOLV_ORB::TMoleculeList_var data = new ATOMSOLV_ORB::TMoleculeList();
48 for ( int i = 0; i < n; i++ )
49 data[ i ] = theData[ i ];
51 // printf( " -- ATOMSOLV::setData( %d ) length = %d\n", studyID, data->length() );
52 myData[ studyID ] = data._retn();
57 CORBA::Boolean ATOMSOLV::getData( CORBA::Long studyID, ATOMSOLV_ORB::TMoleculeList_out outData )
59 if ( myData.find( studyID ) != myData.end() ) {
60 ATOMSOLV_ORB::TMoleculeList* data = myData[ studyID ];
62 // printf( " -- ATOMSOLV::getData( %d ) length = %d\n", studyID, data->length() );
63 const int n = data->length();
64 outData = new ATOMSOLV_ORB::TMoleculeList();
67 for ( int i = 0; i < n; i++ )
68 (*outData)[ i ] = (*data)[ i ];
75 CORBA::Boolean ATOMSOLV::processData( CORBA::Long studyID )
77 if ( myData.find( studyID ) != myData.end() ) {
78 ATOMSOLV_ORB::TMoleculeList* data = myData[ studyID ];
79 for ( int i = 0, n = data->length(); i < n; i++ )
80 (*data)[i].temperature = rand();
88 PortableServer::ObjectId * ATOMSOLVEngine_factory(
90 PortableServer::POA_ptr poa,
91 PortableServer::ObjectId * contId,
92 const char *instanceName,
93 const char *interfaceName)
95 MESSAGE("PortableServer::ObjectId * ATOMSOLVEngine_factory()");
96 SCRUTE(interfaceName);
98 = new ATOMSOLV(orb, poa, contId, instanceName, interfaceName);
99 return myATOMSOLV->getId() ;