Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

colcache.h

Go to the documentation of this file.
00001 /*
00002 *****************************************************************************************
00003 *   Copyright (C) 1997-1999, International Business Machines
00004 *   Corporation and others.  All Rights Reserved.
00005 *****************************************************************************************
00006 */
00007 //===============================================================================
00008 //
00009 // File colcache.h
00010 //
00011 // CollationCache implements a persistent in-memory cache for
00012 // TableCollationData objects.  The goal of CollationCache is to improve
00013 // the memory footprint of a process which may have multiple threads
00014 // loading up the same TableCollation object.  Performance improvement is
00015 // strictly a secondary goal.
00016 //
00017 // Created by: Alan Liu
00018 //
00019 // Modification History:
00020 //
00021 //  Date        Name        Description
00022 //  2/11/97     aliu        Creation.
00023 //  2/12/97     aliu        Modified to work with TableCollationData.
00024 //  8/18/97     helena      Added internal API documentation.
00025 //
00026 //===============================================================================
00027 
00028 #ifndef COLCACHE_H
00029 #define COLCACHE_H
00030 
00031 #include "hash.h"
00032 #include "unicode/unistr.h"
00033 
00034 class Hashtable;
00035 class TableCollationData;
00036 
00037 /* Tell the VC++ compiler not to warn about DLL interface */
00038 /*
00039 #ifdef _WIN32
00040 #pragma warning( disable : 4251 )
00041 #endif
00042 */
00043 
00044 //-------------------------------------------------------------------------------
00052 class CollationCache
00053 {
00054 public:
00058     CollationCache();
00059 
00063     inline ~CollationCache() {}
00064 
00077     void                Add(const UnicodeString& key, TableCollationData* adoptedData);
00078     TableCollationData* Find(const UnicodeString& key);
00079 
00080 private:
00081     Hashtable   fHashtable;
00082 };
00083 
00084 inline void CollationCache::Add(const UnicodeString& key, TableCollationData* adoptedValue) {
00085     UErrorCode status = U_ZERO_ERROR;
00086     fHashtable.put(key, adoptedValue, status);
00087 }
00088 
00089 inline TableCollationData* CollationCache::Find(const UnicodeString& keyString) {
00090     return (TableCollationData*) fHashtable.get(keyString);
00091 }
00092 
00093 #endif
00094 //eof

Generated at Tue Dec 5 17:55:25 2000 for ICU by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000