VR-Link API Documentation for DIS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
vlHash.h
Go to the documentation of this file.
1 /*********************************************************************************
2 ** Copyright (c) 1992-2025 MAK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************************/
8 #pragma once
9 
10 #include "vlutil/vlMachineTypes.h"
11 
12 #include <string>
13 #include <map>
14 
15 #ifdef DtUSE_UTILITIES_NAMESPACE
16 namespace DtUSE_UTILITIES_NAMESPACE
17 {
18 #endif
19 
20 #define INVALID_HASH 0xffffffff
21 
22 typedef unsigned int DtHashId;
23 
25 {
26 public:
27  //constructors
28  DtHash();
29  DtHash(const std::string& s);
30 
31  virtual ~DtHash();
32 
33  //copy and assignment constructors
34  DtHash(const DtHash &rhs);
35  DtHash &operator=(const DtHash &rhs);
36 
37  //set Hash value
38  void set(const std::string& s);
39 
40  //get the values
41  DtHashId value() const;
42  virtual DtHashId operator()() const;
43  virtual const std::string& str() const;
44 
45  //get the hash value of a string
46  static DtHashId value(const std::string& s);
47 
48  //check for validity
49  virtual bool isValid() const;
50 
51  //hash value to string (may not be enabled)
52  static std::string& valueToString(const DtHashId& id);
53 
54  virtual bool operator<(const DtHash &rhs) const;
55  virtual bool operator>(const DtHash &rhs) const;
56  virtual bool operator<=(const DtHash &rhs) const;
57  virtual bool operator>=(const DtHash &rhs) const;
58  virtual bool operator==(const DtHash &rhs) const;
59  virtual bool operator!=(const DtHash &rhs) const;
60 
61 protected:
62  static DtHashId makeHash(const std::string& s);
63 
65  std::string myString;
66 
67  typedef std::map<DtHashId, std::string> HashIdMap;
68  typedef std::map<std::string, DtHashId> HashStringMap;
69 
70  //these are simple functions that own the static variable. This is done this
71  //way to control when the static variable is created and prevent chicken/egg
72  //problems
73  static HashIdMap& theHashIdMap();
74  static HashStringMap& theHashStringMap();
75 };
76 
77 #ifdef DtUSE_UTILITIES_NAMESPACE
78 }
79 #endif
const bool operator==(const DtU128 &lhs, const DtU128 &rhs)
std::map< DtHashId, std::string > HashIdMap
Definition: vlHash.h:67
std::map< std::string, DtHashId > HashStringMap
Definition: vlHash.h:68
unsigned int DtHashId
Definition: vlHash.h:22
const bool operator!=(const DtU128 &lhs, const DtU128 &rhs)
Definition: vlHash.h:24
DtHashId myHashValue
Definition: vlHash.h:64
const bool operator<(const DtU128 &lhs, const DtU128 &rhs)
std::string myString
Definition: vlHash.h:65
This file contains typedefs for machine dependant types.
const bool operator>(const DtU128 &lhs, const DtU128 &rhs)
#define DT_DLL_VLUTIL
Definition: vlMachineTypes.h:109

Document ID: Generated on Thu Oct 16 00:12:25 EDT 2025 from SVN revision 280738
Copyright © 1992-2025 MAK Technologies. All Rights Reserved (www.mak.com)