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
|
// -*- C++ -*-
//=============================================================================
/**
* @file Object_Ref_Table.h
*
* $Id$
*
* @author Ossama Othman <ossama@uci.edu>
*/
//=============================================================================
#ifndef TAO_OBJECT_REF_TABLE_H
#define TAO_OBJECT_REF_TABLE_H
#include "ace/pre.h"
#include "corbafwd.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Synch.h"
#include "ace/Hash_Map_Manager_T.h"
#include "ace/Functor.h"
/**
* @class TAO_Object_Ref_Table
*
* @brief Keep a table de-stringified object references registered
* with the ORB.
*
* The class is necessary to allow local objects to be accessible via
* the resolve_initial_references() mechanism. Since local object
* references cannot be stringified, they cannot be placed into the
* initial reference map that maps object key/name to stringified
* object reference. Hence, another table is needed.
*
* @note
* The stringified reference table is still needed since it is
* sometimes necessary to delay de-stringification of an IOR until it
* is needed. For example, "corbaname" may return different results
* on each use.
*/
class TAO_Export TAO_Object_Ref_Table
{
public:
/// Constructor
TAO_Object_Ref_Table (void);
/// Destructor
~TAO_Object_Ref_Table (void);
/// Register an object reference with the table, and map the given
/// ID to it.
void register_initial_reference (const char * id,
CORBA::Object_ptr obj,
CORBA::Environment &ACE_TRY_ENV);
/// Return the object reference associated with the given ID.
/// A duplicate is returned.
CORBA::Object_ptr resolve_initial_references (
const char * id,
CORBA::Environment &ACE_TRY_ENV);
private:
typedef ACE_Hash_Map_Manager_Ex<const char *, CORBA::Object_ptr, ACE_Hash<const char *>, ACE_Equal_To<const char *>, ACE_Null_Mutex> Table;
typedef Table::iterator Iterator;
/// The canonical ACE_Map methods.
//@{
Iterator begin (void);
Iterator end (void);
int bind (const char *orb_id, CORBA::Object_ptr obj);
CORBA::Object_ptr find (const char *orb_id); // Returns a duplicate.
int unbind (const char *orb_id);
//@}
private:
/// Prevent copying
ACE_UNIMPLEMENTED_FUNC (TAO_Object_Ref_Table (const TAO_Object_Ref_Table &))
ACE_UNIMPLEMENTED_FUNC (void operator= (const TAO_Object_Ref_Table &))
private:
/// The implementation.
Table table_;
};
#include "ace/post.h"
#endif /* TAO_OBJECT_REF_TABLE_H */
|