Oracle® Fusion Middleware C++ API Reference for Oracle Coherence
12c (12.2.1.3.0)

E80355-01

coherence/net/cache/UnitCalculator.hpp

00001 /*
00002 * UnitCalculator.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_UNIT_CALCULATOR_HPP
00017 #define COH_UNIT_CALCULATOR_HPP
00018 
00019 #include "coherence/lang.ns"
00020 
00021 COH_OPEN_NAMESPACE3(coherence,net,cache)
00022 
00023 // ---- interface: UnitCalculator ---------------------------------------
00024 
00025 /**
00026 * A unit calculator is an object that can calculate the cost of
00027 * caching an object. Used with LocalCache.
00028 *
00029 * @author nsa 2008.06.23
00030 */
00031 class UnitCalculator
00032     : public interface_spec<UnitCalculator>
00033     {
00034     // ----- constants ------------------------------------------
00035 
00036     public:
00037         /**
00038         * The largest possible value of type size32_t.
00039         */
00040         static const size32_t npos = size32_t(-1);
00041 
00042     // ----- UnitCalculator interface ---------------------------
00043 
00044     public:
00045         /**
00046         * Calculate a cache cost for the specified cache entry key
00047         * and value.
00048         *
00049         * @param vKey     the cache key to evaluate for unit cost
00050         * @param vValue  the cache value to evaluate for unit cost
00051         *
00052         * @return an integer value 0 or greater, with a larger value
00053         *         signifying a higher cost
00054         */
00055         virtual size32_t calculateUnits(Object::View vKey,
00056                 Object::View vValue) const = 0;
00057     };
00058 
00059 COH_CLOSE_NAMESPACE3
00060 
00061 #endif // #define COH_UNIT_CALCULATOR_HPP
Copyright © 2000, 2017, Oracle and/or its affiliates. All rights reserved.