Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
utility.h File Reference
#include "Utility/traits.h"
#include <Common/assertion.h>
#include <Common/exceptions.h>
#include <bit>
#include <concepts>
#include <cstddef>
#include <cstring>
#include <limits>
#include <string>
#include <string_view>
#include <type_traits>
#include <utility>
#include <variant>
#include <version>

Go to the source code of this file.

Classes

struct  ph::TNonTypeTemplateArgDummy< T, VALUE >
 

Namespaces

namespace  ph
 The root for all renderer implementations.
 

Macros

#define PH_DECLARE_RULE_OF_5_MEMBERS_NO_DTOR(ClassType)
 Helper to declare rule of 5 special class members. Destructor is not included.
 
#define PH_DEFINE_RULE_OF_5_MEMBERS_NO_DTOR(ClassType)
 Helper to define defaulted rule of 5 special class members. Destructor is not included.
 
#define PH_DEFINE_INLINE_RULE_OF_5_MEMBERS_NO_DTOR(ClassType)
 Helper to define defaulted rule of 5 special class members (inlined). Destructor is not included.
 
#define PH_DECLARE_RULE_OF_5_MEMBERS(ClassType)
 Helper to declare rule of 5 special class members.
 
#define PH_DEFINE_RULE_OF_5_MEMBERS(ClassType)
 Helper to define defaulted rule of 5 special class members.
 
#define PH_DEFINE_INLINE_RULE_OF_5_MEMBERS(ClassType)
 Helper to define defaulted rule of 5 special class members (inlined).
 

Functions

template<typename Target , typename Source >
Target ph::bitwise_cast (const Source &source)
 
consteval bool ph::is_big_endian ()
 
template<CEnum EnumType>
constexpr auto ph::enum_to_value (const EnumType enumValue)
 
template<CEnum EnumType>
std::string ph::enum_to_string (const EnumType enumValue)
 
template<CEnumWithSizeInfo EnumType>
constexpr auto ph::enum_size ()
 
template<typename T >
T * ph::ptr_access (T *const ptr)
 Access a target's member consistently using . or -> operators. Note that these functions treat smart pointers as regular objects (ptr_access() and ref_access() will refer to the object itself, not its managed data). A nice discussion for the topic: https://stackoverflow.com/questions/14466620/c-template-specialization-calling-methods-on-types-that-could-be-pointers-or.
 
template<typename T >
T * ph::ptr_access (T &ref)
 
template<typename T >
T * ph::ptr_access (T &&ref)=delete
 
template<typename T >
T & ph::ref_access (T &ref)
 
template<typename T >
T & ph::ref_access (T *const ptr)
 
void ph::ref_access (std::nullptr_t)=delete
 
template<typename T >
T & ph::ref_access (T &&ref)=delete
 

Macro Definition Documentation

◆ PH_DECLARE_RULE_OF_5_MEMBERS

#define PH_DECLARE_RULE_OF_5_MEMBERS ( ClassType)
Value:
~ClassType()
#define PH_DECLARE_RULE_OF_5_MEMBERS_NO_DTOR(ClassType)
Helper to declare rule of 5 special class members. Destructor is not included.
Definition utility.h:23

Helper to declare rule of 5 special class members.

◆ PH_DECLARE_RULE_OF_5_MEMBERS_NO_DTOR

#define PH_DECLARE_RULE_OF_5_MEMBERS_NO_DTOR ( ClassType)
Value:
ClassType();\
ClassType(const ClassType& other);\
ClassType(ClassType&& other) noexcept;\
ClassType& operator = (const ClassType& rhs);\
ClassType& operator = (ClassType&& rhs) noexcept

Helper to declare rule of 5 special class members. Destructor is not included.

◆ PH_DEFINE_INLINE_RULE_OF_5_MEMBERS

#define PH_DEFINE_INLINE_RULE_OF_5_MEMBERS ( ClassType)
Value:
inline ~ClassType() = default
#define PH_DEFINE_INLINE_RULE_OF_5_MEMBERS_NO_DTOR(ClassType)
Helper to define defaulted rule of 5 special class members (inlined). Destructor is not included.
Definition utility.h:43

Helper to define defaulted rule of 5 special class members (inlined).

◆ PH_DEFINE_INLINE_RULE_OF_5_MEMBERS_NO_DTOR

#define PH_DEFINE_INLINE_RULE_OF_5_MEMBERS_NO_DTOR ( ClassType)
Value:
inline ClassType() = default;\
inline ClassType(const ClassType& other) = default;\
inline ClassType(ClassType&& other) noexcept = default;\
inline ClassType& operator = (const ClassType& rhs) = default;\
inline ClassType& operator = (ClassType&& rhs) noexcept = default

Helper to define defaulted rule of 5 special class members (inlined). Destructor is not included.

◆ PH_DEFINE_RULE_OF_5_MEMBERS

#define PH_DEFINE_RULE_OF_5_MEMBERS ( ClassType)
Value:
ClassType::~ClassType() = default
#define PH_DEFINE_RULE_OF_5_MEMBERS_NO_DTOR(ClassType)
Helper to define defaulted rule of 5 special class members. Destructor is not included.
Definition utility.h:33

Helper to define defaulted rule of 5 special class members.

◆ PH_DEFINE_RULE_OF_5_MEMBERS_NO_DTOR

#define PH_DEFINE_RULE_OF_5_MEMBERS_NO_DTOR ( ClassType)
Value:
ClassType::ClassType() = default;\
ClassType::ClassType(const ClassType& other) = default;\
ClassType::ClassType(ClassType&& other) noexcept = default;\
ClassType& ClassType::operator = (const ClassType& rhs) = default;\
ClassType& ClassType::operator = (ClassType&& rhs) noexcept = default

Helper to define defaulted rule of 5 special class members. Destructor is not included.