1 // Copyright (C) 2007-2014 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
19 // Author : Anthony GEAY (EDF R&D)
21 #include "SALOMESDS_DataScopeServer.hxx"
22 #include "SALOMESDS_DataServerManager.hxx"
23 #include "SALOMESDS_Exception.hxx"
25 #include "SALOME_NamingService.hxx"
30 int main(int argc, char *argv[])
32 std::string scopeName;
34 throw SALOMESDS::Exception("In the main of SALOME_DataScopeServer.cxx !");
36 CORBA::ORB_var orb(CORBA::ORB_init(argc,argv));
37 CORBA::Object_var obj(orb->resolve_initial_references("RootPOA"));
38 PortableServer::POA_var poa(PortableServer::POA::_narrow(obj));
39 PortableServer::POAManager_var mgr(poa->the_POAManager());
41 SALOMESDS::DataScopeServer *server(new SALOMESDS::DataScopeServer(orb,scopeName));
43 CORBA::PolicyList policies;
45 PortableServer::ThreadPolicy_var threadPol(poa->create_thread_policy(PortableServer::SINGLE_THREAD_MODEL));
46 policies[0]=PortableServer::ThreadPolicy::_duplicate(threadPol);
47 PortableServer::POA_var poa2(poa->create_POA("SingleThPOA4SDS",mgr,policies));
49 server->initializePython(argc,argv);// agy : Very important ! invoke this method BEFORE activation !
50 server->registerToSalomePiDict();
51 PortableServer::ObjectId_var id(poa2->activate_object(server));
52 obj=poa2->id_to_reference(id);
53 SALOME::DataScopeServer_var serverPtr(SALOME::DataScopeServer::_narrow(obj));
54 server->setPOAAndRegister(poa2,serverPtr);
57 server->_remove_ref();