summaryrefslogtreecommitdiff
path: root/TAO/Benchmark/Marshal_Test/Orbix/orbix_marshal_server.cpp
blob: 205287577c14d5d2e2f922ad4254e71faaa77c54 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// $Id$

// ============================================================================
//
// = LIBRARY
//    CORBA Orbix marshal benchmark
// 
// = FILENAME
//    orbix_marshal_server.cpp
//
// = AUTHOR
//    Aniruddha Gokhale
// 
// ============================================================================

//#define USE_INIT

#include "orbix_marshal_server.h"

#if !defined (__ACE_INLINE__)
#include "orbix_marshal_server.i"
#endif /* __ACE_INLINE__ */

ACE_RCSID(Orbix, orbix_marshal_server, "$Id$")

int
Orbix_Marshal_Server_Proxy::run (CORBA_Marshal_Proxy::OPTIONS &options,
				CORBA_Marshal_Proxy::RESULTS &results)
{
  char **argv;
  int argc;

#if 0
  // get the argument list to be passed on to the ORB_init method
  argv = options.orb_init_args (argc);

  // get the orb. Pass any ORB_init arguments
  this->orb_ = CORBA::ORB_init (argc, (char *const *)argv, "Orbix");
  if (this->orb_ == 0)
    {
      ACE_DEBUG ((LM_DEBUG, "ORB_init failed\n"));
      return -1;
    }

  // get the argument list to be passed on to the BOA_init method
  argv = options.orb_init_args (argc);

  // get the orb. Pass any ORB_init arguments
  this->boa_ = this->orb_->BOA_init (argc, (char *const *)argv, "Orbix_BOA");
  if (this->boa_ == 0)
    {
      ACE_DEBUG ((LM_DEBUG, "ORB_init failed\n"));
      return -1;
    }
#endif
  // tell the "results" object what file it must store the results into
  results.filename (options.filename ());

  // use SII or DII accordingly
  switch (options.policy ())
    {
    case CORBA_Marshal_Options::STATIC : // use SSI
      this->ssi_ = new Marshal_SSI_Impl (options.object_name ());
      break;
    case CORBA_Marshal_Options::DYNAMIC : // use DSI
      //      this->dsi_ = new Marshal_DSI_Impl (this->orb_, ACE_OS::strdup (options.object_name ()));
      this->dsi_ = new Marshal_DSI_Impl (&CORBA::Orbix, ACE_OS::strdup (options.object_name ()));
      // register with the BOA
      try {
	// we need to do a setImpl
	//this->boa_->setImpl ("Marshal", *this->dsi_);
	CORBA::Orbix.setImpl ("Marshal", *this->dsi_);
      }
      catch (CORBA::SystemException &se)
	{
	  cerr << "system exception in obj_is_ready" << se << endl;
	}
      break;
    default:
      ACE_DEBUG ((LM_DEBUG, "bad policy\n"));
      return -1;
    }
  
  ACE_DEBUG ((LM_DEBUG, "Calling impl is ready\n"));
  try {
    // call impl_is_ready
    //    this->boa_->impl_is_ready ((char *)options.service_name ());
    CORBA::Orbix.impl_is_ready ("marshalDSI");
  }
  catch (CORBA::SystemException &se)
    {
      cerr << "system exception: " << se << endl;
    }

  return 0;
}