Hazelcast C++ Client
 All Classes Functions Variables Enumerations Enumerator Pages
EvictionPolicyEvaluator.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 #ifndef HAZELCAST_CLIENT_INTERNAL_EVICTION_EVICTIONPOLICYEVALUATOR_H_
17 #define HAZELCAST_CLIENT_INTERNAL_EVICTION_EVICTIONPOLICYEVALUATOR_H_
18 
19 #include <assert.h>
20 #include <vector>
21 #include <boost/shared_ptr.hpp>
22 
23 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
24 #pragma warning(push)
25 #pragma warning(disable: 4251) //for dll export
26 #endif
27 
28 namespace hazelcast {
29  namespace client {
30  namespace internal {
31  namespace eviction {
32  template<typename K, typename V>
33  class EvictionPolicyComparator;
34 
35  template <typename MAPKEY, typename MAPVALUE, typename A, typename E>
36  class EvictionCandidate;
37 
45  template<typename MAPKEY, typename MAPVALUE, typename A, typename E>
47  public:
48  virtual ~EvictionPolicyEvaluator() {
49  }
50 
56  virtual const boost::shared_ptr<EvictionPolicyComparator<MAPKEY, MAPVALUE> > getEvictionPolicyComparator() const {
57  assert(0);
58  return boost::shared_ptr<EvictionPolicyComparator<MAPKEY, MAPVALUE> >();
59  }
60 
71  virtual std::auto_ptr<std::vector<boost::shared_ptr<eviction::EvictionCandidate<MAPKEY, MAPVALUE, A, E> > > > evaluate(
72  util::Iterable<EvictionCandidate<MAPKEY, MAPVALUE, A, E> > &evictionCandidates) const {
73  assert(0);
74  return std::auto_ptr<std::vector<boost::shared_ptr<eviction::EvictionCandidate<MAPKEY, MAPVALUE, A, E> > > >();
75  };
76  };
77  }
78  }
79  }
80 };
81 
82 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
83 #pragma warning(pop)
84 #endif
85 
86 #endif /* HAZELCAST_CLIENT_INTERNAL_EVICTION_EVICTIONPOLICYEVALUATOR_H_ */
Interface for evaluation implementations of com.hazelcast.config.EvictionPolicy.
Definition: EvictionPolicyEvaluator.h:46
virtual std::auto_ptr< std::vector< boost::shared_ptr< eviction::EvictionCandidate< MAPKEY, MAPVALUE, A, E > > > > evaluate(util::Iterable< EvictionCandidate< MAPKEY, MAPVALUE, A, E > > &evictionCandidates) const
The evaluate method implements the actual policy rules and is called on every eviction to select one ...
Definition: EvictionPolicyEvaluator.h:71
Interface for entries, records or whatever that can be evictable via its accessor (key or id)...
Definition: EvictableStore.h:33
virtual const boost::shared_ptr< EvictionPolicyComparator< MAPKEY, MAPVALUE > > getEvictionPolicyComparator() const
Gets the underlying EvictionPolicyComparator.
Definition: EvictionPolicyEvaluator.h:56