8#ifndef HPP_ALIB_BOXING_PLACEHOLDER
9#define HPP_ALIB_BOXING_PLACEHOLDER 1
11#if !defined(HPP_ALIB_BOXING_BOXING)
12# error "ALib sources with ending '.inl' must not be included from outside."
15#if !defined (_GLIBCXX_CSTRING) && !defined(_CSTRING_)
19namespace alib {
namespace boxing {
namespace detail {
30 #if !defined(ALIB_DOX)
53 #elif ALIB_SIZEOF_INTEGER != 4
56 #elif ALIB_SIZEOF_INTEGER != 8
71 #elif ALIB_SIZEOF_INTEGER != 4
73 #elif ALIB_SIZEOF_INTEGER != 8
82 #if !defined(ALIB_DOX)
86 constexpr UnionIntegrals ( int16_t value ) :
Int16 { value } {}
87 constexpr UnionIntegrals ( uint16_t value ) :
UInt16 { value } {}
88 #if ALIB_SIZEOF_INTEGER != 4
89 constexpr UnionIntegrals ( int32_t value ) :
Int32 { value } {}
90 constexpr UnionIntegrals ( uint32_t value ) :
UInt32 { value } {}
91 #elif ALIB_SIZEOF_INTEGER != 8
92 constexpr UnionIntegrals ( int64_t value ) :
Int64 { value } {}
93 constexpr UnionIntegrals ( uint64_t value ) :
UInt64 { value } {}
95 constexpr UnionIntegrals (
integer value ) :
Int { value } {}
96 constexpr UnionIntegrals (
uinteger value ) :
UInt { value } {}
100 #if ALIB_SIZEOF_INTGAP == 2
101 constexpr UnionIntegrals (
intGap_t value ) :
Int16 { value } {}
103 #elif ALIB_SIZEOF_INTGAP == 4
104 #if ALIB_SIZEOF_INTEGER != 4
105 constexpr UnionIntegrals (
intGap_t value ) :
Int32 { value } {}
108 constexpr UnionIntegrals (
intGap_t value ) :
Int { value } {}
109 constexpr UnionIntegrals (
uintGap_t value ) :
UInt { value } {}
111 #elif ALIB_SIZEOF_INTGAP == 8
112 #if ALIB_SIZEOF_INTEGER != 8
113 constexpr UnionIntegrals (
intGap_t value ) :
Int64 { value } {}
116 constexpr UnionIntegrals (
intGap_t value ) :
Int { value } {}
117 constexpr UnionIntegrals (
uintGap_t value ) :
UInt { value } {}
120 #error "ALIB_SIZEOF_INTGAP not matched. Supported sizes are 2, 4 and 8."
135#if (ALIB_SIZEOF_LONGDOUBLE_REPORTED <= 2 * ALIB_SIZEOF_INTEGER ) || defined(ALIB_DOX)
142 #if !defined(ALIB_DOX)
145#if (ALIB_SIZEOF_LONGDOUBLE_REPORTED <= 2 * ALIB_SIZEOF_INTEGER ) || defined(ALIB_DOX)
181 #if !defined(ALIB_DOX)
185 constexpr UnionPointers(
const char* value ) :
CChar { value } {}
186 constexpr UnionPointers(
wchar* value ) :
WChar { value } {}
187 constexpr UnionPointers(
const wchar* value ) :
CWChar { value } {}
189 constexpr UnionPointers(
const void* v1,
const void* v2 ) :
CVoidArray { v1, v2 } {}
190 constexpr UnionPointers(
const char* v1,
const char* v2 ) :
CCharArray { v1, v2 } {}
290 #if !defined(ALIB_DOX)
297 constexpr Placeholder(
const void* p ) :
Pointers( p ) {}
298 constexpr Placeholder(
char* p ) :
Pointers( p ) {}
299 constexpr Placeholder(
const char* p ) :
Pointers( p ) {}
302 constexpr Placeholder(
const void* p1,
const void* p2 ) :
Pointers( p1, p2 ) {}
303 constexpr Placeholder(
char* p1,
char* p2 ) :
Pointers( p1, p2 ) {}
304 constexpr Placeholder(
const char* p1,
const char* p2 ) :
Pointers( p1, p2 ) {}
308 template<
typename TMapped>
309 constexpr Placeholder(
const TMapped* p ) :
Pointers( p ) {}
312 constexpr Placeholder( int8_t value ) :
Integrals ( value ) {}
313 constexpr Placeholder( int16_t value ) :
Integrals ( value ) {}
314 constexpr Placeholder( int32_t value ) :
Integrals ( value ) {}
315 constexpr Placeholder( int64_t value ) :
Integrals ( value ) {}
317 constexpr Placeholder( uint8_t value ) :
Integrals ( value ) {}
318 constexpr Placeholder( uint16_t value ) :
Integrals ( value ) {}
319 constexpr Placeholder( uint32_t value ) :
Integrals ( value ) {}
320 constexpr Placeholder( uint64_t value ) :
Integrals ( value ) {}
325 constexpr Placeholder(
float value ) :
FloatingPoints ( value ) {}
326 constexpr Placeholder(
double value ) :
FloatingPoints ( value ) {}
327#if ALIB_SIZEOF_LONGDOUBLE_REPORTED <= 2 * ALIB_SIZEOF_INTEGER
328 constexpr Placeholder(
long double value ) :
FloatingPoints ( value ) {}
332 template<
typename TArray>
333 constexpr Placeholder(
const TArray* tpointer,
integer length ) :
Array( tpointer, length ) {}
342 template<
typename TReturn>
428 template<
unsigned int UsageLength>
431 static_assert( UsageLength > 0 && ( UsageLength <= 2 *
sizeof(
uinteger) ),
432 "Invalid usage length given" );
436 if constexpr( UsageLength >
sizeof(
integer) )
445 #if defined(ALIB_DOX)
458 template<
typename TMapped>
459 inline void Write(
const TMapped& value);
462 template<
typename TMapped>
465 && (
sizeof(TMapped) <= 2 *
sizeof(
uinteger)) )
466 Write(
const TMapped& value)
468 *
reinterpret_cast<TMapped*
>( &
Pointers ) = value;
473 #if defined(ALIB_DOX)
486 template<
typename TMapped>
487 inline void Write(
const TMapped& value);
490 template<
typename TMapped>
493 && (
sizeof(TMapped) <= 2 *
sizeof(
uinteger)) )
494 Write(
const TMapped& value)
502 #if defined(ALIB_DOX)
516 template<
typename TArray>
521 template<
typename TArray>
542 template<
typename TMapped>
552static_assert(
sizeof(Placeholder) == 2 *
sizeof(std::size_t),
553 "Size of boxing::Placeholder is not two times the size of 'size_t'. "
554 "Compilation platform not supported." );
#define ATMP_VOID_IF(Cond)
#define ALIB_WARNINGS_RESTORE
#define ALIB_FORCE_INLINE
#define ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE
lang::uinteger uinteger
Type alias in namespace alib.
characters::wchar wchar
Type alias in namespace alib.
lang::intGap_t intGap_t
Type alias in namespace alib.
characters::character character
Type alias in namespace alib.
lang::uintGap_t uintGap_t
Type alias in namespace alib.
lang::integer integer
Type alias in namespace alib.
integer Length
The length of the array.
const void * Pointer
The pointer to the array.
constexpr TReturn * Pointer() const
constexpr void Pointer(const char *value)
character * Debugger_String
This union field was inserted only for debug display.
ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE constexpr integer GetInteger(int idx) const
constexpr uinteger ULength() const
detail::UnionIntegrals Integrals
Collection of integrals of different sizes.
constexpr void SetUInteger(int idx, uinteger value)
integer Debugger_Integral
This union field was inserted only for debug display.
constexpr integer Length() const
constexpr void SetInteger(int idx, integer value)
constexpr void VoidPointer(const void *value)
detail::UnionFloatingPoints FloatingPoints
Collection of floating points of different sizes.
constexpr uinteger GetUInteger(int idx) const
detail::UnionPointers Pointers
Collection of void, char and character pointers.
constexpr void Write(const TArray *pointer, integer length)
constexpr void * VoidPointer() const
ALIB_WARNINGS_RESTORE constexpr void Clear()
ALIB_FORCE_INLINE constexpr TMapped Read() const
detail::StructArray Array
Used when storing C++ arrays.
void Write(const TMapped &value)
float Float
A float value.
float FloatArray[2 *sizeof(uinteger)/sizeof(float)]
Array of float. The Length is usually 4 on 64-bit platform, 2 on a 32-bit platform.
long double LDouble
A long double value. Available only if sizeof(long double) is smaller or equal than 2 x sizeof(intege...
double Double
A double value.
double DoubleArray[2 *sizeof(uinteger)/sizeof(double)]
Array of double. The Length is usually 2 on 64-bit platform, 1 on a 32-bit platform.
int64_t Int64
64-bit signed integral. Available only if platform is not of 64-bit.
integer Int
Signed integral of platform-dependent size.
uint8_t UInt8
8-bit unsigned integral.
int8_t Int8
8-bit signed integral.
uinteger UInt
Unsigned integral of platform-dependent size.
int64_t Array64[2 *sizeof(uinteger)/sizeof(int64_t)]
Array of 64-bit signed integrals of length 1 on a 32-bit platform. Not available on 64-bit platforms.
int8_t Array8[2 *sizeof(uinteger)/sizeof(int8_t)]
Array of 8-bit signed integrals of length 16 on 64-bit platform, 8 on a 32-bit platform.
int32_t Int32
32-bit signed integral. Available only if platform is not of 32-bit.
uint16_t UInt16
16-bit unsigned integral.
integer Array[2]
Array of 64-bit signed integrals of length 2 on 64-bit platform, 1 on a 32-bit platform.
uinteger UArray[2]
Array of 64-bit unsigned integrals of length 2 on 64-bit platform, 1 on a 32-bit platform.
int16_t Int16
16-bit signed integral.
int32_t Array32[2 *sizeof(uinteger)/sizeof(int32_t)]
Array of 32-bit signed integrals of length 4 on a 64-bit platform. Not available on 32-bit platforms.
int16_t Array16[2 *sizeof(uinteger)/sizeof(int16_t)]
Array of 16-bit signed integrals of length 8 on 64-bit platform, 4 on a 32-bit platform.
uint32_t UInt32
32-bit unsigned integral. Available only if platform is not of 32-bit.
uint64_t UInt64
64-bit unsigned integral. Available only if platform is not of 64-bit.
wchar * WChar
A wchar pointer.
const char * CChar
A constant void pointer.
void * VoidArray[2]
Array of void* of length 2.
wchar * WCharArray[2]
Array of wchar* of length 2.
void * Void
A void pointer.
char Memory
Not a pointer but becomes one with applying operator&.
const char * CCharArray[2]
Array of const char* of length 2.
const void * CVoid
A constant void pointer.
const wchar * CWCharArray[2]
Array of const wchar* of length 2.
const wchar * CWChar
A constant wchar pointer.
char * Char
A void pointer.
const void * CVoidArray[2]
Array of const void* of length 2.
char * CharArray[2]
Array of char* of length 2.