summaryrefslogtreecommitdiff
path: root/TAO/tao/Utils/RIR_Narrow.h
blob: c8d425065327bbeeed994763e638dbe7293bf03f (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
/**
 * @file RIR_Narrow.h
 *
 * $Id$
 *
 * @author Carlos O'Ryan <coryan@atdesk.com>
 */
#ifndef RIR_Narrow__h_
#define RIR_Narrow__h_

#include <tao/ORB.h>
#include <tao/PortableInterceptorC.h>

namespace TAO
{
namespace Utils
{

/**
 * @class RIR_Narrow
 *
 * @brief Helper class to obtain an initial reference and narrow it
 *        to the proper object reference.
 */
template<class T> class RIR_Narrow
{
public:
  typedef typename T::_ptr_type _ptr_type;
  typedef typename T::_var_type _var_type;

  /// Use resolve_initial_references to find an object and then
  /// narrow it.
  static _ptr_type narrow (CORBA::ORB_ptr orb,
                           char const * id
                           ACE_ENV_ARG_DECL_WITH_DEFAULTS);
                           ACE_ENV_ARG_


  /// Use resolve_initial_references to find an object and then
  /// narrow it.
  static _ptr_type narrow (PortableInterceptor::ORBInitInfo_ptr orb,
                           char const * id
                           ACE_ENV_ARG_DECL_WITH_DEFAULTS);

private:
  static _ptr_type narrow_object (CORBA::Object_ptr object
                                  ACE_ENV_ARG_DECL_WITH_DEFAULTS);
};

} // namespace Utils
} // namespace TAO

#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
# include "RIR_Narrow.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */

#endif // RIR_Narrow__h_