Hazelcast C++ Client
 All Classes Functions Variables Enumerations Pages
ItemEvent.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 6/21/13.
18 
19 
20 #ifndef HAZELCAST_ITEM_EVENT
21 #define HAZELCAST_ITEM_EVENT
22 
23 #include "hazelcast/client/Member.h"
24 
25 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
26 #pragma warning(push)
27 #pragma warning(disable: 4251) //for dll export
28 #endif
29 
30 namespace hazelcast {
31  namespace client {
35  class HAZELCAST_API ItemEventType {
36  public:
40  enum Type {
41  ADDED = 1, REMOVED = 2
42  };
43 
48 
52  ItemEventType();
53 
57  ItemEventType(Type value);
58 
62  operator int() const;
63 
67  void operator = (int i);
68 
69  };
70 
79  template <typename E>
80  class ItemEvent {
81  public:
85  ItemEvent(const std::string &name, ItemEventType eventType, const E &item, const Member &member)
86  : name(name)
87  , member(member)
88  , eventType(eventType)
89  , item(item) {
90 
91  };
92 
93 
97  const E &getItem() const {
98  return item;
99  };
100 
106  Member getMember() const {
107  return member;
108  };
109 
116  return eventType;
117  };
118 
124  std::string getName() const {
125  return name;
126  };
127 
128  private:
129  std::string name;
130  Member member;
131  ItemEventType eventType;
132  E item;
133 
134  };
135  }
136 }
137 
138 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
139 #pragma warning(pop)
140 #endif
141 
142 #endif //HAZELCAST_ITEM_EVENT
143 
Type of item event.
Definition: ItemEvent.h:35
std::string getName() const
Returns the name of the collection for this event.
Definition: ItemEvent.h:124
Member getMember() const
Returns the member fired this event.
Definition: ItemEvent.h:106
ItemEventType getEventType() const
Return the event type.
Definition: ItemEvent.h:115
Type value
type value.
Definition: ItemEvent.h:47
const E & getItem() const
Definition: ItemEvent.h:97
Type
Type enum.
Definition: ItemEvent.h:40
Cluster member class.
Definition: Member.h:44
ItemEvent.
Definition: ItemEvent.h:80
ItemEvent(const std::string &name, ItemEventType eventType, const E &item, const Member &member)
constructor
Definition: ItemEvent.h:85