Skip to content

Commit da2b53c

Browse files
committed
Merge pull request #2329 from nvmkuruc/gfpyhash
Use `TfHash` in `__hash__` implementations in `pxr/base/gf` (Internal change: 2269113)
2 parents 8a43c77 + da692f9 commit da2b53c

32 files changed

Lines changed: 64 additions & 58 deletions

pxr/base/gf/wrapDualQuat.template.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "pxr/base/gf/dualQuat{{ SCALAR_SUFFIX(S) }}.h"
3131
{% endfor %}
3232

33+
#include "pxr/base/tf/hash.h"
3334
#include "pxr/base/tf/pyUtils.h"
3435
#include "pxr/base/tf/wrapTypeHelpers.h"
3536
#include "pxr/base/tf/pyContainerConversions.h"
@@ -70,7 +71,7 @@ static {{ DUALQUAT }}& __itruediv__({{ DUALQUAT }} &self, {{ SCL }} value)
7071
}
7172

7273
static size_t __hash__({{ DUALQUAT }} const &self) {
73-
return hash_value(self);
74+
return TfHash{}(self);
7475
}
7576

7677
// Zero-initialized default ctor for python.

pxr/base/gf/wrapDualQuatd.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "pxr/base/gf/dualQuatf.h"
3131
#include "pxr/base/gf/dualQuath.h"
3232

33+
#include "pxr/base/tf/hash.h"
3334
#include "pxr/base/tf/pyUtils.h"
3435
#include "pxr/base/tf/wrapTypeHelpers.h"
3536
#include "pxr/base/tf/pyContainerConversions.h"
@@ -70,7 +71,7 @@ static GfDualQuatd& __itruediv__(GfDualQuatd &self, double value)
7071
}
7172

7273
static size_t __hash__(GfDualQuatd const &self) {
73-
return hash_value(self);
74+
return TfHash{}(self);
7475
}
7576

7677
// Zero-initialized default ctor for python.

pxr/base/gf/wrapDualQuatf.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "pxr/base/gf/dualQuatf.h"
3131
#include "pxr/base/gf/dualQuath.h"
3232

33+
#include "pxr/base/tf/hash.h"
3334
#include "pxr/base/tf/pyUtils.h"
3435
#include "pxr/base/tf/wrapTypeHelpers.h"
3536
#include "pxr/base/tf/pyContainerConversions.h"
@@ -70,7 +71,7 @@ static GfDualQuatf& __itruediv__(GfDualQuatf &self, float value)
7071
}
7172

7273
static size_t __hash__(GfDualQuatf const &self) {
73-
return hash_value(self);
74+
return TfHash{}(self);
7475
}
7576

7677
// Zero-initialized default ctor for python.

pxr/base/gf/wrapDualQuath.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "pxr/base/gf/dualQuatf.h"
3131
#include "pxr/base/gf/dualQuath.h"
3232

33+
#include "pxr/base/tf/hash.h"
3334
#include "pxr/base/tf/pyUtils.h"
3435
#include "pxr/base/tf/wrapTypeHelpers.h"
3536
#include "pxr/base/tf/pyContainerConversions.h"
@@ -70,7 +71,7 @@ static GfDualQuath& __itruediv__(GfDualQuath &self, GfHalf value)
7071
}
7172

7273
static size_t __hash__(GfDualQuath const &self) {
73-
return hash_value(self);
74+
return TfHash{}(self);
7475
}
7576

7677
// Zero-initialized default ctor for python.

pxr/base/gf/wrapMatrix.template.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
{% block customIncludes %}
3434
{% endblock customIncludes %}
3535

36+
#include "pxr/base/tf/hash.h"
3637
#include "pxr/base/tf/py3Compat.h"
3738
#include "pxr/base/tf/pyUtils.h"
3839
#include "pxr/base/tf/pyContainerConversions.h"
@@ -267,7 +268,7 @@ struct {{ MAT }}_Pickle_Suite : boost::python::pickle_suite
267268
}
268269
};
269270

270-
static size_t __hash__({{ MAT }} const &m) { return hash_value(m); }
271+
static size_t __hash__({{ MAT }} const &m) { return TfHash{}(m); }
271272

