Oracle Coherence for C++ API
Release 3.6.0.0
E15728-01

- Main Page
- Namespaces
- Classes
- Files

# coherence/util/filter/KeyFilter.hpp

    00001 /*
    00002 * KeyFilter.hpp
    00003 *
    00004 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    00005 *
    00006 * Oracle is a registered trademarks of Oracle Corporation and/or its
    00007 * affiliates.
    00008 *
    00009 * This software is the confidential and proprietary information of Oracle
    00010 * Corporation. You shall not disclose such confidential and proprietary
    00011 * information and shall use it only in accordance with the terms of the
    00012 * license agreement you entered into with Oracle.
    00013 *
    00014 * This notice may not be removed or altered.
    00015 */
    00016 #ifndef COH_KEY_FILTER_HPP
    00017 #define COH_KEY_FILTER_HPP
    00018
    00019 #include "coherence/lang.ns"
    00020
    00021 #include "coherence/util/Map.hpp"
    00022 #include "coherence/util/Set.hpp"
    00023 #include "coherence/util/filter/EntryFilter.hpp"
    00024 #include "coherence/util/filter/IndexAwareFilter.hpp"
    00025
    00026 COH_OPEN_NAMESPACE3(coherence,util,filter)
    00027
    00028
    00029 /**
    00030 * EntryFilter which checks whether an entry key belongs to a set.
    00031 *
    00032 * <b>Note: this filter is not serializable and intended to be used only
    00033 * internally by other composite filters to reduce the remaining key set.</b>
    00034 *
    00035 * As of Coherence 3.2, an equivalent functionality could be achieved using the
    00036 * InFilter as follows:
    00037 * <pre>
    00038 *   new InFilter(new KeyExtractor(IdentityExtractor.INSTANCE), setKeys);
    00039 * </pre>
    00040 *
    00041 * @author djl  2008.04.14
    00042 */
    00043 class COH_EXPORT KeyFilter
    00044     : public class_spec<KeyFilter,
    00045         extends<Object>,
    00046         implements<IndexAwareFilter> >
    00047     {
    00048     friend class factory<KeyFilter>;
    00049
    00050     // ----- constructors ---------------------------------------------------
    00051
    00052     protected:
    00053         /**
    00054         * Construct a key filter.
    00055         *
    00056         * @param vSetKeys  the keys that this filter will evaluate to true
    00057         */
    00058         KeyFilter(Set::View vSetKeys);
    00059
    00060
    00061     // ----- EntryFilter interface ------------------------------------------
    00062
    00063     public:
    00064         /**
    00065         * {@inheritDoc}
    00066         */
    00067         virtual bool evaluateEntry(Map::Entry::View vEntry) const;
    00068
    00069
    00070     // ----- Filter interface -----------------------------------------------
    00071
    00072     public:
    00073         /**
    00074         * {@inheritDoc}
    00075         */
    00076         virtual bool evaluate(Object::View v) const;
    00077
    00078
    00079     // ----- IndexAwareFilter interface -------------------------------------
    00080
    00081     public:
    00082         /**
    00083         * {@inheritDoc}
    00084         */
    00085         virtual size32_t calculateEffectiveness(Map::View vMapIndexes,
    00086                 Set::View vSetKeys) const;
    00087
    00088         /**
    00089         * {@inheritDoc}
    00090         */
    00091         virtual Filter::View applyIndex(Map::View vMapIndexes,
    00092                 Set::Handle hSetKeys) const;
    00093
    00094
    00095     // ----- Object interface -----------------------------------------------
    00096
    00097     public:
    00098         /**
    00099         * {@inheritDoc}
    00100         */
    00101         virtual void toStream(std::ostream& out) const;
    00102
    00103
    00104     // ----- data member accessors ------------------------------------------
    00105
    00106     public:
    00107         /**
    00108         * Get the set of keys that are evaluated to true by this filter.
    00109         *
    00110         * @return the set of keys
    00111         */
    00112         virtual Set::View getKeys() const;
    00113
    00114
    00115     // ----- data members ---------------------------------------------------
    00116
    00117     protected:
    00118         /**
    00119         * The keys that are evaluated to true by this filter.
    00120         */
    00121         MemberView<Set> m_vSetKeys;
    00122     };
    00123
    00124 COH_CLOSE_NAMESPACE3
    00125
    00126 #endif // COH_KEY_FILTER_HPP

Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.