summaryrefslogtreecommitdiff
path: root/TAO/tao/IORTable/IOR_Table_Impl.h
blob: e6feaf6ea01ba3fbc25acfa28bd5c64e70f87fc7 (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
136
137
// -*- C++ -*-

//=============================================================================
/**
 *  @file IOR_Table_Impl.h
 *
 *  $Id$
 *
 *  @author Carlos O'Ryan (coryan@uci.edu)
 */
//=============================================================================


#ifndef TAO_IOR_TABLE_IMPL_H
#define TAO_IOR_TABLE_IMPL_H

#include /**/ "ace/pre.h"

#include "tao/IORTable/IORTable.h"

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

#include "ace/Hash_Map_Manager_T.h"
#include "ace/Null_Mutex.h"
#include "tao/LocalObject.h"
#include "ace/SString.h"
#include "tao/Objref_VarOut_T.h"

#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4250)
#endif /* _MSC_VER */

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

class TAO_IOR_Table_Impl;
typedef TAO_IOR_Table_Impl *TAO_IOR_Table_Impl_ptr;
typedef TAO_Objref_Var_T<TAO_IOR_Table_Impl> TAO_IOR_Table_Impl_var;
typedef TAO_Objref_Out_T<TAO_IOR_Table_Impl> TAO_IOR_Table_Impl_out;

class TAO_IOR_Table_Impl
  : public virtual IORTable::Table,
    public virtual TAO_Local_RefCounted_Object
{
public:
    static TAO_IOR_Table_Impl_ptr _nil (void)
    {
      return static_cast<TAO_IOR_Table_Impl_ptr> (0);
    }

  /// Constructor
  TAO_IOR_Table_Impl (void);

  /// Find the object, using the locator if it is not on the table.
  char *find (const char *object_key)
    ACE_THROW_SPEC ((
      CORBA::SystemException,
      IORTable::NotFound
    ));

    /**
     * @name The IORTable::Table methods
     *
     * Please check the IORTable.pidl file for details.
     */
    //@{
    virtual void bind (const char * object_key, const char * IOR)
      ACE_THROW_SPEC ((
        CORBA::SystemException,
        IORTable::AlreadyBound
      ));

    virtual void rebind (const char * object_key, const char * IOR)
      ACE_THROW_SPEC ((
        CORBA::SystemException
      ));

    virtual void unbind (const char * object_key)
      ACE_THROW_SPEC ((
        CORBA::SystemException,
        IORTable::NotFound
      ));

    virtual void set_locator (IORTable::Locator_ptr the_locator)
      ACE_THROW_SPEC ((
        CORBA::SystemException
      ));
    //@}

private:
  typedef ACE_Hash_Map_Manager_Ex<ACE_CString, ACE_CString, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> Map;

  /// The map
  Map map_;

  /// The locator
  IORTable::Locator_var locator_;

  /// Synchronization
  TAO_SYNCH_MUTEX lock_;
};

// Traits specializations.
namespace TAO
{
  template<>
  struct TAO_IORTable_Export Objref_Traits< TAO_IOR_Table_Impl>
  {
    static TAO_IOR_Table_Impl_ptr duplicate (
        TAO_IOR_Table_Impl_ptr
      );

    static void release (
        TAO_IOR_Table_Impl_ptr
      );

    static TAO_IOR_Table_Impl_ptr nil (void);

    static ::CORBA::Boolean marshal (
        const TAO_IOR_Table_Impl_ptr p,
        TAO_OutputCDR & cdr
      );
  };
}


TAO_END_VERSIONED_NAMESPACE_DECL

#if defined(_MSC_VER)
#pragma warning(pop)
#endif /* _MSC_VER */

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

#endif /* TAO_IOR_TABLE_IMPL */