~ubuntu-branches/debian/squeeze/sword/squeeze

« back to all changes in this revision

Viewing changes to bindings/corba/orbitcpp/server.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Glassey
  • Date: 2004-01-15 15:50:07 UTC
  • Revision ID: james.westby@ubuntu.com-20040115155007-n9mz4x0zxrs1isd3
Tags: upstream-1.5.7
ImportĀ upstreamĀ versionĀ 1.5.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 
2
 
 
3
#include "swordorb-impl.hpp"
 
4
#include <iostream>
 
5
#include <swmgr.h>
 
6
#include <markupfiltmgr.h>
 
7
 
 
8
sword::SWMgr swordmgr(new sword::MarkupFilterMgr(sword::FMT_WEBIF));
 
9
 
 
10
int main (int argc, char* argv[]) {
 
11
  try {
 
12
          // Initialize the CORBA orb
 
13
          CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv);
 
14
        
 
15
          // Get the root POA
 
16
          CORBA::Object_var pfobj = orb->resolve_initial_references("RootPOA");
 
17
 
 
18
          PortableServer::POA_var rootPOA =
 
19
         PortableServer::POA::_narrow(pfobj);
 
20
 
 
21
          // Activate the root POA's manager
 
22
          PortableServer::POAManager_var mgr = rootPOA->the_POAManager();
 
23
 
 
24
          mgr->activate();
 
25
 
 
26
          // Create a Servant and explicitly create a CORBA object
 
27
          swordorb::SWMgr_impl servant(&swordmgr);
 
28
          CORBA::Object_var object = servant._this();
 
29
 
 
30
          // Here we get the IOR for the Hello server object.
 
31
          // Our "client" will use the IOR to find the object to connect to
 
32
          CORBA::String_var ref = orb->object_to_string( object );
 
33
 
 
34
          // print out the IOR
 
35
          std::cout << ref << std::endl;
 
36
 
 
37
          // run the server event loop
 
38
          orb->run();
 
39
  }
 
40
  catch(const CORBA::Exception& ex)
 
41
  {
 
42
    std::cout << "Exception caught." << std::endl;
 
43
  }
 
44
 
 
45
}