summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/LB_ObjectGroup_Map.h
blob: 3de656e078883ddff42be6ff0e0273c6d5ac52ba (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
// -*- C++ -*-

//=======================================================================
/**
 *  @file     LB_ObjectGroup_Map.h
 *
 *  $Id$
 *
 *  @author  Ossama Othman <ossama@uci.edu>
 */
//=======================================================================


#ifndef TAO_LB_OBJECTGROUP_MAP_H
#define TAO_LB_OBJECTGROUP_MAP_H

#include "ace/pre.h"

#include "ace/config-all.h"

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

#include "ace/Hash_Map_Manager_T.h"
#include "orbsvcs/LoadBalancingC.h"

#include "LB_Replica_Set.h"


/**
 * @class TAO_LB_ObjectGroup_Map
 *
 * @brief Map of FactoryCreationId to ObjectGroup reference.
 *
 * Implementation to be used by the Load Balancer ReplicationManager.
 */
class TAO_LB_ObjectGroup_Map
{

public:

  /**
   * @class Map_Entry
   *
   * @brief Value field of the replica map.
   *
   * Mapping from and to all of the following fields:
   * @param object_group, @param factory_creation_id, @param factory,
   * and @param factory_creation_id.  Therefore, we keep all the
   * fields together in the map.
   */
  struct Map_Entry
  {
    /// The RepositoryId corresponding to all Replicas in the
    /// ObjectGroup.
    CORBA::String_var type_id;

    /// Reference to the ObjectGroup.
    TAO_LoadBalancing::ObjectGroup_var object_group;

    /// Unbounded set containing replica references and all related
    /// information for each replica.
    TAO_LB_ReplicaInfo_Set replica_infos;
  };

  /// FactoryCreationId hash map.  A FactoryCreationId is represented
  /// internally as a CORBA::ULong.
  typedef ACE_Hash_Map_Manager_Ex<
    ACE_UINT32,
    Map_Entry *,
    ACE_Hash<ACE_UINT32>,
    ACE_Equal_To<ACE_UINT32>,
    TAO_SYNCH_MUTEX> Table;

  int bind (CORBA::ULong factory_creation_id,
            TAO_LB_ObjectGroup_Map::Map_Entry *object_group_entry);


};

#include "ace/post.h"

#endif  /* TAO_LB_OBJECTGROUP_MAP_H */