MOS Source Code
Loading...
Searching...
No Matches
types.hpp File Reference
#include <atomic>
#include <cstddef>
#include <mos/types.h>
#include <type_traits>
+ Include dependency graph for types.hpp:

Go to the source code of this file.

Classes

class  PtrResult< T >
 

Macros

#define container_of(ptr, type, member)
 
#define MOS_ENUM_OPERATORS(_enum)
 

Typedefs

typedef std::atomic_size_t atomic_t
 

Functions

template<class P, class M>
constexpr size_t __offsetof (const M P::*member)
 
template<class P, class M>
constexpr P * __container_of (M *ptr, const M P::*member)
 
template<class P, class M>
constexpr const P * __container_of (const M *ptr, const M P::*member)
 
template<typename TOut, typename TIn>
TOut * cast (TIn *value)
 
template<typename TOut, typename TIn>
const TOut * cast (const TIn *value)
 

Macro Definition Documentation

◆ container_of

◆ MOS_ENUM_OPERATORS

#define MOS_ENUM_OPERATORS ( _enum)
Value:
constexpr inline _enum operator|(_enum a, _enum b) \
{ \
return static_cast<_enum>(static_cast<std::underlying_type_t<_enum>>(a) | static_cast<std::underlying_type_t<_enum>>(b)); \
} \
constexpr inline _enum operator&(_enum a, _enum b) \
{ \
return static_cast<_enum>(static_cast<std::underlying_type_t<_enum>>(a) & static_cast<std::underlying_type_t<_enum>>(b)); \
} \
constexpr inline _enum operator~(_enum a) \
{ \
return static_cast<_enum>(~static_cast<std::underlying_type_t<_enum>>(a)); \
} \
constexpr inline _enum &operator|=(_enum &a, _enum b) \
{ \
return a = a | b; \
} \
constexpr inline _enum &operator&=(_enum &a, _enum b) \
{ \
return a = a & b; \
} \
constexpr inline _enum &operator|=(_enum &a, std::underlying_type_t<_enum> b) \
{ \
return a = a | static_cast<_enum>(b); \
} \
constexpr inline _enum &operator&=(_enum &a, std::underlying_type_t<_enum> b) \
{ \
return a = a & static_cast<_enum>(b); \
}

Definition at line 113 of file types.hpp.

Typedef Documentation

◆ atomic_t

typedef std::atomic_size_t atomic_t

Definition at line 11 of file types.hpp.

Function Documentation

◆ __offsetof()

template<class P, class M>
size_t __offsetof ( const M P::* member)
constexpr

Definition at line 14 of file types.hpp.

Referenced by __container_of(), and __container_of().

◆ __container_of() [1/2]

template<class P, class M>
P * __container_of ( M * ptr,
const M P::* member )
inlineconstexpr

Definition at line 20 of file types.hpp.

+ Here is the call graph for this function:

◆ __container_of() [2/2]

template<class P, class M>
const P * __container_of ( const M * ptr,
const M P::* member )
inlineconstexpr

Definition at line 26 of file types.hpp.

+ Here is the call graph for this function:

◆ cast() [1/2]

◆ cast() [2/2]

template<typename TOut, typename TIn>
const TOut * cast ( const TIn * value)
inline

Definition at line 40 of file types.hpp.