summaryrefslogtreecommitdiff
path: root/TAO/tests/OBV/Simple/Client_i.cpp
blob: bb150ce6abda5e0c68f8871ce56ded9ee2d54d4d (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
63
//$Id$

#include "Client_i.h"
#include "OBV_impl.h"

#include "tao/ORB_Core.h"

#include "ace/Get_Opt.h"
#include "ace/OS_NS_sys_time.h"

int
Checkpoint_Client_i::run (const char *name,
                          int argc,
                          char *argv[])
{
  // Initialize the client (read ior...).
  if (checkpoint.init (name,argc, argv) == -1)
    return -1;

  // Set random seed
  ACE_Time_Value now (ACE_OS::gettimeofday ());
  ACE_OS::srand ((unsigned int) now.sec () );


  try
    {
      ACE_DEBUG ((LM_DEBUG, "Send some random events:\n"));

      CORBA::Long value = 64;
      Event_var t_e (static_cast<Event*> (new Event_impl (value)));
      t_e->do_print ();
      checkpoint->put_event (t_e);

      value = 34;
      t_e = new Event_impl (value);
      t_e->do_print ();
      checkpoint->put_event (t_e);

      if (checkpoint.shutdown () == 1)
        checkpoint->shutdown ();

    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("\n Exception in RMI");
      return -1;
    }

  return 0;
}

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

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