DPC++ Runtime
Runtime libraries for oneAPI DPC++
property_list.hpp
Go to the documentation of this file.
1 //==--------- property_list.hpp --- SYCL property list ---------------------==//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #pragma once
10 
11 #include <sycl/detail/common.hpp>
14 
15 namespace sycl {
17 namespace ext::oneapi {
18 template <typename... PropsT> class accessor_property_list;
19 } // namespace ext::oneapi
20 
25 
26  // The structs validate that all objects passed are SYCL properties
27  template <typename... Tail> struct AllProperties : std::true_type {};
28  template <typename T, typename... Tail>
29  struct AllProperties<T, Tail...>
30  : detail::conditional_t<is_property<T>::value, AllProperties<Tail...>,
31  std::false_type> {};
32 
33 public:
34  template <typename... PropsT, typename = typename detail::enable_if_t<
35  AllProperties<PropsT...>::value>>
36  property_list(PropsT... Props) : detail::PropertyListBase(false) {
37  ctorHelper(Props...);
38  }
39 
40  template <typename PropT> PropT get_property() const {
41  if (!has_property<PropT>())
42  throw sycl::invalid_object_error("The property is not found",
43  PI_ERROR_INVALID_VALUE);
44 
45  return get_property_helper<PropT>();
46  }
47 
48  template <typename PropT> bool has_property() const noexcept {
49  return has_property_helper<PropT>();
50  }
51 
53  add_or_replace_accessor_properties_helper(PropertyList.MPropsWithData);
54  }
56  delete_accessor_property_helper(Kind);
57  }
58 
59  template <typename... T> operator ext::oneapi::accessor_property_list<T...>();
60 
61 private:
63  std::bitset<detail::DataLessPropKind::DataLessPropKindSize> DataLessProps,
64  std::vector<std::shared_ptr<detail::PropertyWithDataBase>> PropsWithData)
65  : sycl::detail::PropertyListBase(DataLessProps, PropsWithData) {}
66 
67  template <typename... PropsT>
69 };
70 
71 } // __SYCL_INLINE_VER_NAMESPACE(_V1)
72 } // namespace sycl
sycl::_V1::property_list
Objects of the property_list class are containers for the SYCL properties.
Definition: property_list.hpp:24
property_traits.hpp
T
property_list_base.hpp
sycl::_V1::detail::PropertyListBase
Definition: property_list_base.hpp:22
__SYCL_INLINE_VER_NAMESPACE
#define __SYCL_INLINE_VER_NAMESPACE(X)
Definition: defines_elementary.hpp:11
sycl::_V1::detail::PropWithDataKind
PropWithDataKind
Definition: property_helper.hpp:53
sycl::_V1::property_list::delete_accessor_property
void delete_accessor_property(const sycl::detail::PropWithDataKind &Kind)
Definition: property_list.hpp:55
sycl::_V1::property_list::get_property
PropT get_property() const
Definition: property_list.hpp:40
sycl
---— Error handling, matching OpenCL plugin semantics.
Definition: access.hpp:14
sycl::_V1::detail::enable_if_t
typename std::enable_if< B, T >::type enable_if_t
Definition: stl_type_traits.hpp:24
sycl::_V1::property_list::property_list
property_list(PropsT... Props)
Definition: property_list.hpp:36
common.hpp
sycl::_V1::ext::oneapi::accessor_property_list
Definition: property_list.hpp:18
sycl::_V1::detail::PropertyListBase::MPropsWithData
std::vector< std::shared_ptr< PropertyWithDataBase > > MPropsWithData
Definition: property_list_base.hpp:133
sycl::_V1::property_list::has_property
bool has_property() const noexcept
Definition: property_list.hpp:48
sycl::_V1::property_list::add_or_replace_accessor_properties
void add_or_replace_accessor_properties(const property_list &PropertyList)
Definition: property_list.hpp:52
sycl::_V1::detail::conditional_t
typename std::conditional< B, T, F >::type conditional_t
Definition: stl_type_traits.hpp:27