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

//=============================================================================
/**
 * @file PG_Object_Group_Manipulator.h
 *
 * $Id$
 *
 * @author Dale Wilson <wilson_d@ociweb.com>
 */
//=============================================================================


#ifndef TAO_PG_OBJECT_GROUP_MANIPULATOR_H
#define TAO_PG_OBJECT_GROUP_MANIPULATOR_H

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

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

#include "portablegroup_export.h"
#include "tao/IORManipulation/IORManip_Loader.h"

namespace TAO
{

  /**
   * @class TAO::PG_Object_Group_Manipulator
   *
   * @brief PortableGroup::ObjectGroupManager implementation.
   *
   * The ObjectGroupManager provides the interface necessary to
   * facilitate application-controlled object group membership.
   */
  class TAO_PortableGroup_Export PG_Object_Group_Manipulator
  {
  public:

    /// Constructor.
    PG_Object_Group_Manipulator ();

    /// Destructor.
    ~PG_Object_Group_Manipulator ();

    /**
     * Initializes the group creator.
     */
    void init (CORBA::ORB_ptr orb,
               PortableServer::POA_ptr poa
               ACE_ENV_ARG_DECL);

    /**
     * Create an empty object group.
     */
    PortableGroup::ObjectGroup_ptr create_object_group (
      const char * type_id,
      const char * domain_id,
      PortableGroup::ObjectGroupId & group_id
      ACE_ENV_ARG_DECL);

    PortableGroup::ObjectGroup_ptr remove_profiles (
      PortableGroup::ObjectGroup_ptr group,
      PortableGroup::ObjectGroup_ptr profile
      ACE_ENV_ARG_DECL) const;

    PortableGroup::ObjectGroup_ptr merge_iors (
      TAO_IOP::TAO_IOR_Manipulation::IORList & iors
      ACE_ENV_ARG_DECL) const;

    int set_primary (
      TAO_IOP::TAO_IOR_Property * prop,
      PortableGroup::ObjectGroup_ptr reference,
      CORBA::Object_ptr new_primary
      ACE_ENV_ARG_DECL) const;

  void dump_membership (const char * label,
                        PortableGroup::ObjectGroup_ptr member) const;

  private:

    /**
     * Allocate an ogid for a new object group
     */
    void allocate_ogid (PortableGroup::ObjectGroupId & ogid);

    /**
     * convert numeric OGID to Sequence<Octet> oid
     */
    PortableServer::ObjectId *
      convert_ogid_to_oid (PortableGroup::ObjectGroupId ogid) const;

  private:

    /// The orb
    CORBA::ORB_var orb_;

    /// Reference to the POA that created the object group references.
    PortableServer::POA_var poa_;

    /// The ORBs IORManipulation object
    TAO_IOP::TAO_IOR_Manipulation_var iorm_;

    /// Lock used to synchronize access to next_ogid_.
    TAO_SYNCH_MUTEX lock_ogid_;

    /// Next ogid to be allocated.
    PortableGroup::ObjectGroupId next_ogid_;

  };
} //namespace TAO


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

#endif  /* TAO::PG_OBJECT_GROUP_CREATOR_H */