Hazelcast C++ Client
Member.h
1 /*
2  * Copyright (c) 2008-2017, Hazelcast, Inc. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 //
17 // Created by sancar koyunlu on 5/29/13.
18 
19 
20 
21 #ifndef HAZELCAST_MEMBER
22 #define HAZELCAST_MEMBER
23 
24 #include <map>
25 #include "hazelcast/client/Address.h"
26 
27 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
28 #pragma warning(push)
29 #pragma warning(disable: 4251) //for dll export
30 #endif
31 
32 namespace hazelcast {
33  namespace client {
34  namespace connection {
35  class ClusterListenerThread;
36  }
37 
44  class HAZELCAST_API Member {
45  public:
46  friend class connection::ClusterListenerThread;
47 
53  PUT = 1,
54  REMOVE = 2
55  };
56 
57  Member();
58 
59  Member(const Address &address, const std::string &uuid, bool lite,
60  const std::map<std::string, std::string> &attr);
61 
62  Member(const Address &memberAddress);
63 
67  bool operator==(const Member &) const;
68 
74  bool isLiteMember() const;
75 
81  const Address &getAddress() const;
82 
88  const std::string &getUuid() const;
89 
90  const std::map<std::string, std::string> &getAttributes() const;
91 
100  const std::string *getAttribute(const std::string &key) const;
101 
108  bool lookupAttribute(const std::string &key) const;
109 
110  private:
111  void setAttribute(const std::string &key, const std::string &value);
112 
113  bool removeAttribute(const std::string &key);
114 
115  Address address;
116  std::string uuid;
117  bool liteMember;
118  std::map<std::string, std::string> attributes;
119  };
120 
121  std::ostream HAZELCAST_API &operator<<(std::ostream &out, const Member &member);
122  }
123 }
124 
125 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
126 #pragma warning(pop)
127 #endif
128 
129 
130 #endif //HAZELCAST_MEMBER
131 
IP Address.
Definition: Address.h:36
Cluster member class.
Definition: Member.h:44
MemberAttributeOperationType
PUT even type representing an addition of an attribute REMOVE event type representing a deletion of a...
Definition: Member.h:52
Definition: MapEntryView.h:32