3 // Created : 5 November 2001
4 // Author : Lucien PIGNOLONI
6 // Copyright : OPEN CASCADE
9 #include "GEOM_Gen_i.hh"
10 #include "SALOME_NamingService.hxx"
12 //==================================================================================
13 // function : main() MAIN
15 //==================================================================================
16 int main(int argc, char** argv)
19 // Create and initialise the ORB.
20 CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB3");
22 // Obtain a reference to the root POA.
23 CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
24 PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
26 // We allocate the objects on the heap. Since these are reference
27 // counted objects, they will be deleted by the POA when they are no
29 GEOM_Gen_i * myGEOM_Gen_i = new GEOM_Gen_i(orb);
31 // Activate the objects. This tells the POA that the objects are
32 // ready to accept requests.
33 PortableServer::ObjectId_var myGEOM_Gen_iid = poa->activate_object(myGEOM_Gen_i);
34 myGEOM_Gen_i->register_name("/myGEOM_Gen");
36 // Obtain a POAManager, and tell the POA to start accepting
37 // requests on its objects.
38 PortableServer::POAManager_var pman = poa->the_POAManager();
44 catch(CORBA::SystemException&) {
45 cerr << "Caught CORBA::SystemException." << endl;
47 catch(CORBA::Exception&) {
48 cerr << "Caught CORBA::Exception." << endl;
50 catch(omniORB::fatalException& fe) {
51 cerr << "Caught omniORB::fatalException:" << endl;
52 cerr << " file: " << fe.file() << endl;
53 cerr << " line: " << fe.line() << endl;
54 cerr << " msg: " << fe.errmsg() << endl;
57 cerr << "Caught unknown exception." << endl;