GridGain C++ Client Library
cache_entry.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) GridGain Systems. All Rights Reserved.
3  * _________ _____ __________________ _____
4  * __ ____/___________(_)______ /__ ____/______ ____(_)_______
5  * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
6  * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
7  * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
8  */
9 
15 #ifndef _GRIDGAIN_CACHE_ENTRY
16 #define _GRIDGAIN_CACHE_ENTRY
17 
18 #include <ignite/common/common.h>
19 
20 namespace gridgain
21 {
22  namespace cache
23  {
27  template<typename K, typename V>
28  class IGNITE_IMPORT_EXPORT CacheEntry
29  {
30  public:
34  CacheEntry() : key(K()), val(V())
35  {
36  // No-op.
37  }
38 
45  CacheEntry(const K& key, const V& val) : key(key), val(val)
46  {
47  // No-op.
48  }
49 
55  CacheEntry(const CacheEntry& other)
56  {
57  key = other.key;
58  val = other.val;
59  }
60 
67  {
68  if (this != &other)
69  {
70  CacheEntry tmp(other);
71 
72  K& key0 = key;
73  V& val0 = val;
74 
75  key = tmp.key;
76  val = tmp.val;
77 
78  tmp.key = key0;
79  tmp.val = val0;
80  }
81 
82  return *this;
83  }
84 
90  K GetKey() const
91  {
92  return key;
93  }
94 
100  V GetValue() const
101  {
102  return val;
103  }
104 
105  private:
107  K key;
108 
110  V val;
111  };
112  }
113 }
114 
115 #endif
CacheEntry(const CacheEntry &other)
Copy constructor.
Definition: cache_entry.h:55
CacheEntry()
Default constructor.
Definition: cache_entry.h:34
CacheEntry(const K &key, const V &val)
Constructor.
Definition: cache_entry.h:45
CacheEntry & operator=(const CacheEntry &other)
Assignment operator.
Definition: cache_entry.h:66
V GetValue() const
Get value.
Definition: cache_entry.h:100
K GetKey() const
Get key.
Definition: cache_entry.h:90
Cache entry.
Definition: cache_entry.h:28
GridGain API.
Definition: cache.h:35