00001 /* 00002 * IndexAwareExtractor.hpp 00003 * 00004 * Copyright (c) 2000, 2013, 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_INDEX_AWARE_EXTRACTOR_HPP 00017 #define COH_INDEX_AWARE_EXTRACTOR_HPP 00018 00019 #include "coherence/lang.ns" 00020 00021 #include "coherence/util/Comparator.hpp" 00022 #include "coherence/util/Map.hpp" 00023 #include "coherence/util/MapIndex.hpp" 00024 #include "coherence/util/ValueExtractor.hpp" 00025 00026 COH_OPEN_NAMESPACE3(coherence,util,extractor) 00027 00028 00029 /** 00030 * IndexAwareExtractor is an extension to the ValueExtractor interface 00031 * that supports the creation and destruction of an MapIndex index. 00032 * Instances of this interface are intended to be used with the QueryMap's 00033 * addIndex and removeIndex API to support the creation of custom indexes. 00034 * 00035 * @author tb/lh 2010.08.31 00036 * @since Coherence 3.6 00037 */ 00038 class COH_EXPORT IndexAwareExtractor 00039 : public interface_spec<IndexAwareExtractor, 00040 implements<ValueExtractor> > 00041 { 00042 public: 00043 /** 00044 * Create an index and associate it with the corresponding extractor. 00045 * Important: it is a responsibility of this method's implementations 00046 * to place the necessary <ValueExtractor, MapIndex> entry into the 00047 * given map of indexes. 00048 * 00049 * @param fOrdered true iff the contents of the indexed information 00050 * should be ordered; false otherwise 00051 * @param vComparator the Comparator object which imposes an ordering 00052 * of entries in the index contents; or <tt>NULL</tt> 00053 * if the entries' values natural ordering should be 00054 * used 00055 * @param hMapIndex a Map of ValueExtractor to MapIndex to be updated with 00056 * the created index 00057 * 00058 * @return the created index; NULL if the index has not been created 00059 */ 00060 virtual MapIndex::Handle createIndex(bool fOrdered, 00061 Comparator::View vComparator, Map::Handle hMapIndex) const = 0; 00062 00063 /** 00064 * Destroy an existing index and remove it from the given map of indexes. 00065 * 00066 * @param hMapIndex a Map of ValueExtractor to MapIndex to be updated by 00067 * removing the index being destroyed 00068 * 00069 * @return the destroyed index; NULL if the index does not exist 00070 */ 00071 virtual MapIndex::Handle destroyIndex(Map::Handle hMapIndex) const = 0; 00072 }; 00073 00074 COH_CLOSE_NAMESPACE3 00075 00076 #endif // COH_INDEX_AWARE_EXTRACTOR_HPP