summaryrefslogtreecommitdiff
path: root/TAO/examples/Simple/time/Time_Client_i.cpp
blob: 800a8501f2f76900925e6ef3398a82b9379295cd (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//$Id$

#include "Time_Client_i.h"

// This is the interface program that accesses the remote object

// Constructor.
Time_Client_i::Time_Client_i (void)
{
  //no-op
}

//Destructor.
Time_Client_i::~Time_Client_i (void)
{
  //no-op
}

int
Time_Client_i::run (int argc,
                    char *argv[])
{
  // Initialize the client.
  if (client.init (argc, argv) == -1)
    return -1;

  TAO_TRY 
    {
      //Make the RMI.
      CORBA::Long timedate = client->time (TAO_TRY_ENV);
      
      // Print out value
      char *ascii_timedate =
        ACE_OS::ctime (ACE_reinterpret_cast (time_t *,
                                             &timedate));
      ACE_DEBUG ((LM_DEBUG,
                  "string time is %s\n",
                  ascii_timedate));

      if (client.shutdown () == 1)
        client->shutdown (TAO_TRY_ENV);
    }
  TAO_CATCHANY
    {
      TAO_TRY_ENV.print_exception ("\tException");
      return -1;
    }
  TAO_ENDTRY;

  return 0;
}


#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)

template class Client<Time,Time_var>;

#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)

#pragma instantiate Client<Time,Time_var>

#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */