blob: c489912d52797e216633306f8c0f918713f18815 (
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
|
// -*- C++ -*-
//=============================================================================
/**
* @file resolve_init.h
*
* $Id$
*
* @author Huang-Ming Huang <hh1@cse.wustl.edu>
*/
//=============================================================================
#ifndef RESOVLE_INIT_H
#define RESOVLE_INIT_H
#include "tao/Versioned_Namespace.h"
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
template<class T>
typename T::_ptr_type
resolve_init (CORBA::ORB_ptr orb,
const char *id ACE_ENV_ARG_DECL_WITH_DEFAULTS)
{
typename T::_var_type ref;
CORBA::Object_var obj;
ACE_TRY
{
CORBA::Object_var obj;
obj = orb->resolve_initial_references(id ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
ref = T::_narrow(obj.in() ACE_ENV_ARG_PARAMETER);
}
ACE_CATCHANY
{
ACE_ERROR((
LM_ERROR,
" (%P|%t) Unable to initialize %s.\n",
id
));
if (!CORBA::is_nil(obj.in()))
ACE_ERROR((
LM_ERROR,
" due to narrowing problem\n"
));
ACE_RE_THROW;
}
ACE_ENDTRY;
return ref._retn();
}
#ifdef TAO_Naming_Export
template<class T>
typename T::_ptr_type
resolve (CosNaming::NamingContext_ptr context,
const CosNaming::Name &id
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
{
CORBA::Object_var obj;
obj = context->resolve(id ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN(T::_nil());
ACE_ASSERT(!CORBA::is_nil(obj.in()));
typename T::_var_type ref = T::_narrow(obj.in() ACE_ENV_ARG_PARAMETER);
return ref._retn();
}
#endif
TAO_END_VERSIONED_NAMESPACE_DECL
#endif
|