📄 hxcache2.h
字号:
/* ***** BEGIN LICENSE BLOCK ***** * Source last modified: $Id: hxcache2.h,v 1.3.8.3 2004/07/09 01:45:08 hubbe Exp $ * * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved. * * The contents of this file, and the files included with this file, * are subject to the current version of the RealNetworks Public * Source License (the "RPSL") available at * http://www.helixcommunity.org/content/rpsl unless you have licensed * the file under the current version of the RealNetworks Community * Source License (the "RCSL") available at * http://www.helixcommunity.org/content/rcsl, in which case the RCSL * will apply. You may also obtain the license terms directly from * RealNetworks. You may not use this file except in compliance with * the RPSL or, if you have a valid RCSL with RealNetworks applicable * to this file, the RCSL. Please see the applicable RPSL or RCSL for * the rights, obligations and limitations governing use of the * contents of the file. * * Alternatively, the contents of this file may be used under the * terms of the GNU General Public License Version 2 or later (the * "GPL") in which case the provisions of the GPL are applicable * instead of those above. If you wish to allow use of your version of * this file only under the terms of the GPL, and not to allow others * to use your version of this file under the terms of either the RPSL * or RCSL, indicate your decision by deleting the provisions above * and replace them with the notice and other provisions required by * the GPL. If you do not delete the provisions above, a recipient may * use your version of this file under the terms of any one of the * RPSL, the RCSL or the GPL. * * This file is part of the Helix DNA Technology. RealNetworks is the * developer of the Original Code and owns the copyrights in the * portions it created. * * This file, and the files included with this file, is distributed * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET * ENJOYMENT OR NON-INFRINGEMENT. * * Technology Compatibility Kit Test Suite(s) Location: * http://www.helixcommunity.org/content/tck * * Contributor(s): * * ***** END LICENSE BLOCK ***** */#ifndef _HXCACHE2_H_#define _HXCACHE2_H_/* * Forward declarations of some interfaces defined herein. */typedef _INTERFACE IHXCacheObject IHXCacheObject;typedef _INTERFACE IHXCacheObjectResponse IHXCacheObjectResponse;/**************************************************************************** * * Interface: * * IHXCache2 * * Purpose: * * IHXCache2 acts as a factory for IHXCacheObject objects. * * IID_IHXCache2: * * {00002E0E-0901-11d1-8B06-00A024406D59} * */DEFINE_GUID(IID_IHXCache2, 0x00002E0E, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59);#undef INTERFACE#define INTERFACE IHXCache2DECLARE_INTERFACE_(IHXCache2, IUnknown){ /* * IUnknown methods */ STDMETHOD(QueryInterface) (THIS_ REFIID riid, void** ppvObj) PURE; STDMETHOD_(ULONG32,AddRef) (THIS) PURE; STDMETHOD_(ULONG32,Release) (THIS) PURE; /* * IHXCache2 methods */ /************************************************************************ * Method: * * IHXCache2::CreateMemCacheObject * * Purpose: * * Creates an object which implements the IHXCacheObject interface. * This object uses ONLY the memory for caching. */ STDMETHOD(CreateMemCacheObject) (THIS_ IHXCacheObject** /*OUT*/ ppObject, IHXCommonClassFactory* /*IN*/ pClassFactory) PURE;#ifdef HELIX_FEATURE_FILECACHE // use the local file system for caching /************************************************************************ * Method: * * IHXCache2::CreateFileCacheObject * * Purpose: * * Creates an object which implements the IHXCacheObject interface. * This object *uses the local filesystem* in addition to the memory * for caching. */ STDMETHOD(CreateFileCacheObject) (THIS_ IHXCacheObject** /*OUT*/ ppObject, IHXCommonClassFactory* /*IN*/ pClassFactory, UINT32 /*IN*/ ulFileLength, char* /*IN*/ pFileName) PURE;#endif }; // IHXCache2 /**************************************************************************** * * Interface: * * IHXCacheObject * * Purpose: * * This interface defines methods that are implemented by a simple * cache object. The cache object has only one RESTRICTION and that * is the data should be added in a linear fashion. To be precise, * the starting offset of the currently being added block should be * exactly one more than the ending offset of the most previously * added block. Data can be read out in any order. * * * * IID_IHXCacheObject: * * {00002E10-0901-11d1-8B06-00A024406D59} * */DEFINE_GUID(IID_IHXCacheObject, 0x00002E10, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59);#undef INTERFACE#define INTERFACE IHXCacheObjectDECLARE_INTERFACE_(IHXCacheObject, IUnknown){ /* * IUnknown methods */ STDMETHOD(QueryInterface) (THIS_ REFIID riid, void** ppvObj) PURE; STDMETHOD_(ULONG32,AddRef) (THIS) PURE; STDMETHOD_(ULONG32,Release) (THIS) PURE; /* * IHXCacheObject methods */ /************************************************************************ * Method: * * IHXCacheObject::Init * * Purpose: * * Associates a cache object with the response object * it should notify of operation completeness. Also, sets the Capacity * and threshold of the cache object. The capacity determines how much * data the object can store before it needs to discard already present * data. Threshold determines when cached data is discarded. If the amount * of data which has been read out of the cache is > (STRICTLY GREATER) * than the threshold percentage of the total capacity (not the current * amount of data present in the cache), then exactly that much amount of * data is discarded so that the threshold condition is satisfied. Note that * 0 <= uThreshold < 100. */ STDMETHOD(Init) (THIS_ IHXCacheObjectResponse* /*IN*/ pCacheObjectResponse, UINT32 /*IN*/ ulCapacity, UINT32 /*IN*/ uThreshold) PURE; /************************************************************************ * Method: * * IHXCacheObject::GetThreshold * * Purpose: * * Obtain the threshold of the cache object. */ STDMETHOD_(UINT32, GetThreshold) (THIS) PURE; /************************************************************************ * Method: * * IHXCacheObject::ChangeThreshold * * Purpose: * * The object keeps caching data until it is full (exhausts its * capacity). Once it is full, it will overwite existing cached data * with new data ONLY if the percentage of cached data which has been * read from the cache using the ReadBlock() method is greater than a * given percentage of Capacity. This percentage is set by Init() * method. In case the threshold is exceeded, the oldest added data * (the data with the least offset ) will be discarded and the * amount of data discarded is so that the remaining cached data exactly * satisfies the threshold condidtion. * * For eg., this cache object is used in the HTTP/1.0 file system plugin for * mobile devices and in this case, the threshold was set to 70% * i.e., uNewThreshold = 70 * */ STDMETHOD(ChangeThreshold) (THIS_ UINT32 /*IN*/ uNewThreshold) PURE; /************************************************************************ * Method: * * IHXCacheObject::GetCapacity * * Purpose: * * Obtain the capacity in bytes of the cache object. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -