blob: 6e248e21debe93a40ac57e5bd955a85e8d2624b8 (
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
|
// -*- 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)
{
typename T::_var_type ref;
CORBA::Object_var obj;
try
{
CORBA::Object_var obj;
obj = orb->resolve_initial_references(id);
ref = T::_narrow(obj.in());
}
catch (const CORBA::Exception& ex)
{
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"
));
throw;
}
return ref._retn();
}
#ifdef TAO_Naming_Export
template<class T>
typename T::_ptr_type
resolve (CosNaming::NamingContext_ptr context,
const CosNaming::Name &id)
{
CORBA::Object_var obj;
obj = context->resolve(id);
ACE_ASSERT(!CORBA::is_nil(obj.in()));
typename T::_var_type ref = T::_narrow(obj.in());
return ref._retn();
}
#endif
TAO_END_VERSIONED_NAMESPACE_DECL
#endif
|