summaryrefslogtreecommitdiff
path: root/trunk/TAO/tests/Portable_Interceptors/Benchmark/Client_ORBInitializer.cpp
blob: d6c1ed13d553a108bc23968e6651f83d7dc563b1 (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
// -*- C++ -*-
//
// $Id$
//

#include "Client_ORBInitializer.h"
#include "client_interceptors.h"
#include "Interceptor_Type.h"

ACE_RCSID (Benchmark, Client_ORBInitializer, "$Id$")

Client_ORBInitializer::Client_ORBInitializer (int interceptor_type)
  : interceptor_type_ (interceptor_type)
{
}

void
Client_ORBInitializer::pre_init (
    PortableInterceptor::ORBInitInfo_ptr)
{
}

void
Client_ORBInitializer::post_init (
    PortableInterceptor::ORBInitInfo_ptr info)
{

  PortableInterceptor::ClientRequestInterceptor_ptr tmp =
    PortableInterceptor::ClientRequestInterceptor::_nil ();

  switch (this->interceptor_type_)
    {
    default:
    case IT_NONE:
      return;

    case IT_NOOP:
      {
        // Installing the Vault interceptor
        ACE_NEW_THROW_EX (tmp,
                          Vault_Client_Request_NOOP_Interceptor (),
                          CORBA::NO_MEMORY ());
        break;
      }
    case IT_CONTEXT:
      {
        // Installing the Vault interceptor
        ACE_NEW_THROW_EX (tmp,
                          Vault_Client_Request_Context_Interceptor (),
                          CORBA::NO_MEMORY ());
        break;
      }
    case IT_DYNAMIC:
      {
        // Installing the Vault interceptor
        ACE_NEW_THROW_EX (tmp,
                          Vault_Client_Request_Dynamic_Interceptor (),
                          CORBA::NO_MEMORY ());
        break;
      }
    }

  PortableInterceptor::ClientRequestInterceptor_var interceptor = tmp;

  info->add_client_request_interceptor (interceptor.in ());
}