21
21
""" Implements SyclPlatform Cython extension type.
22
22
"""
23
23
24
+ from libcpp cimport bool
25
+
24
26
from ._backend cimport ( # noqa: E211
25
27
DPCTLCString_Delete,
26
28
DPCTLDeviceSelector_Delete,
27
29
DPCTLFilterSelector_Create,
30
+ DPCTLPlatform_AreEq,
28
31
DPCTLPlatform_Copy,
29
32
DPCTLPlatform_Create,
30
33
DPCTLPlatform_CreateFromSelector,
@@ -35,6 +38,7 @@ from ._backend cimport ( # noqa: E211
35
38
DPCTLPlatform_GetPlatforms,
36
39
DPCTLPlatform_GetVendor,
37
40
DPCTLPlatform_GetVersion,
41
+ DPCTLPlatform_Hash,
38
42
DPCTLPlatformMgr_GetInfo,
39
43
DPCTLPlatformMgr_PrintInfo,
40
44
DPCTLPlatformVector_Delete,
@@ -274,6 +278,42 @@ cdef class SyclPlatform(_SyclPlatform):
274
278
else :
275
279
return SyclContext._create(CRef)
276
280
281
+ cdef bool equals(self , SyclPlatform other):
282
+ """
283
+ Returns true if the :class:`dpctl.SyclPlatform` argument has the
284
+ same underlying ``DPCTLSyclPlatformRef`` object as this
285
+ :class:`dpctl.SyclPlatform` instance.
286
+
287
+ Returns:
288
+ :obj:`bool`: ``True`` if the two :class:`dpctl.SyclPlatform` objects
289
+ point to the same ``DPCTLSyclPlatformRef`` object, otherwise
290
+ ``False``.
291
+ """
292
+ return DPCTLPlatform_AreEq(self ._platform_ref, other.get_platform_ref())
293
+
294
+ def __eq__ (self , other ):
295
+ """
296
+ Returns True if the :class:`dpctl.SyclPlatform` argument has the
297
+ same underlying ``DPCTLSyclPlatformRef`` object as this
298
+ :class:`dpctl.SyclPlatform` instance.
299
+
300
+ Returns:
301
+ :obj:`bool`: ``True`` if the two :class:`dpctl.SyclPlatform` objects
302
+ point to the same ``DPCTLSyclPlatformRef`` object, otherwise
303
+ ``False``.
304
+ """
305
+ if isinstance (other, SyclPlatform):
306
+ return self .equals(< SyclPlatform> other)
307
+ else :
308
+ return False
309
+
310
+ def __hash__ (self ):
311
+ """
312
+ Returns a hash value by hashing the underlying ``sycl::platform`` object.
313
+
314
+ """
315
+ return DPCTLPlatform_Hash(self ._platform_ref)
316
+
277
317
278
318
def lsplatform (verbosity = 0 ):
279
319
"""
0 commit comments