Salome HOME
bos #26460 Add SSL mode
[samples/atomsolv.git] / src / ATOMSOLV / ATOMSOLV.cxx
old mode 100755 (executable)
new mode 100644 (file)
index b927f78..8931104
@@ -1,48 +1,50 @@
-//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2021  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 
-using namespace std;
 #include "ATOMSOLV.hxx"
+#include "ATOMSOLV_version.h"
 #include "utilities.h"
 
 #include <string>
 
+using namespace std;
+
 
-ATOMSOLV::ATOMSOLV(CORBA::ORB_ptr orb,
+ATOMSOLV_Abstract::ATOMSOLV_Abstract(CORBA::ORB_ptr orb,
        PortableServer::POA_ptr poa,
        PortableServer::ObjectId * contId, 
        const char *instanceName, 
-       const char *interfaceName) :
-  Engines_Component_i(orb, poa, contId, instanceName, interfaceName)
+       const char *interfaceName,
+  bool withRegistry) :
+  Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, withRegistry)
 {
   MESSAGE("activate object");
   _thisObj = this ;
   _id = _poa->activate_object(_thisObj);
+  myData = new ATOMSOLV_ORB::TMoleculeList();
 }
 
-ATOMSOLV::~ATOMSOLV()
+ATOMSOLV_Abstract::~ATOMSOLV_Abstract()
 {
 }
 
-CORBA::Boolean ATOMSOLV::setData( CORBA::Long studyID, const ATOMSOLV_ORB::TMoleculeList& theData )
+CORBA::Boolean ATOMSOLV_Abstract::setData( const ATOMSOLV_ORB::TMoleculeList& theData )
 {
   const int n = theData.length();
   ATOMSOLV_ORB::TMoleculeList_var data = new ATOMSOLV_ORB::TMoleculeList();
@@ -50,40 +52,40 @@ CORBA::Boolean ATOMSOLV::setData( CORBA::Long studyID, const ATOMSOLV_ORB::TMole
   for ( int i = 0; i < n; i++ )
     data[ i ] = theData[ i ];
 
-  //  printf( " -- ATOMSOLV::setData( %d ) length = %d\n", studyID, data->length() );
-  myData[ studyID ] = data._retn();
+  //  printf( " -- ATOMSOLV::setData() length = %d\n", data->length() );
+  myData = data._retn();
 
   return (bool)n;
 }
 
-CORBA::Boolean ATOMSOLV::getData( CORBA::Long studyID, ATOMSOLV_ORB::TMoleculeList_out outData )
+CORBA::Boolean ATOMSOLV_Abstract::getData( ATOMSOLV_ORB::TMoleculeList_out outData )
 {
-  if ( myData.find( studyID ) != myData.end() ) {
-    ATOMSOLV_ORB::TMoleculeList* data = myData[ studyID ];
-
-    //    printf( " -- ATOMSOLV::getData( %d ) length = %d\n", studyID, data->length() );
-    const int n = data->length();
-    outData = new ATOMSOLV_ORB::TMoleculeList();
-    outData->length( n );
-
-    for ( int i = 0; i < n; i++ )
-      (*outData)[ i ] = (*data)[ i ];
-    
-    return true;
-  }
-  return false;
+  ATOMSOLV_ORB::TMoleculeList* data = myData;
+  //    printf( " -- ATOMSOLV_Abstract::getData() length = %d\n", data->length() );
+  const int n = data->length();
+  outData = new ATOMSOLV_ORB::TMoleculeList();
+  outData->length( n );
+  for ( int i = 0; i < n; i++ )
+    (*outData)[ i ] = (*data)[ i ];
+  return true;
 }
 
-CORBA::Boolean ATOMSOLV::processData( CORBA::Long studyID )
+CORBA::Boolean ATOMSOLV_Abstract::processData()
 {
-  if ( myData.find( studyID ) != myData.end() ) {
-    ATOMSOLV_ORB::TMoleculeList* data = myData[ studyID ];
-    for ( int i = 0, n = data->length(); i < n; i++ )
-      (*data)[i].temperature = rand();
-  }
+  ATOMSOLV_ORB::TMoleculeList* data = myData;
+  for ( int i = 0, n = data->length(); i < n; i++ )
+    (*data)[i].temperature = rand();
   return true;
 }
 
+char* ATOMSOLV_Abstract::getVersion()
+{
+#if defined(ATOMSOLV_DEVELOPMENT)
+  return CORBA::string_dup(ATOMSOLV_VERSION_STR"dev");
+#else
+  return CORBA::string_dup(ATOMSOLV_VERSION_STR);
+#endif
+}
 
 extern "C"
 {
@@ -96,8 +98,8 @@ extern "C"
   {
     MESSAGE("PortableServer::ObjectId * ATOMSOLVEngine_factory()");
     SCRUTE(interfaceName);
-    ATOMSOLV * myATOMSOLV 
-      = new ATOMSOLV(orb, poa, contId, instanceName, interfaceName);
+    ATOMSOLV_Session * myATOMSOLV 
+      = new ATOMSOLV_Session(orb, poa, contId, instanceName, interfaceName);
     return myATOMSOLV->getId() ;
   }
 }