Hazelcast C++ Client
 All Classes Functions Variables Enumerations Pages
Member.h
1 /*
2  * Copyright (c) 2008-2015, 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 
65  bool operator==(const Member &) const;
66 
72  bool isLiteMember() const;
73 
79  const Address &getAddress() const;
80 
86  const std::string &getUuid() const;
87 
88  const std::map<std::string, std::string> &getAttributes() const;
89 
98  const std::string *getAttribute(const std::string &key) const;
99 
106  bool lookupAttribute(const std::string &key) const;
107 
108  private:
109  void setAttribute(const std::string &key, const std::string &value);
110 
111  bool removeAttribute(const std::string &key);
112 
113  Address address;
114  std::string uuid;
115  bool liteMember;
116  std::map<std::string, std::string> attributes;
117  };
118 
119  std::ostream HAZELCAST_API &operator<<(std::ostream &stream, const Member &member);
120  }
121 }
122 
123 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
124 #pragma warning(pop)
125 #endif
126 
127 
128 #endif //HAZELCAST_MEMBER
129 
IP Address.
Definition: Address.h:34
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