Hazelcast C++ Client
MapEntryView.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 ihsan demir on 29 Feb 2016.
18 
19 #ifndef HAZELCAST_CLIENT_ADAPTOR_ENTRYVIEW_H_
20 #define HAZELCAST_CLIENT_ADAPTOR_ENTRYVIEW_H_
21 
22 #include <memory>
23 
24 #include "hazelcast/client/map/DataEntryView.h"
25 #include "hazelcast/client/serialization/pimpl/SerializationService.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 {
37  template <typename K, typename V>
38  class MapEntryView {
39  public:
43  MapEntryView(std::auto_ptr<map::DataEntryView> v, serialization::pimpl::SerializationService &srv)
44  : dataView(v), serializationService(srv) {
45  }
46 
50  std::auto_ptr<K> getKey() const {
51  return serializationService.toObject<K>(dataView->getKey());
52  }
53 
57  std::auto_ptr<V> getValue() const {
58  return serializationService.toObject<V>(dataView->getValue());
59  }
60 
64  long getCost() const {
65  return dataView->getCost();
66  }
67 
71  long getCreationTime() const {
72  return dataView->getCreationTime();
73  }
74 
78  long getExpirationTime() const {
79  return dataView->getExpirationTime();
80  }
81 
85  long getHits() const {
86  return dataView->getHits();
87  }
88 
92  long getLastAccessTime() const {
93  return dataView->getLastAccessTime();
94  }
95 
99  long getLastStoredTime() const {
100  return dataView->getLastStoredTime();
101  }
102 
106  long getLastUpdateTime() const {
107  return dataView->getLastAccessTime();
108  }
109 
113  long getVersion() const {
114  return dataView->getVersion();
115  }
116 
117  private:
118  std::auto_ptr<map::DataEntryView> dataView;
119 
120  serialization::pimpl::SerializationService &serializationService;
121  };
122  }
123 }
124 
125 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
126 #pragma warning(pop)
127 #endif
128 
129 #endif //HAZELCAST_CLIENT_ADAPTOR_ENTRYVIEW_H_
130 
MapEntryView(std::auto_ptr< map::DataEntryView > v, serialization::pimpl::SerializationService &srv)
Constructor.
Definition: MapEntryView.h:43
long getLastStoredTime() const
Definition: MapEntryView.h:99
std::auto_ptr< V > getValue() const
Definition: MapEntryView.h:57
long getLastAccessTime() const
Definition: MapEntryView.h:92
long getExpirationTime() const
Definition: MapEntryView.h:78
long getCreationTime() const
Definition: MapEntryView.h:71
long getHits() const
Definition: MapEntryView.h:85
long getCost() const
Definition: MapEntryView.h:64
Definition: MapEntryView.h:32
std::auto_ptr< K > getKey() const
Definition: MapEntryView.h:50
long getVersion() const
Definition: MapEntryView.h:113
MapEntryView represents a readonly view of a map entry.
Definition: MapEntryView.h:38
long getLastUpdateTime() const
Definition: MapEntryView.h:106