VR-Link API Documentation for DIS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
vlHashKeys.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 1992-2010 VT MAK
3 ** All rights reserved.
4 *********************************************************************/
8 #pragma once
9 
10 #include "vlMachineTypes.h"
11 #include "vlString.h"
12 #include <string>
13 
14 #ifdef DtUSE_UTILITIES_NAMESPACE
15 namespace DtUSE_UTILITIES_NAMESPACE
16 {
17 #endif
18 
20 {
32 
33 };
34 
40 {
41 public:
42 
44  DtBaseHashKey();
45 
47  virtual ~DtBaseHashKey();
48 
50  DtBaseHashKey(const DtBaseHashKey& orig);
51 
53  DtBaseHashKey& operator=(const DtBaseHashKey& orig);
54 
56  virtual bool operator==(const DtBaseHashKey& other) const;
57 
59  virtual bool operator!=(const DtBaseHashKey& other) const;
60 
63  virtual DtU32 hashValue() const;
64 
66  virtual DtHashKeyType hashKeyType() const {return DtBaseHashKeyType;}
67 
69  virtual DtBaseHashKey* clone() const = 0;
70 
72  virtual const DtString stringRep() const = 0;
73 
77  virtual bool equalTo(const DtBaseHashKey& otherKey) const;
78 
79 protected:
80 
82  virtual DtU64 computeHashValue() = 0;
83 
84 
85 protected:
86 
88  mutable bool myHashValueIsComputed;
89 
91  mutable DtU32 myHashValue;
92 };
93 
94 
100 {
101 public:
102 
104  DtIntHashKey(DtU32 num);
105 
107  virtual ~DtIntHashKey();
108 
110  DtIntHashKey(const DtIntHashKey& orig);
111 
113  DtIntHashKey& operator=(const DtIntHashKey& orig);
114 
116  virtual DtBaseHashKey* clone() const;
117 
119  virtual DtU32 value() const;
120 
122  virtual DtHashKeyType hashKeyType() const {return DtIntHashKeyType;}
123 
125  virtual const DtString stringRep() const;
126 
129  virtual bool equalTo(const DtBaseHashKey& otherKey) const;
130 
131 protected:
132 
134  virtual DtU64 computeHashValue();
135 
136 protected:
137 
139 };
140 
141 
153 {
154 public:
155 
157  DtPtrHashKey(void *ptr);
158 
160  virtual ~DtPtrHashKey();
161 
163  DtPtrHashKey(const DtPtrHashKey& orig);
164 
166  DtPtrHashKey& operator=(const DtPtrHashKey& orig);
167 
169  virtual DtBaseHashKey* clone() const;
170 
172  virtual void *value() const;
173 
175  virtual DtHashKeyType hashKeyType() const {return DtPtrHashKeyType;}
176 
178  virtual const DtString stringRep() const;
179 
182  virtual bool equalTo(const DtBaseHashKey& otherKey) const;
183 
184 protected:
185 
187  virtual DtU64 computeHashValue();
188 
189 protected:
190 
191  void *myPtr;
192 };
193 
199 {
200 public:
201 
203  DtStringHashKey();
204 
206  DtStringHashKey(const DtString& str);
207 
209  DtStringHashKey(const char* str);
210 
212  virtual ~DtStringHashKey();
213 
215  DtStringHashKey(const DtStringHashKey& orig);
216 
218  DtStringHashKey& operator=(const DtStringHashKey& orig);
219 
221  virtual DtBaseHashKey* clone() const;
222 
224  virtual const DtString& value() const;
225 
227  virtual void setValue(const DtString& val);
228 
231 
233  virtual const DtString stringRep() const;
234 
235 protected:
236 
238  virtual DtU64 computeHashValue();
239 
240 
241 protected:
242 
244 };
245 
251 {
252 public:
253 
256 
258  DtWStringHashKey(const std::wstring& str);
259 
261  DtWStringHashKey(const wchar_t* str);
262 
264  virtual ~DtWStringHashKey();
265 
267  DtWStringHashKey(const DtWStringHashKey& orig);
268 
270  DtWStringHashKey& operator=(const DtWStringHashKey& orig);
271 
273  virtual DtBaseHashKey* clone() const;
274 
276  virtual const std::wstring& value() const;
277 
279  virtual void setValue(const std::wstring& val);
280 
283 
287  virtual const DtString stringRep() const;
288 
289 protected:
290 
292  virtual DtU64 computeHashValue();
293 
294 
295 protected:
296 
297  std::wstring myString;
298 };
299 
300 #ifdef DtUSE_UTILITIES_NAMESPACE
301 }
302 #endif
303 
304 
DtHashKeyType
Definition: vlHashKeys.h:19
const bool operator==(const DtU128 &lhs, const DtU128 &rhs)
Instances of DtIntHashKey are used as a hash key made from an integer.
Definition: vlHashKeys.h:99
Definition: vlHashKeys.h:21
Contains the DtString class declaration.
virtual DtHashKeyType hashKeyType() const
Get the type of HashKey.
Definition: vlHashKeys.h:282
Definition: vlHashKeys.h:23
DtPtrHashKey is used as an index into DtHashList where the key is a pointer.
Definition: vlHashKeys.h:152
DtBaseHashKey is an abstract base class for hash keys.
Definition: vlHashKeys.h:39
unsigned long long DtU64
-------—— Network Layout for a long long (64 bytes unsigned)
Definition: vlMachineTypes.h:185
virtual DtHashKeyType hashKeyType() const
Get the type of HashKey.
Definition: vlHashKeys.h:230
void * myPtr
Definition: vlHashKeys.h:191
Definition: vlHashKeys.h:28
Definition: vlHashKeys.h:27
Definition: vlHashKeys.h:24
virtual DtHashKeyType hashKeyType() const
Get the type of HashKey.
Definition: vlHashKeys.h:175
Definition: vlHashKeys.h:26
Definition: vlHashKeys.h:25
virtual DtHashKeyType hashKeyType() const
Get the type of HashKey.
Definition: vlHashKeys.h:66
DtU32 myNum
Definition: vlHashKeys.h:138
Definition: vlHashKeys.h:22
DtU32 myHashValue
myHashValue is modified in the const function hashValue()
Definition: vlHashKeys.h:91
Definition: vlHashKeys.h:30
Definition: vlHashKeys.h:29
virtual DtHashKeyType hashKeyType() const
Get the type of HashKey.
Definition: vlHashKeys.h:122
bool myHashValueIsComputed
myHashValueIsComputed is modified in hashValue()
Definition: vlHashKeys.h:88
Instances of DtWStringHashKey are used as a hash key made from a wide string.
Definition: vlHashKeys.h:250
Instances of DtStringHashKey are used as a hash key made from a string.
Definition: vlHashKeys.h:198
Definition: vlHashKeys.h:31
DtString myString
Definition: vlHashKeys.h:243
const bool operator!=(const DtU128 &lhs, const DtU128 &rhs)
unsigned long DtU32
A 32 bit unsigned integer value.
Definition: vlMachineTypes.h:153
Instances of DtString are used to represent strings.
Definition: vlString.h:29
std::wstring myString
Definition: vlHashKeys.h:297
This file contains typedefs for machine dependant types.
#define DT_DLL_VLUTIL
Definition: vlMachineTypes.h:109

Document ID: Generated on Mon Apr 25 03:39:01 EDT 2022 from SVN revision 242502
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)