summaryrefslogtreecommitdiff
path: root/TAO/tao/RTCORBA/RT_Endpoint_Selector_Factory.h
blob: 43cf89279b2f8b1f38cefa0dd233af138186cb5e (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
// This may look like C, but it's really -*- C++ -*-

//=============================================================================
/**
 *  @file   RT_Endpoint_Selector_Factory.h
 *
 *  $Id$
 *
 * Strategies for selecting profile/endpoint from an IOR for making an
 * invocation.
 *
 *  @author Marina Spivak <marina@cs.wustl.edu>
 */
//=============================================================================


#ifndef RT_ENDPOINT_SELECTOR_FACTORY_H
#define RT_ENDPOINT_SELECTOR_FACTORY_H
#include "ace/pre.h"

#include "rtcorba_export.h"

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

#include "tao/Endpoint_Selector_Factory.h"
#include "ace/Service_Config.h"

class TAO_Priority_Endpoint_Selector;
class TAO_Bands_Endpoint_Selector;
class TAO_Protocol_Endpoint_Selector;
class TAO_Priority_Protocol_Selector;
class TAO_Bands_Protocol_Selector;
class TAO_Default_Endpoint_Selector;

// ****************************************************************
/**
 * @class RT_Endpoint_Selector_Factory
 *
 * @brief Factory for initializing <Endpoint_Selection_State> and
 * obtaining appropriate <Invocation_Endpoint_Selector>.
 *
 * Used by Invocation classes to intialize its endpoint selection
 * strategy and state based on the effective policies.
 * Endpoint selection strategies are stateless objects - all the
 * state they need is contained by Invocation in
 * <Endpoint_Selection_State>.  Thus, rather than allocating an
 * endpoint selection strategy object for each Invocation, the
 * factory simply returns the appropriate one from the
 * set preallocated in the ORB_Core.  One endpoint selection
 * strategy object can be used by many invocations concurrently.
 */
class TAO_RTCORBA_Export RT_Endpoint_Selector_Factory
  : public TAO_Endpoint_Selector_Factory
{
public:
  /// Constructor.
  RT_Endpoint_Selector_Factory (void);

  /// Destructor.
  virtual ~RT_Endpoint_Selector_Factory (void);

  /// Get an Invocation's endpoint selection strategy and
  /// initialize the endpoint selection state instance.
  virtual TAO_Invocation_Endpoint_Selector *get_selector (
                             TAO_GIOP_Invocation *invocation,
                             CORBA::Environment &ACE_TRY_ENV);

protected:

  // = Helpers for <get_selector>.

  /// Initializes RTCORBA::ClientProtocolPolicy in the endpoint
  /// selection state.
  void init_client_protocol (TAO_GIOP_Invocation *invocation,
                             CORBA::Environment &ACE_TRY_ENV);

  /// Initializes RTCORBA::PriorityBandsPolicy in the endpoint
  /// selection state.
  //  void init_bands (TAO_GIOP_Invocation *invocation,
  //                 CORBA::Environment &ACE_TRY_ENV);

private:
  /// The possible endpoint selector strategies that can be
  /// returned by this factory

  TAO_Default_Endpoint_Selector *default_endpoint_selector_;
  TAO_Priority_Endpoint_Selector *priority_endpoint_selector_;
  TAO_Bands_Endpoint_Selector *bands_endpoint_selector_;
  TAO_Protocol_Endpoint_Selector *protocol_endpoint_selector_;
  TAO_Priority_Protocol_Selector *priority_protocol_selector_;
  TAO_Bands_Protocol_Selector *bands_protocol_selector_;
};

ACE_STATIC_SVC_DECLARE_EXPORT (TAO_RTCORBA, RT_Endpoint_Selector_Factory)
ACE_FACTORY_DECLARE (TAO_RTCORBA, RT_Endpoint_Selector_Factory)

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