Hazelcast C++ Client
ItemEvent.h
1 /*
2  * Copyright (c) 2008-2019, 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 
71  class HAZELCAST_API ItemEventBase {
72  public:
73  ItemEventBase(const std::string &name, const Member &member, const ItemEventType &eventType);
74 
75  virtual ~ItemEventBase();
76 
82  Member getMember() const;
83 
89  ItemEventType getEventType() const;
90 
96  std::string getName() const;
97 
98  private:
99  std::string name;
100  Member member;
101  ItemEventType eventType;
102  };
103 
112  template <typename E>
113  class ItemEvent : public ItemEventBase {
114  public:
118  ItemEvent(const std::string &name, ItemEventType eventType, const E &item, const Member &member)
119  : ItemEventBase(name, member, eventType)
120  , item(item) {
121  };
122 
126  const E &getItem() const {
127  return item;
128  };
129 
130  private:
131  E item;
132  };
133  }
134 }
135 
136 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
137 #pragma warning(pop)
138 #endif
139 
140 #endif //HAZELCAST_ITEM_EVENT
141 
Definition: ItemEvent.h:71
Type of item event.
Definition: ItemEvent.h:35
const E & getItem() const
Definition: ItemEvent.h:126
Type value
type value.
Definition: ItemEvent.h:47
Type
Type enum.
Definition: ItemEvent.h:40
Cluster member class.
Definition: Member.h:43
PN (Positive-Negative) CRDT counter.
Definition: MapEntryView.h:32
Definition: ItemEvent.h:113
ItemEvent(const std::string &name, ItemEventType eventType, const E &item, const Member &member)
constructor
Definition: ItemEvent.h:118