summaryrefslogtreecommitdiff
path: root/TAO/tao/Key_Adapters.h
blob: 164c449fe6075f85e4c795aa69ce0c5ace08864f (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
/* -*- C++ -*- */
// $Id$

// ============================================================================
//
// = LIBRARY
//    TAO
//
// = FILENAME
//    Key_Adapters.h
//
// = AUTHOR
//    Irfan Pyarali
//
// ============================================================================

#ifndef TAO_KEY_ADAPTERS_H
#include "ace/pre.h"
#define TAO_KEY_ADAPTERS_H

#include "tao/corbafwd.h"
#include "ace/Map.h"
#include "tao/POAC.h"

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

////////////////////////////////////////////////////////////////////////////////

class TAO_Incremental_Key_Generator
{
  // = TITLE
  //     Defines a key generator.
  //
  // = DESCRIPTION
  //     This class is used in adapters of maps that do not produce keys.
public:

  TAO_Incremental_Key_Generator (void);

  int operator() (PortableServer::ObjectId &id);

protected:

  CORBA::ULong counter_;
};

////////////////////////////////////////////////////////////////////////////////

class TAO_Export TAO_ObjectId_Hash
{
  // = TITLE
  //     Hashing class for Object Ids.
  //
  // = DESCRIPTION
  //     Define the hash() method for Object Ids.
public:

  u_long operator () (const PortableServer::ObjectId &id) const;
  // Returns hash value.
};

////////////////////////////////////////////////////////////////////////////////

class TAO_Ignore_Original_Key_Adapter
{
  // = TITLE
  //     A key adapter (encode/decode) class.
  //
  // = DESCRIPTION
  //     Define the encoding and decoding methods for converting
  //     between Object Ids and active keys.  This class ignores the
  //     <original_key> passed to it.
public:

  int encode (const PortableServer::ObjectId &original_key,
              const ACE_Active_Map_Manager_Key &active_key,
              PortableServer::ObjectId &modified_key);

  int decode (const PortableServer::ObjectId &modified_key,
              ACE_Active_Map_Manager_Key &active_key);

  int decode (const PortableServer::ObjectId &modified_key,
              PortableServer::ObjectId &original_key);
};

////////////////////////////////////////////////////////////////////////////////

class TAO_Preserve_Original_Key_Adapter
{
  // = TITLE
  //     A key adapter (encode/decode) class.
  //
  // = DESCRIPTION
  //     Define the encoding and decoding methods for converting
  //     between Object Ids and active keys.  This class remembers the
  //     <original_key> passed to it.
public:

  int encode (const PortableServer::ObjectId &original_key,
              const ACE_Active_Map_Manager_Key &active_key,
              PortableServer::ObjectId &modified_key);

  int decode (const PortableServer::ObjectId &modified_key,
              ACE_Active_Map_Manager_Key &active_key);

  int decode (const PortableServer::ObjectId &modified_key,
              PortableServer::ObjectId &original_key);
};

////////////////////////////////////////////////////////////////////////////////

#if defined (__ACE_INLINE__)
# include "tao/Key_Adapters.i"
#endif /* __ACE_INLINE__ */

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