Apache Ignite C++
cache_entry.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
23 #ifndef _IGNITE_CACHE_CACHE_ENTRY
24 #define _IGNITE_CACHE_CACHE_ENTRY
25 
26 #include <ignite/common/common.h>
27 
28 namespace ignite
29 {
30  namespace cache
31  {
38  template<typename K, typename V>
39  class CacheEntry
40  {
41  public:
48  key(), val()
49  {
50  // No-op.
51  }
52 
59  CacheEntry(const K& key, const V& val) :
60  key(key), val(val)
61  {
62  // No-op.
63  }
64 
70  CacheEntry(const CacheEntry& other) :
71  key(other.key), val(other.val)
72  {
73  // No-op.
74  }
75 
82  {
83  if (this != &other)
84  {
85  key = other.key;
86  val = other.val;
87  }
88 
89  return *this;
90  }
91 
97  K GetKey() const
98  {
99  return key;
100  }
101 
107  V GetValue() const
108  {
109  return val;
110  }
111 
112  private:
114  K key;
115 
117  V val;
118  };
119  }
120 }
121 
122 #endif //_IGNITE_CACHE_CACHE_ENTRY
K GetKey() const
Get key.
Definition: cache_entry.h:97
V GetValue() const
Get value.
Definition: cache_entry.h:107
CacheEntry(const CacheEntry &other)
Copy constructor.
Definition: cache_entry.h:70
Cache entry class template.
Definition: cache_entry.h:39
CacheEntry & operator=(const CacheEntry &other)
Assignment operator.
Definition: cache_entry.h:81
CacheEntry()
Default constructor.
Definition: cache_entry.h:47
Apache Ignite API.
Definition: cache.h:43
CacheEntry(const K &key, const V &val)
Constructor.
Definition: cache_entry.h:59