~ubuntu-branches/ubuntu/breezy/ace/breezy

« back to all changes in this revision

Viewing changes to TAO/tests/OBV/TC_Alignment/server.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad, Benjamin Montgomery, Adam Conrad
  • Date: 2005-09-18 22:51:38 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 sarge) (0.1.2 woody)
  • Revision ID: james.westby@ubuntu.com-20050918225138-seav22q6fyylb536
Tags: 5.4.7-3ubuntu1
[ Benjamin Montgomery ]
* Added a patch for amd64 and powerpc that disables the compiler
  option -fvisibility-inlines-hidden

[ Adam Conrad ]
* Added DPATCH_OPTION_CPP=1 to debian/patches/00options to make
  Benjamin's above changes work correctly with dpatch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// server.cpp,v 1.3 2003/11/10 17:58:33 jwillemsen Exp
2
 
 
3
 
#include "test_i.h"
4
 
#include "ace/OS_NS_stdio.h"
5
 
 
6
 
ACE_RCSID (TC_Alignment,
7
 
           server,
8
 
           "server.cpp,v 1.3 2003/11/10 17:58:33 jwillemsen Exp")
9
 
 
10
 
const char *ior_output_file = "test.ior";
11
 
 
12
 
int
13
 
main (int argc, char *argv[])
14
 
{
15
 
  ACE_TRY_NEW_ENV
16
 
    {
17
 
      CORBA::ORB_var orb =
18
 
        CORBA::ORB_init (argc,
19
 
                         argv,
20
 
                         ""
21
 
                         ACE_ENV_ARG_PARAMETER);
22
 
      ACE_TRY_CHECK;
23
 
 
24
 
      CORBA::Object_var poa_object =
25
 
        orb->resolve_initial_references ("RootPOA"
26
 
                                         ACE_ENV_ARG_PARAMETER);
27
 
      ACE_TRY_CHECK;
28
 
 
29
 
      if (CORBA::is_nil (poa_object.in ()))
30
 
        {
31
 
          ACE_ERROR_RETURN ((LM_ERROR,
32
 
                             " (%P|%t) Unable to initialize the POA.\n"),
33
 
                            1);
34
 
        }
35
 
 
36
 
      PortableServer::POA_var root_poa =
37
 
        PortableServer::POA::_narrow (poa_object.in ()
38
 
                                      ACE_ENV_ARG_PARAMETER);
39
 
      ACE_TRY_CHECK;
40
 
 
41
 
      PortableServer::POAManager_var poa_manager =
42
 
        root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER);
43
 
      ACE_TRY_CHECK;
44
 
 
45
 
      test_i servant (orb.in ());
46
 
 
47
 
      test_var server =
48
 
        servant._this (ACE_ENV_SINGLE_ARG_PARAMETER);
49
 
      ACE_TRY_CHECK;
50
 
 
51
 
      CORBA::String_var ior =
52
 
              orb->object_to_string (server.in ()
53
 
                               ACE_ENV_ARG_PARAMETER);
54
 
      ACE_TRY_CHECK;
55
 
 
56
 
      ACE_DEBUG ((LM_DEBUG,
57
 
                  "Activated as <%s>\n",
58
 
                  ior.in ()));
59
 
 
60
 
      // If the ior_output_file exists, output the ior to it
61
 
      if (ior_output_file != 0)
62
 
              {
63
 
                FILE *output_file= ACE_OS::fopen (ior_output_file, "w");
64
 
 
65
 
                if (output_file == 0)
66
 
            {
67
 
                    ACE_ERROR_RETURN ((LM_ERROR,
68
 
                                                   "Can't open output file for writing IOR: %s",
69
 
                                                   ior_output_file),
70
 
                                                  1);
71
 
            }
72
 
 
73
 
                ACE_OS::fprintf (output_file,
74
 
                           "%s",
75
 
                           ior.in ());
76
 
                ACE_OS::fclose (output_file);
77
 
              }
78
 
 
79
 
      poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER);
80
 
      ACE_TRY_CHECK;
81
 
 
82
 
      orb->run (ACE_ENV_SINGLE_ARG_PARAMETER);
83
 
      ACE_TRY_CHECK;
84
 
 
85
 
      root_poa->destroy (1, 1 ACE_ENV_ARG_PARAMETER);
86
 
      ACE_TRY_CHECK;
87
 
    }
88
 
  ACE_CATCHANY
89
 
    {
90
 
      ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
91
 
                           "Server: exception caught - ");
92
 
      return 1;
93
 
    }
94
 
  ACE_ENDTRY;
95
 
 
96
 
  return 0;
97
 
}