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

« back to all changes in this revision

Viewing changes to TAO/tests/Collocation_Tests/Collocated_Test.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
 
//Collocated_Test.cpp,v 1.5 2003/12/31 21:47:08 bala Exp
2
 
#include "Server_Task.h"
3
 
#include "Client_Task.h"
4
 
#include "ace/Get_Opt.h"
5
 
#include "ace/Argv_Type_Converter.h"
6
 
#include "ace/SString.h"
7
 
#include "ace/Manual_Event.h"
8
 
 
9
 
const char *output = "test.ior";
10
 
const char *input = "file://test.ior";
11
 
// static int named_orbs = 0;
12
 
ACE_CString server_orb;
13
 
ACE_CString client_orb;
14
 
int
15
 
parse_args (int argc, char *argv[])
16
 
{
17
 
  ACE_Get_Opt get_opts (argc, argv, "k:o:n");
18
 
  int c;
19
 
 
20
 
  while ((c = get_opts ()) != -1)
21
 
    switch (c)
22
 
      {
23
 
      case 'o':
24
 
        output = get_opts.opt_arg ();
25
 
        break;
26
 
      case 'k':
27
 
        input = get_opts.opt_arg ();
28
 
        break;
29
 
      case 'n':
30
 
        // named_orbs = 1;
31
 
        server_orb.set ("server_orb");
32
 
        client_orb.set ("client_orb");
33
 
        break;
34
 
      case '?':
35
 
      default:
36
 
        // This is a hack but that is okay!
37
 
        return 0;
38
 
      }
39
 
  // Indicates sucessful parsing of the command line
40
 
  return 0;
41
 
}
42
 
 
43
 
int
44
 
main (int argc, char *argv[])
45
 
{
46
 
  if (parse_args (argc,
47
 
                  argv) == -1)
48
 
    return -1;
49
 
 
50
 
  ACE_DECLARE_NEW_CORBA_ENV;
51
 
  ACE_TRY
52
 
    {
53
 
      ACE_Argv_Type_Converter satc (argc, argv);
54
 
      CORBA::ORB_var sorb =
55
 
        CORBA::ORB_init (satc.get_argc (),
56
 
                         satc.get_TCHAR_argv (),
57
 
                         server_orb.c_str ()
58
 
                         ACE_ENV_ARG_PARAMETER);
59
 
      ACE_TRY_CHECK;
60
 
 
61
 
      ACE_Manual_Event me;
62
 
      Server_Task server_task (output,
63
 
                               sorb.in (),
64
 
                               me,
65
 
                               ACE_Thread_Manager::instance ());
66
 
 
67
 
      if (server_task.activate (THR_NEW_LWP | THR_JOINABLE,
68
 
                                1,
69
 
                                1) == -1)
70
 
        {
71
 
          ACE_ERROR ((LM_ERROR, "Error activating server task\n"));
72
 
        }
73
 
 
74
 
      // Wait for the server thread to do some processing
75
 
      me.wait ();
76
 
 
77
 
      ACE_Argv_Type_Converter catc (argc, argv);
78
 
      CORBA::ORB_var corb =
79
 
        CORBA::ORB_init (catc.get_argc (),
80
 
                         catc.get_TCHAR_argv (),
81
 
                         client_orb.c_str ()
82
 
                         ACE_ENV_ARG_PARAMETER);
83
 
      ACE_TRY_CHECK;
84
 
 
85
 
      Client_Task client_task (input,
86
 
                               corb.in (),
87
 
                               ACE_Thread_Manager::instance ());
88
 
 
89
 
      if (client_task.activate (THR_NEW_LWP | THR_JOINABLE,
90
 
                                1,
91
 
                                1) == -1)
92
 
        {
93
 
          ACE_ERROR ((LM_ERROR, "Error activating client task\n"));
94
 
        }
95
 
 
96
 
      ACE_Thread_Manager::instance ()->wait ();
97
 
    }
98
 
  ACE_CATCHANY
99
 
    {
100
 
      // Ignore exceptions..
101
 
    }
102
 
  ACE_ENDTRY;
103
 
  return 0;
104
 
}