summaryrefslogtreecommitdiff
path: root/apps/Orbix-Examples/Logger/server.cpp
blob: 2366a40031fb2dc95338135fdb304c08b72b50ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// $Id$

// The server for the logger example.
// This uses the TRY,CATCHANY,ENDTRY macros for error testing.

// The executable file generated from this code should be registered 
// (under the name 'logger') using the 'putit' command.

#include <iostream.h>
#include "logger_i.h"

ACE_RCSID(Logger, server, "$Id$")

int
main (int, char *[]) 
{
  // Tell the server not to hang up while clients are connected.
  CORBA::Orbix.setNoHangup (1);

  // create a logger object - using the implementation class logger_i
#if defined (USE_BOA_IMPL)
  profile_logger_i profile_logger;
#else
  TIE_profile_logger (profile_logger_i) profile_logger (new profile_logger_i);
#endif /* USE_BOA_IMPL */

  TRY {
    // tell Orbix that we have completed the server's initialisation:
    CORBA::Orbix.impl_is_ready (profile_logger_IMPL, IT_X);
  } CATCHANY {
    // an error occured calling impl_is_ready () - output the error.
    cout << IT_X << endl;
  } ENDTRY;

  // impl_is_ready() returns only when Orbix times-out an idle server
  // (or an error occurs).
  cerr << "server exiting" << endl;

  return 0;
}