summaryrefslogtreecommitdiff
path: root/TAO/tao/Adapter_Registry.h
blob: bdca283d9a2f97215b54bebbf7ea6089e8f77936 (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
// -*- C++ -*-

//=============================================================================
/**
 *  @file    Adapter_Registry.h
 *
 *  @author Carlos O'Ryan (coryan@uci.edu)
 */
//=============================================================================

#ifndef TAO_ADAPTER_REGISTRY_H
#define TAO_ADAPTER_REGISTRY_H

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

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

#include "tao/CORBA_methods.h"

#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4250)
#endif /* _MSC_VER */

#include "tao/Pseudo_VarOut_T.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

namespace CORBA
{
  typedef TAO_Pseudo_Var_T<Object> Object_var;
  typedef TAO_Pseudo_Out_T<Object> Object_out;
}

namespace TAO
{
  class ObjectKey;
}

class TAO_ORB_Core;
class TAO_Stub;
class TAO_MProfile;
class TAO_ServerRequest;
class TAO_Adapter;

class TAO_Export TAO_Adapter_Registry
{
public:
  explicit TAO_Adapter_Registry (TAO_ORB_Core *);

  /// Close the
  ~TAO_Adapter_Registry ();

  /**
   * Close each of of the Adapters and then cleanup the Registry.
   * It is possible that an Adapter will reject a close() call if it
   * is invoked in an inappropriate context (think shutting down the
   * POA while performing an upcall).
   */
  void close (int wait_for_completion);

  /**
   * Verify if the close() call can be invoked in the current
   * context for *all* adapters.
   * Raise the right exception if not.
   */
  void check_close (int wait_for_completion);

  /// Insert a new adapter into the registry.
  void insert (TAO_Adapter *adapter);

  /**
   * Dispatch the request to all the adapters.
   * It tries the adapters ordered by priority, stopping when the
   * adapter returns a status different from DS_MISMATCHED_KEY
   */
  void dispatch (TAO::ObjectKey &key,
                 TAO_ServerRequest &request,
                 CORBA::Object_out forward_to);

  /// Create a collocated object using the given profile and stub.
  CORBA::Object_ptr create_collocated_object (TAO_Stub *, const TAO_MProfile &);

  /// Initialize a collocated object using the given stub and object
  /// pointer for lazily evaluated object references.
  CORBA::Long initialize_collocated_object (TAO_Stub *);

  /// Fetch the adapter named @a name
  TAO_Adapter *find_adapter (const char *name) const;

private:
  TAO_Adapter_Registry (const TAO_Adapter_Registry &) = delete;
  TAO_Adapter_Registry &operator= (const TAO_Adapter_Registry &) = delete;

  /**
   * @name A simple array of adapters.
   */
  //@{
  size_t adapters_capacity_;
  size_t adapters_count_;
  TAO_Adapter **adapters_;
  //@}
};

TAO_END_VERSIONED_NAMESPACE_DECL

#if defined(_MSC_VER)
#pragma warning(pop)
#endif /* _MSC_VER */

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

#endif /* TAO_ADAPTER_REGISTRY_H */