HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SIM_RootDataId.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  */
7 
8 #ifndef __SIM_RootDataId_h__
9 #define __SIM_RootDataId_h__
10 
11 #include "SIM_API.h"
12 
13 #include <UT/UT_StringHolder.h>
14 #include <SYS/SYS_Hash.h>
15 
17 {
18 public:
19  SIM_RootDataId() { myId = -1; }
20 
21  explicit SIM_RootDataId(exint id) : myId(id) {}
22  explicit SIM_RootDataId(const UT_StringHolder &name) : myId(-1), myName(name) {}
23 
24  SIM_RootDataId(const SIM_RootDataId &src) = default;
25 
27  { return myName; }
28  int getId() const
29  { return myId; }
30 
31  void clear()
32  { myId = -1; myName = ""; }
33  bool getIsClear() const
34  { return (myId == -1 && !myName.isstring()); }
35 
36  bool operator==(const SIM_RootDataId &other) const
37  {
38  return myId == other.myId && myName == other.myName;
39  }
40 
41  bool operator!=(const SIM_RootDataId &other) const
42  {
43  return myId != other.myId || myName != other.myName;
44  }
45 
47  {
48  SYS_HashType hash = myName.hash();
49  SYShashCombine(hash, myId);
50  return hash;
51  }
52 
53 private:
54  UT_StringHolder myName;
55  exint myId;
56 };
57 
58 inline SYS_HashType hash_value(const SIM_RootDataId &id) { return id.hash(); }
59 
60 #endif
SYS_HashType hash_value(const SIM_RootDataId &id)
std::size_t SYS_HashType
Define the type for hash values.
Definition: SYS_Hash.h:19
UT_StringHolder getName() const
int64 exint
Definition: SYS_Types.h:115
SYS_HashType hash() const
bool operator!=(const SIM_RootDataId &other) const
GLuint const GLchar * name
Definition: glcorearb.h:785
bool getIsClear() const
#define SIM_API
Definition: SIM_API.h:10
bool operator==(const SIM_RootDataId &other) const
SIM_RootDataId(const UT_StringHolder &name)
SIM_RootDataId(exint id)
int getId() const
GLenum src
Definition: glcorearb.h:1792