VR-Link API Documentation for DIS
vlHashKeys.h
Go to the documentation of this file.
00001 /*********************************************************************
00002 ** Copyright (c) 1992-2010 VT MAK
00003 ** All rights reserved.
00004 *********************************************************************/
00008 #pragma once
00009 
00010 #include "vlMachineTypes.h"
00011 #include "vlString.h"
00012 #include <string>
00013 
00014 #ifdef DtUSE_UTILITIES_NAMESPACE
00015 namespace DtUSE_UTILITIES_NAMESPACE
00016 {
00017 #endif
00018 
00023 class DT_DLL_VLUTIL DtBaseHashKey
00024 {
00025 public:
00026 
00028    DtBaseHashKey();
00029 
00031    virtual ~DtBaseHashKey();
00032 
00034    DtBaseHashKey(const DtBaseHashKey& orig);
00035 
00037    DtBaseHashKey& operator=(const DtBaseHashKey& orig);
00038 
00040    virtual bool operator==(const DtBaseHashKey& other) const;
00041 
00043    virtual bool operator!=(const DtBaseHashKey& other) const;
00044 
00047    virtual DtU32 hashValue() const;
00048 
00050    virtual DtBaseHashKey* clone() const = 0;
00051 
00053    virtual const DtString stringRep() const = 0;
00054 
00058    virtual bool equalTo(const DtBaseHashKey& otherKey) const;
00059 
00060 protected:
00061 
00063    virtual DtU32 computeHashValue() = 0;
00064 
00065 
00066 protected:
00067 
00069    mutable bool myHashValueIsComputed;
00070 
00072    mutable DtU32 myHashValue;
00073 };
00074 
00075 
00080 class DT_DLL_VLUTIL DtIntHashKey : public DtBaseHashKey
00081 {
00082 public:
00083 
00085    DtIntHashKey(DtU32 num);
00086 
00088    virtual ~DtIntHashKey();
00089 
00091    DtIntHashKey(const DtIntHashKey& orig);
00092 
00094    DtIntHashKey& operator=(const DtIntHashKey& orig);
00095 
00097    virtual DtBaseHashKey* clone() const;
00098 
00100    virtual DtU32 value() const;
00101 
00103    virtual const DtString stringRep() const;
00104 
00107    virtual bool equalTo(const DtBaseHashKey& otherKey) const;
00108 
00109 protected:
00110 
00112    virtual DtU32 computeHashValue();
00113 
00114 protected:
00115 
00116    DtU32 myNum;
00117 };
00118 
00119 
00130 class DT_DLL_VLUTIL DtPtrHashKey : public DtBaseHashKey
00131 {
00132 public:
00133 
00135    DtPtrHashKey(void *ptr);
00136 
00138    virtual ~DtPtrHashKey();
00139 
00141    DtPtrHashKey(const DtPtrHashKey& orig);
00142 
00144    DtPtrHashKey& operator=(const DtPtrHashKey& orig);
00145 
00147    virtual DtBaseHashKey* clone() const;
00148 
00150    virtual void *value() const;
00151 
00153    virtual const DtString stringRep() const;
00154 
00157    virtual bool equalTo(const DtBaseHashKey& otherKey) const;
00158 
00159 protected:
00160 
00162    virtual DtU32 computeHashValue();
00163 
00164 protected:
00165 
00166    void *myPtr;
00167 };
00168 
00173 class DT_DLL_VLUTIL DtStringHashKey : public DtBaseHashKey
00174 {
00175 public:
00176 
00178    DtStringHashKey();
00179 
00181    DtStringHashKey(const DtString& str);
00182 
00184    DtStringHashKey(const char* str);
00185 
00187    virtual ~DtStringHashKey();
00188 
00190    DtStringHashKey(const DtStringHashKey& orig);
00191 
00193    DtStringHashKey& operator=(const DtStringHashKey& orig);
00194 
00196    virtual DtBaseHashKey* clone() const;
00197 
00199    virtual const DtString& value() const;
00200 
00202    virtual void setValue(const DtString& val);
00203 
00205    virtual const DtString stringRep() const;
00206 
00207 protected:
00208 
00210    virtual DtU32 computeHashValue();
00211 
00212 
00213 protected:
00214 
00215    DtString myString;
00216 };
00217 
00222 class DT_DLL_VLUTIL DtWStringHashKey : public DtBaseHashKey
00223 {
00224 public:
00225 
00227    DtWStringHashKey();
00228 
00230    DtWStringHashKey(const std::wstring& str);
00231 
00233    DtWStringHashKey(const wchar_t* str);
00234 
00236    virtual ~DtWStringHashKey();
00237 
00239    DtWStringHashKey(const DtWStringHashKey& orig);
00240 
00242    DtWStringHashKey& operator=(const DtWStringHashKey& orig);
00243 
00245    virtual DtBaseHashKey* clone() const;
00246 
00248    virtual const std::wstring& value() const;
00249 
00251    virtual void setValue(const std::wstring& val);
00252 
00256    virtual const DtString stringRep() const;
00257 
00258 protected:
00259 
00261    virtual DtU32 computeHashValue();
00262 
00263 
00264 protected:
00265 
00266    std::wstring myString;
00267 };
00268 
00269 #ifdef DtUSE_UTILITIES_NAMESPACE
00270 }     
00271 #endif
00272 
00273 

Document ID: Generated on Mon May 14 08:06:18 EDT 2012 from SVN revision 114750
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)