warning_accessor Class
warning_accessor Class#
Description
The warning_accessor
class provides an access (either on host or on a device) to the state of the warning flags
that are handled by the corresponding warning handler.
To construct an object of this class call the method
warning_handler<WarningEnumT, MinWarningEnum, MaxWarningEnum>::get_access()
(warning_handler class).
Include Files
oneapi/ipl.hpp
Domain Dependencies
Headers: oneapi/ipl.hpp
Libraries: oneipl.lib
Syntax
-
template<typename WarningEnumT, WarningEnumT MinWarningEnum, WarningEnumT MaxWarningEnum, sycl::access_mode AccessMode, bool IsHost>
class warning_accessor# This class provides an access (either on host or on a device) to the state of the warning flags that are handled by the corresponding warning handler.
To construct an object of this class call the method warning_handler<WarningEnumT, MinWarningEnum, MaxWarningEnum>::get_access().
- Template Parameters
WarningEnumT – the type of the warning enumeration which items are used as warnings by this warning state accessor
MinWarningEnum – the minimal value of the warning flag this warning state accessor works with
MaxWarningEnum – the maximal value of the warning flag this warning state accessor works with
AccessMode – the access mode (sycl::access_mode) that is used to access the state of the warning flags
IsHost – the flag that specifies whether this warning state accessor is host (
true
), or not (false
)
Public Types
-
using warning_enum_t = WarningEnumT#
Alias for the template parameter WarningEnumT (the type of the warning enumeration which items are used as warnings by this warning state accessor).
-
using warning_code_t = std::underlying_type_t<WarningEnumT>#
Alias for the underlying type of WarningEnumT enumeration type.
Public Functions
-
bool has(WarningEnumT warning_enum) const#
Checks whether the flag for the given warning
warning_enum
is set.- Parameters
warning_enum – the given warning which flag is to be checked
- Returns
true
if the flag for the given warningwarning_enum
is set, orfalse
otherwise
-
bool all() const#
Checks whether all warning flags accessed by this accessor are set.
- Returns
true
if all warning flags are set, orfalse
otherwise
-
bool any() const#
Checks whether any of warning flags accessed by this accessor is set.
- Returns
true
if any of warning flags is set, orfalse
otherwise
-
bool none() const#
Checks whether no warning flag accessed by this accessor is set.
- Returns
true
if no warning flag is set.
-
std::size_t count() const#
Returns the number of warning flags accessed by this accessor that are set.
- Returns
the number of warning flags handled accessed by this accessor that are set
-
constexpr std::size_t size() const#
Returns the number of warning flags accessed by this accessor.
- Returns
the number of warning flags accessed by this accessor
-
template<sycl::access_mode AccessModeCopy = access_mode_v>
void set() const# Sets all warning flags accessed by this accessor.
This function is available only unless AccessMode is read-only.
-
template<sycl::access_mode AccessModeCopy = access_mode_v>
void set(WarningEnumT warning_enum) const# Sets the flag for the given warning
warning_enum
.This function is available only unless AccessMode is read-only.
- Parameters
warning_enum – [in] the given warning which flag is to be set
-
template<sycl::access_mode AccessModeCopy = access_mode_v>
void reset() const# Sets all warning flags accessed by this accessor to
false
.This function is available only unless AccessMode is read-only.
-
template<sycl::access_mode OtherAccessMode, sycl::access_mode AccessModeCopy = access_mode_v>
void merge(const warning_accessor<WarningEnumT, MinWarningEnum, MaxWarningEnum, OtherAccessMode, IsHost> &other_warning_accessor) const# Merges the warning state accessed by this accessor with the state accessed by the other warning state accessor
other_warning_accessor
.This function is available only unless the access mode of this accessor is read-only and the access mode of the other warning state accessor
other_warning_accessor
is any read.- Parameters
other_warning_accessor – [in] the given other warning state accessor
Public Static Attributes
-
static constexpr auto number_of_warnings_v = {static_cast<std::size_t>(static_cast<warning_code_t>(MaxWarningEnum) - static_cast<warning_code_t>(MinWarningEnum)) + 1}#
The number of warnings (from MinWarningEnum to MaxWarningEnum) accessed by this accessor.
-
static constexpr auto access_mode_v = AccessMode#
Alias for the template parameter AccessMode (the access mode that is used to access the warning state).
-
static constexpr auto access_target_v#
Access target of this warning state accessor (depends on the value of IsHost flag).