summaryrefslogtreecommitdiff
path: root/TAO/CIAO/DAnCE/Config_Handlers/IDREF_Base.h
blob: 2a7d2cf2f0ebee476602832f88688e5174cd2ac3 (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
/** 
 * $Id$
 * @file IDREF_Base.h
 * @author Will Otte <wotte@dre.vanderbilt.edu>
 *
 * Defines the IDREF_Base class, which is an abstract class that serves
 * as a base for any config handler that must map IDREFS.  
 */

#ifndef CIAO_CONFIG_HANDLERS_IDREF_BASE_H
#define CIAO_CONFIG_HANDLERS_IDREF_BASE_H

#include /**/ "ace/pre.h"
#include "Config_Handlers_Export.h"
#include "ace/Hash_Map_Manager.h"
#include "ace/Null_Mutex.h"
#include "ace/SString.h"

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

namespace CIAO
{
  namespace Config_Handlers
  {
    
    /**
     * @class IDREF_Handler
     * @brief Base class for any handler that must process idrefs.
     *
     */
    class Config_Handlers_Export IDREF_Base
    {
    public:
      /// Bind an IDREF to an index
      bool
      bind_ref (ACE_CString& id, size_t index);
  
      /// Get the index associated with an IDREF
      bool
      find_ref (const ACE_CString& id, size_t& val);
      
      /// get the IDREF associated with an index
      bool
      find_ref (const size_t id, ACE_CString& val);
  
      /// Unbind all IDREFS
      bool
      unbind_refs (void);

      typedef ACE_Hash_Map_Manager<ACE_CString,
                                   size_t,
                                   ACE_Null_Mutex> IDREF_MAP;

          
      typedef ACE_Hash_Map_Manager<size_t,
                                   ACE_CString,
                                   ACE_Null_Mutex> POS_MAP;
    protected:
      /// The map used to store and look up the indexes of elements
      /// referenced by their IDREF.
      IDREF_MAP idref_map_;
      /// The map used to store and look up the IDREFS of elements
      /// referenced by their index.
      POS_MAP pos_map_;
    };
    
  }
  
}

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