summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Naming/Entries.h
blob: 68cfe397c9a12b84acb6a8f05402d3213ff8ada3 (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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/* -*- C++ -*- */

//=============================================================================
/**
 *  @file   Entries.h
 *
 *  $Id$
 *
 *  @author Marina Spivak <marina@cs.wustl.edu>
 */
//=============================================================================


#ifndef TAO_ENTRIES_H
#define TAO_ENTRIES_H
#include /**/ "ace/pre.h"

#include "ace/Hash_Map_Manager.h"

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

#include "ace/SString.h"

#include "orbsvcs/orbsvcs/CosNamingC.h"
#include "naming_export.h"

/**
 * @class TAO_IntId
 *
 * @brief Helper class for TAO_Transient_Bindings_Map: unifies several
 * data items, so they can be stored together as a  <value>
 * for a <key> in a hash table holding the state of a Transient
 * Naming Context.
 *
 * This class holds CORBA Object pointer and a binding type, so
 * they can be stored together as a <value> for a <key> in a
 * hash table holding the state of a Transient Naming Context.
 */
class TAO_Naming_Export TAO_IntId
{
public:
  // = Initialization and termination methods.
  /// Constructor.
  TAO_IntId (void);

  /// Constructor.
  TAO_IntId (CORBA::Object_ptr obj,
            CosNaming::BindingType type /* = CosNaming::nobject */);

  /// Copy constructor.
  TAO_IntId (const TAO_IntId & rhs);

  /// Destructor.
  ~TAO_IntId (void);

  /// Assignment operator (does copy memory).
  void operator= (const TAO_IntId & rhs);

  // = Data members.

  /// Object reference to be stored in a Transient Naming Context.
  CORBA::Object_ptr ref_;

  /// Binding type for <ref_>.
  CosNaming::BindingType type_;
};

/**
 * @class TAO_ExtId
 *
 * @brief Helper class for TAO_Transient_Bindings_Map: unifies several
 * data items, so they can be stored together as a  <key>
 * for a <value> in a hash table holding the state of a Transient
 * Naming Context.
 *
 * This class holds id and kind strings, so
 * they can be stored together as a <key> for a <value> in a
 * hash table holding the state of a Transient Naming Context.
 */
class TAO_Naming_Export TAO_ExtId
{
public:
  // = Initialization and termination methods.

  /// Constructor.
  TAO_ExtId (void);

  /// Constructor.
  TAO_ExtId (const char *id,
            const char *kind);

  /// Copy constructor.
  TAO_ExtId (const TAO_ExtId & rhs);

  /// Destructor.
  ~TAO_ExtId (void);

  // = Assignment and comparison operators.

  /// Assignment operator (does copy memory).
  void operator= (const TAO_ExtId & rhs);

  /// Equality comparison operator (must match both id_ and kind_).
  bool operator== (const TAO_ExtId &rhs) const;

  /// Inequality comparison operator.
  bool operator!= (const TAO_ExtId &rhs) const;

  /// <hash> function is required in order for this class to be usable by
  /// ACE_Hash_Map_Manager.
  u_long hash (void) const;

  // = Data members.

  /// <kind> portion of the name to be associated with some object
  /// reference in a Transient Naming Context.
  ACE_CString kind_;

  /// <id> portion of the name to be associated with some object
  /// reference in a Transient Naming Context.
  ACE_CString id_;

  // = Accessors

  /// Return <id_> in a const char * format.
  const char * id (void);

  /// Return <kind_> in a const char * format.
  const char * kind (void);
};

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