Salome HOME
bos #26460 Add SSL mode
[samples/atomsolv.git] / src / ATOMSOLV / ATOMSOLV.cxx
old mode 100755 (executable)
new mode 100644 (file)
index b55c4e6..8931104
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2021  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 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,41 +52,33 @@ 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::getVersion()
+char* ATOMSOLV_Abstract::getVersion()
 {
 #if defined(ATOMSOLV_DEVELOPMENT)
   return CORBA::string_dup(ATOMSOLV_VERSION_STR"dev");
@@ -104,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() ;
   }
 }