3 //=============================================================================
5 * @file GroupInfoPublisher.h
7 * @author Huang-Ming Huang <hh1@cse.wustl.edu>
9 //=============================================================================
11 #ifndef GROUPINFOPUBLISHER_H
12 #define GROUPINFOPUBLISHER_H
13 #include "ftrtec_export.h"
14 #include "orbsvcs/FtRtecEventChannelAdminC.h"
15 #include "tao/PortableServer/PortableServer.h"
16 #include "ace/Vector_T.h"
17 #include "ace/Singleton.h"
18 #include "ace/Synch.h"
21 #if !defined (ACE_LACKS_PRAGMA_ONCE)
23 #endif /* ACE_LACKS_PRAGMA_ONCE */
25 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
27 class TAO_FTEC_Become_Primary_Listener
;
29 class GroupInfoPublisherBase
32 typedef FtRtecEventChannelAdmin::EventChannelList BackupList
;
36 CORBA::Object_var iogr
;
37 FtRtecEventChannelAdmin::EventChannel_var successor
;
41 typedef std::unique_ptr
<Info
> Info_ptr
;
43 void subscribe(TAO_FTEC_Become_Primary_Listener
* listener
);
44 void set_naming_context(CosNaming::NamingContext_var naming_context
);
45 bool is_primary() const;
46 CORBA::Object_var
group_reference() const;
48 FtRtecEventChannelAdmin::EventChannel_var
successor() const;
50 const BackupList
& backups() const;
52 Info
* setup_info(const FTRT::ManagerInfoList
& info_list
,
54 CORBA::ULong object_group_ref_version
);
56 void update_info(Info_ptr
& info
);
58 const PortableServer::ObjectId
& object_id() const;
59 const CosNaming::Name
& name() const;
61 void object_id(const char* oid
);
62 void name(const char* nam
);
63 GroupInfoPublisherBase();
66 CosNaming::NamingContext_var naming_context_
;
67 typedef ACE_Vector
<TAO_FTEC_Become_Primary_Listener
*, 2> Subscribers
;
68 Subscribers subscribers_
;
69 PortableServer::ObjectId object_id_
;
70 CosNaming::Name name_
;
74 TAO_END_VERSIONED_NAMESPACE_DECL
76 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
78 TAO_FTRTEC_SINGLETON_DECLARE(ACE_Singleton
, GroupInfoPublisherBase
, TAO_SYNCH_MUTEX
)
79 typedef ACE_Singleton
<GroupInfoPublisherBase
, TAO_SYNCH_MUTEX
> GroupInfoPublisher
;
81 ACE_END_VERSIONED_NAMESPACE_DECL