00001 /* 00002 * CacheEventFilter.hpp 00003 * 00004 * Copyright (c) 2000, 2017, 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_CACHE_EVENT_FILTER_HPP 00017 #define COH_CACHE_EVENT_FILTER_HPP 00018 00019 #include "coherence/lang.ns" 00020 00021 #include "coherence/io/pof/PofReader.hpp" 00022 #include "coherence/io/pof/PofWriter.hpp" 00023 #include "coherence/io/pof/PortableObject.hpp" 00024 00025 #include "coherence/util/filter/MapEventFilter.hpp" 00026 00027 COH_OPEN_NAMESPACE3(coherence,util,filter) 00028 00029 using coherence::io::pof::PofReader; 00030 using coherence::io::pof::PofWriter; 00031 using coherence::io::pof::PortableObject; 00032 00033 00034 /** 00035 * An extension of the MapEventFilter which allows selection of client 00036 * driven (natural) events, cache internal (synthetic) events, or both. 00037 * 00038 * @author rhl 2013.04.10 00039 */ 00040 class COH_EXPORT CacheEventFilter 00041 : public class_spec<CacheEventFilter, 00042 extends<MapEventFilter> > 00043 { 00044 friend class factory<CacheEventFilter>; 00045 00046 // ----- constructors --------------------------------------------------- 00047 00048 protected: 00049 /** 00050 * Default constructor (necessary for the PortableObject interface). 00051 */ 00052 CacheEventFilter(); 00053 00054 /** 00055 * Construct a CacheEventFilter that evaluates MapEvent objects based on the 00056 * specified combination of event types. 00057 * 00058 * @param vFilter the filter passed previously to a keySet() query method 00059 * @param nMaskSynthetic any combination of e_synthetic and e_natural 00060 */ 00061 CacheEventFilter(int32_t nMask, int32_t nMaskSynthetic); 00062 00063 /** 00064 * Construct a CacheEventFilter that evaluates MapEvent objects that would 00065 * affect the results of a keySet filter issued by a previous call to 00066 * coherence::util::QueryMap::keySet(coherence::util::Filter::View). 00067 * It is possible to easily implement <i>continuous query</i> functionality. 00068 * <p> 00069 * Using this constructor is equivalent to: 00070 * <tt> 00071 * CacheEventFilter::create(e_keyset, vFilter, nMaskSynthetic); 00072 * </tt> 00073 * 00074 * @param vFilter the filter passed previously to a keySet() query method 00075 * @param nMaskSynthetic any combination of e_synthetic and e_natural 00076 */ 00077 CacheEventFilter(Filter::View vFilter, int32_t nMaskSynthetic); 00078 00079 /** 00080 * Construct a CacheEventFilter that evaluates MapEvent objects based on the 00081 * specified combination of event types. 00082 * 00083 * @param nMask any combination of e_inserted, e_updated, e_deleted, 00084 * e_updated_entered, e_updated_within, and e_updated_left 00085 * @param vFilter the filter passed previously to a keySet() query method 00086 * @param nMaskSynthetic any combination of e_synthetic and e_natural 00087 */ 00088 CacheEventFilter(int32_t nMask, Filter::View vFilter, int32_t nMaskSynthetic); 00089 00090 private: 00091 /** 00092 * Blocked copy constructor. 00093 */ 00094 CacheEventFilter(const CacheEventFilter&); 00095 00096 00097 // ----- Filter interface ----------------------------------------------- 00098 00099 public: 00100 /** 00101 * {@inheritDoc} 00102 */ 00103 virtual bool evaluate(Object::View v) const; 00104 00105 00106 // ----- PortableObject interface --------------------------------------- 00107 00108 public: 00109 /** 00110 * {@inheritDoc} 00111 */ 00112 virtual void readExternal(PofReader::Handle hIn); 00113 00114 /** 00115 * {@inheritDoc} 00116 */ 00117 virtual void writeExternal(PofWriter::Handle hOut) const; 00118 00119 00120 // ----- Object interface ----------------------------------------------- 00121 00122 public: 00123 /** 00124 * {@inheritDoc} 00125 */ 00126 virtual bool equals(Object::View v) const; 00127 00128 /** 00129 * {@inheritDoc} 00130 */ 00131 virtual size32_t hashCode() const; 00132 00133 00134 // ----- Describable interface ------------------------------------------ 00135 00136 public: 00137 /** 00138 * {@inheritDoc} 00139 */ 00140 virtual String::View getDescription() const; 00141 00142 00143 // ----- constants ------------------------------------------------------ 00144 00145 public: 00146 /** 00147 * Bitmask to select synthetic events. 00148 */ 00149 static const int32_t e_synthetic = 0x1; 00150 00151 /** 00152 * Bitmask to select natural events. 00153 */ 00154 static const int32_t e_natural = 0x2; 00155 00156 00157 // ----- data members --------------------------------------------------- 00158 00159 protected: 00160 /** 00161 * Bitmask that selects whether to include synthetic, natural, or all events. 00162 */ 00163 int32_t m_nMaskSynthetic; 00164 }; 00165 00166 COH_CLOSE_NAMESPACE3 00167 00168 #endif // COH_CACHE_EVENT_FILTER_HPP