MembershipInfo.h
Go to the documentation of this file.
00001 /* 00002 * 00003 * Copyright 2006 Savarese Software Research Corporation 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.savarese.com/software/ApacheLicense-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00023 #ifndef __SSRC_SPREAD_MEMBERSHIP_INFO_H 00024 #define __SSRC_SPREAD_MEMBERSHIP_INFO_H 00025 00026 #include <ssrc/spread/BaseMessage.h> 00027 00028 __BEGIN_NS_SSRC_SPREAD 00029 00030 #ifdef LIBSSRCSPREAD_ENABLE_MEMBERSHIP_INFO 00031 00041 class MembershipInfo { 00042 friend void BaseMessage::get_membership_info(MembershipInfo & info) const; 00043 00044 BaseMessage::service_type _service_type; 00045 Spread::membership_info _info; 00046 GroupList _local_members, _non_local_members; 00047 00048 void set_service(const BaseMessage::service_type service) { 00049 _service_type = service; 00050 } 00051 00052 public: 00053 00058 BaseMessage::service_type service() const { 00059 return _service_type; 00060 } 00061 00074 void get_local_members(GroupList & members) const { 00075 members = _local_members; 00076 } 00086 void get_non_local_members(GroupList & members) const { 00087 members = _non_local_members; 00088 } 00089 00102 void get_all_members(GroupList & members) const { 00103 members.clear(); 00104 members.add(_local_members); 00105 members.add(_non_local_members); 00106 } 00107 00114 bool equal_group_ids(const MembershipInfo & info) const { 00115 return (Spread::SP_equal_group_ids(_info.gid, info._info.gid) != 0); 00116 } 00117 00125 string changed_member() const { 00126 return _info.changed_member; 00127 } 00128 00133 bool is_regular_membership() const { 00134 return Is_reg_memb_mess(service()); 00135 } 00136 00143 bool is_transition() const { 00144 return Is_transition_mess(service()); 00145 } 00146 00153 bool is_self_leave() const { 00154 return Is_self_leave(service()); 00155 } 00156 00163 bool caused_by_join() const { 00164 return Is_caused_join_mess(service()); 00165 } 00166 00173 bool caused_by_leave() const { 00174 return Is_caused_leave_mess(service()); 00175 } 00176 00183 bool caused_by_disconnect() const { 00184 return Is_caused_disconnect_mess(service()); 00185 } 00186 00193 bool caused_by_network() const { 00194 return Is_caused_network_mess(service()); 00195 } 00196 }; 00197 00198 #endif 00199 00200 __END_NS_SSRC_SPREAD 00201 00202 #endif
Copyright © 2006-2011 Savarese Software Research Corporation. All rights reserved.
Copyright © 2011 Savarese Software Research Corporation. All rights reserved