C++ Client API Reference for Oracle Coherence
14c (14.1.2.0.0)

F79659-03

coherence/util/filter/KeyFilter.hpp

00001 /*
00002  * Copyright (c) 2000, 2020, Oracle and/or its affiliates.
00003  *
00004  * Licensed under the Universal Permissive License v 1.0 as shown at
00005  * http://oss.oracle.com/licenses/upl.
00006  */
00007 #ifndef COH_KEY_FILTER_HPP
00008 #define COH_KEY_FILTER_HPP
00009 
00010 #include "coherence/lang.ns"
00011 
00012 #include "coherence/util/Map.hpp"
00013 #include "coherence/util/Set.hpp"
00014 #include "coherence/util/filter/EntryFilter.hpp"
00015 #include "coherence/util/filter/IndexAwareFilter.hpp"
00016 
00017 COH_OPEN_NAMESPACE3(coherence,util,filter)
00018 
00019 
00020 /**
00021 * EntryFilter which checks whether an entry key belongs to a set.
00022 *
00023 * <b>Note: this filter is not serializable and intended to be used only
00024 * internally by other composite filters to reduce the remaining key set.</b>
00025 *
00026 * As of Coherence 3.2, an equivalent functionality could be achieved using the
00027 * InFilter as follows:
00028 * <pre>
00029 *   new InFilter(new KeyExtractor(IdentityExtractor.INSTANCE), setKeys);
00030 * </pre>
00031 *
00032 * @author djl  2008.04.14
00033 */
00034 class COH_EXPORT KeyFilter
00035     : public class_spec<KeyFilter,
00036         extends<Object>,
00037         implements<IndexAwareFilter> >
00038     {
00039     friend class factory<KeyFilter>;
00040 
00041     // ----- constructors ---------------------------------------------------
00042 
00043     protected:
00044         /**
00045         * Construct a key filter.
00046         *
00047         * @param vSetKeys  the keys that this filter will evaluate to true
00048         */
00049         KeyFilter(Set::View vSetKeys);
00050 
00051 
00052     // ----- EntryFilter interface ------------------------------------------
00053 
00054     public:
00055         /**
00056         * {@inheritDoc}
00057         */
00058         virtual bool evaluateEntry(Map::Entry::View vEntry) const;
00059 
00060 
00061     // ----- Filter interface -----------------------------------------------
00062 
00063     public:
00064         /**
00065         * {@inheritDoc}
00066         */
00067         virtual bool evaluate(Object::View v) const;
00068 
00069 
00070     // ----- IndexAwareFilter interface -------------------------------------
00071 
00072     public:
00073         /**
00074         * {@inheritDoc}
00075         */
00076         virtual size32_t calculateEffectiveness(Map::View vMapIndexes,
00077                 Set::View vSetKeys) const;
00078 
00079         /**
00080         * {@inheritDoc}
00081         */
00082         virtual Filter::View applyIndex(Map::View vMapIndexes,
00083                 Set::Handle hSetKeys) const;
00084 
00085 
00086     // ----- Object interface -----------------------------------------------
00087 
00088     public:
00089         /**
00090         * {@inheritDoc}
00091         */
00092         virtual TypedHandle<const String> toString() const;
00093 
00094 
00095     // ----- data member accessors ------------------------------------------
00096 
00097     public:
00098         /**
00099         * Get the set of keys that are evaluated to true by this filter.
00100         *
00101         * @return the set of keys
00102         */
00103         virtual Set::View getKeys() const;
00104 
00105 
00106     // ----- data members ---------------------------------------------------
00107 
00108     protected:
00109         /**
00110         * The keys that are evaluated to true by this filter.
00111         */
00112         FinalView<Set> f_vSetKeys;
00113     };
00114 
00115 COH_CLOSE_NAMESPACE3
00116 
00117 #endif // COH_KEY_FILTER_HPP
Copyright © 2000, 2025, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.