summaryrefslogtreecommitdiff
path: root/TAO/tao/PortableServer/ServerInterceptorAdapter.h
blob: 705fb60403f60f16c68118d31b7eabb994806be8 (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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
// -*- C++ -*-

//=============================================================================
/**
 *  @file    ServerInterceptorAdapter.h
 *
 *  $Id$
 *
 *   This file contains a helper class to simplify the support of
 *   interceptors in tao_idl generated skeletons.
 *
 *  @author  Nanbor Wang <nanbor@cs.wustl.edu>
 *  @author  Ossama Othman <ossama@uci.edu>
 *  @author  Kirthika Parameswaran  <kirthika@cs.wustl.edu>
 */
//=============================================================================


#ifndef TAO_SERVER_INTERCEPTOR_ADAPTER_H
#define TAO_SERVER_INTERCEPTOR_ADAPTER_H

#include /**/ "ace/pre.h"

#include "tao/orbconf.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */


#if TAO_HAS_INTERCEPTORS == 1

#include "portableserver_export.h"

#include "tao/PortableInterceptorC.h"
#include "tao/Interceptor_List.h"

class TAO_ServerRequestInfo;

/**
 * @class TAO_ServerRequestInterceptor_Adapter
 *
 * @brief TAO_ServerRequestInterceptor_Adapter
 *
 * A convenient helper class to invoke registered server request
 * interceptor(s) in tao_idl generated code.
 */
class TAO_PortableServer_Export TAO_ServerRequestInterceptor_Adapter
{

public:

  TAO_ServerRequestInterceptor_Adapter (
    TAO_ServerRequestInterceptor_List::TYPE &interceptors,
    size_t &stack_size);

  ~TAO_ServerRequestInterceptor_Adapter (void);

  /**
   * @name PortableInterceptor Client Side Interception Points
   *
   * Each of these methods corresponds to a client side interception
   * point.
   *
   */
  //@{
  /// This method implements the "starting" server side interception
  /// point. It will be used as the first interception point and it is
  /// proprietary to TAO.
  /// @@ Will go away once Bug 1369 is fixed
  void tao_ft_interception_point (
    TAO_ServerRequestInfo *ri ,
    CORBA::OctetSeq_out oc
    ACE_ENV_ARG_DECL);

  /// This method implements the "intermediate" server side interception
  /// point.
  /// @@ NOTE: This method should have been the "starting"
  /// interception point according to the interceptor spec. This will
  /// be fixed once Bug 1369 is completely done.
  void receive_request_service_contexts (
    TAO_ServerRequestInfo * ri
    ACE_ENV_ARG_DECL);

  /// This method an "intermediate" server side interception point.
  void receive_request (TAO_ServerRequestInfo * ri
                        ACE_ENV_ARG_DECL);

  /// This method implements one of the "ending" server side
  /// interception points.
  void send_reply (TAO_ServerRequestInfo * ri
                   ACE_ENV_ARG_DECL);

  /// This method implements one of the "ending" server side
  /// interception points.
  void send_exception (TAO_ServerRequestInfo * ri
                       ACE_ENV_ARG_DECL);

  /// This method implements one of the "ending" server side
  /// interception points.
  void send_other (TAO_ServerRequestInfo * ri
                   ACE_ENV_ARG_DECL);
  //@}

  /// Returns true if a LOCATION_FORWARD was generated, and false
  /// otherwise.
  CORBA::Boolean location_forwarded (void) const;

private:

  /// Reference to the list of registered interceptors.
  TAO_ServerRequestInterceptor_List::TYPE & interceptors_;

  /// Cache the length of the interceptor list so that we don't have
  /// to compute it at each stage of the current interception.
  const size_t len_;

  /// The number of interceptors "pushed" onto the logical flow
  /// stack.  This is used when unwinding the flow stack.
  size_t & stack_size_;

  /// True if a PortableInterceptor::ForwardRequest exception was
  /// thrown.
  CORBA::Boolean location_forwarded_;

};

#if defined (__ACE_INLINE__)
# include "ServerInterceptorAdapter.inl"
#endif  /* __ACE_INLINE__ */

#endif  /* TAO_HAS_INTERCEPTORS */

#include /**/ "ace/post.h"

#endif /* TAO_SERVER_INTERCEPTOR_ADAPTER_H */