272273
static boost::python::tuple get_dimension()
273274
{

pxr/base/gf/wrapMatrix2d.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "pxr/base/gf/pyBufferUtils.h"
3333

3434

35+
#include "pxr/base/tf/hash.h"
3536
#include "pxr/base/tf/py3Compat.h"
3637
#include "pxr/base/tf/pyUtils.h"
3738
#include "pxr/base/tf/pyContainerConversions.h"
@@ -264,7 +265,7 @@ struct GfMatrix2d_Pickle_Suite : boost::python::pickle_suite
264265
}
265266
};
266267

267-
static size_t __hash__(GfMatrix2d const &m) { return hash_value(m); }
268+
static size_t __hash__(GfMatrix2d const &m) { return TfHash{}(m); }
268269

269270
static boost::python::tuple get_dimension()
270271
{

pxr/base/gf/wrapMatrix2f.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "pxr/base/gf/pyBufferUtils.h"
3333

3434

35+
#include "pxr/base/tf/hash.h"
3536
#include "pxr/base/tf/py3Compat.h"
3637
#include "pxr/base/tf/pyUtils.h"
3738
#include "pxr/base/tf/pyContainerConversions.h"
@@ -264,7 +265,7 @@ struct GfMatrix2f_Pickle_Suite : boost::python::pickle_suite
264265
}
265266
};
266267

267-
static size_t __hash__(GfMatrix2f const &m) { return hash_value(m); }
268+
static size_t __hash__(GfMatrix2f const &m) { return TfHash{}(m); }
268269

269270
static boost::python::tuple get_dimension()
270271
{

pxr/base/gf/wrapMatrix3d.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "pxr/base/gf/quatd.h"
3636
#include "pxr/base/gf/rotation.h"
3737

38+
#include "pxr/base/tf/hash.h"
3839
#include "pxr/base/tf/py3Compat.h"
3940
#include "pxr/base/tf/pyUtils.h"
4041
#include "pxr/base/tf/pyContainerConversions.h"
@@ -270,7 +271,7 @@ struct GfMatrix3d_Pickle_Suite : boost::python::pickle_suite
270271
}
271272
};
272273

273-
static size_t __hash__(GfMatrix3d const &m) { return hash_value(m); }
274+
static size_t __hash__(GfMatrix3d const &m) { return TfHash{}(m); }
274275

275276
static boost::python::tuple get_dimension()
276277
{

pxr/base/gf/wrapMatrix3f.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "pxr/base/gf/quatf.h"
3636
#include "pxr/base/gf/rotation.h"
3737

38+
#include "pxr/base/tf/hash.h"
3839
#include "pxr/base/tf/py3Compat.h"
3940
#include "pxr/base/tf/pyUtils.h"
4041
#include "pxr/base/tf/pyContainerConversions.h"
@@ -270,7 +271,7 @@ struct GfMatrix3f_Pickle_Suite : boost::python::pickle_suite
270271
}
271272
};
272273

273-
static size_t __hash__(GfMatrix3f const &m) { return hash_value(m); }
274+
static size_t __hash__(GfMatrix3f const &m) { return TfHash{}(m); }
274275

275276
static boost::python::tuple get_dimension()
276277
{

pxr/base/gf/wrapMatrix4d.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include "pxr/base/gf/quatd.h"
4040
#include "pxr/base/gf/rotation.h"
4141

42+
#include "pxr/base/tf/hash.h"
4243
#include "pxr/base/tf/py3Compat.h"
4344
#include "pxr/base/tf/pyUtils.h"
4445
#include "pxr/base/tf/pyContainerConversions.h"
@@ -294,7 +295,7 @@ struct GfMatrix4d_Pickle_Suite : boost::python::pickle_suite
294295
}
295296
};
296297

297-
static size_t __hash__(GfMatrix4d const &m) { return hash_value(m); }
298+
static size_t __hash__(GfMatrix4d const &m) { return TfHash{}(m); }
298299

299300
static boost::python::tuple get_dimension()
300301
{

0 commit comments

Comments
 (0)