summaryrefslogtreecommitdiff
path: root/TAO/tests/Portable_Interceptors/AdvSlotDblCpy/client.cpp
blob: 4c829a31980775e88cae7d51356fcbcb416e6407 (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
41
42
43
44
45
46
47
// author    : Boris Kolpackov <boris@dre.vanderbilt.edu>
#include "InvokeMeC.h"

namespace
{
  class always
  {
    const InvokeMe_ptr server_;
  public:
    always(const InvokeMe_ptr x):server_(x) {}
    ~always()
    {
      ACE_DEBUG ((LM_DEBUG, "\n"));
      server_->shutdown ();
    }
  };
}

int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
  try
    {
      CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);

      if (argc != 2)
        {
          ACE_DEBUG ((LM_ERROR, "Usage: %s <ior>\n", argv[0]));
          return -1;
        }

      CORBA::Object_var obj = orb->string_to_object (argv[1]);
      InvokeMe_var server = InvokeMe::_narrow (obj.in ());

      always Shutdown( server.in () ); // When goes out of scope!
      server->invoke_me ();
      ACE_DEBUG ((LM_DEBUG, "\n"));
      server->invoke_me ();
    }
  catch (const ::CORBA::Exception &ex)
    {
      ex._tao_print_exception ("ERROR : unexpected CORBA exception caught : ");
      return 1;
    }

  return 0;
}