ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
placeholder.inl
Go to the documentation of this file.
1//==================================================================================================
2/// \file
3/// This header file is part of module \alib_boxing of the \aliblong.
4///
5/// \emoji :copyright: 2013-2024 A-Worx GmbH, Germany.
6/// Published under \ref mainpage_license "Boost Software License".
7//==================================================================================================
8#ifndef HPP_ALIB_BOXING_PLACEHOLDER
9#define HPP_ALIB_BOXING_PLACEHOLDER 1
10#pragma once
11#if !defined(HPP_ALIB_BOXING_BOXING)
12# error "ALib sources with ending '.inl' must not be included from outside."
13#endif
14
15#include <cstring>
16
17namespace alib { namespace boxing { namespace detail {
18/// Inner struct providing a pointer and a length.<br>
19/// A \c constexpr constructor is given (not shown in documentation).
21{
22 const void* Pointer; ///< The pointer to the array.
23 integer Length; ///< The length of the array.
24
25 // constexpr constructors
26 #if !DOXYGEN
27 constexpr StructArray( const void* p, integer l) : Pointer( p ), Length ( l ) {}
28 #endif
29};
30
31/// Inner union with various \c constexpr constructors (not shown in documentation) to support
32/// the initialization of the outer union as \c constexpr.
33///
34/// Collects scalar integrals and arrays of those.
36{
37 int8_t Int8 ; ///< 8-bit signed integral.
38 uint8_t UInt8 ; ///< 8-bit unsigned integral.
39 int16_t Int16 ; ///< 16-bit signed integral.
40 uint16_t UInt16 ; ///< 16-bit unsigned integral.
41
42 #if DOXYGEN
43 int32_t Int32 ; ///< 32-bit signed integral. Available only if platform is not of 32-bit.
44 uint32_t UInt32 ; ///< 32-bit unsigned integral. Available only if platform is not of 32-bit.
45 int64_t Int64 ; ///< 64-bit signed integral. Available only if platform is not of 64-bit.
46 uint64_t UInt64 ; ///< 64-bit unsigned integral. Available only if platform is not of 64-bit.
47 #elif ALIB_SIZEOF_INTEGER != 4
48 int32_t Int32 ;
49 uint32_t UInt32 ;
50 #elif ALIB_SIZEOF_INTEGER != 8
51 int64_t Int64 ;
52 uint64_t UInt64 ;
53 #endif
54
55 integer Int ; ///< Signed integral of platform-dependent size.
56 uinteger UInt ; ///< Unsigned integral of platform-dependent size.
57
58 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.
59 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.
60
61 #if DOXYGEN
62 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.
63 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.
64
65 #elif ALIB_SIZEOF_INTEGER != 4
66 int32_t Array32 [2 * sizeof(uinteger) / sizeof( int32_t )];
67 #elif ALIB_SIZEOF_INTEGER != 8
68 int64_t Array64 [2 * sizeof(uinteger) / sizeof( int64_t )];
69 #endif
70
71 integer Array [ 2 ]; ///< Array of 64-bit signed integrals of length 2 on 64-bit platform, 1 on a 32-bit platform.
72 uinteger UArray [ 2 ]; ///< Array of 64-bit unsigned integrals of length 2 on 64-bit platform, 1 on a 32-bit platform.
73
74
75 // constexpr constructors
76 #if !DOXYGEN
77 constexpr UnionIntegrals ( integer v1, integer v2 ) : Array { v1, v2 } {}
78 constexpr UnionIntegrals ( int8_t value ) : Int8 { value } {}
79 constexpr UnionIntegrals ( uint8_t value ) : UInt8 { value } {}
80 constexpr UnionIntegrals ( int16_t value ) : Int16 { value } {}
81 constexpr UnionIntegrals ( uint16_t value ) : UInt16 { value } {}
82 #if ALIB_SIZEOF_INTEGER != 4
83 constexpr UnionIntegrals ( int32_t value ) : Int32 { value } {}
84 constexpr UnionIntegrals ( uint32_t value ) : UInt32 { value } {}
85 #elif ALIB_SIZEOF_INTEGER != 8
86 constexpr UnionIntegrals ( int64_t value ) : Int64 { value } {}
87 constexpr UnionIntegrals ( uint64_t value ) : UInt64 { value } {}
88 #endif
89 constexpr UnionIntegrals ( integer value ) : Int { value } {}
90 constexpr UnionIntegrals ( uinteger value ) : UInt { value } {}
91
92
93
94 #if ALIB_SIZEOF_INTGAP == 2
95 constexpr UnionIntegrals ( intGap_t value ) : Int16 { value } {}
96 constexpr UnionIntegrals ( uintGap_t value ) : UInt16 { value } {}
97 #elif ALIB_SIZEOF_INTGAP == 4
98 #if ALIB_SIZEOF_INTEGER != 4
99 constexpr UnionIntegrals ( intGap_t value ) : Int32 { value } {}
100 constexpr UnionIntegrals ( uintGap_t value ) : UInt32 { value } {}
101 #else
102 constexpr UnionIntegrals ( intGap_t value ) : Int { value } {}
103 constexpr UnionIntegrals ( uintGap_t value ) : UInt { value } {}
104 #endif
105 #elif ALIB_SIZEOF_INTGAP == 8
106 #if ALIB_SIZEOF_INTEGER != 8
107 constexpr UnionIntegrals ( intGap_t value ) : Int64 { value } {}
108 constexpr UnionIntegrals ( uintGap_t value ) : UInt64 { value } {}
109 #else
110 constexpr UnionIntegrals ( intGap_t value ) : Int { value } {}
111 constexpr UnionIntegrals ( uintGap_t value ) : UInt { value } {}
112 #endif
113 #else
114 #error "ALIB_SIZEOF_INTGAP not matched. Supported sizes are 2, 4 and 8."
115 #endif
116 #endif
117};
118
119/// Inner union with various \c constexpr constructors (not shown in documentation) to support
120/// the initialization of the outer union as \c constexpr.
121///
122/// Collects scalar floating points and arrays of those.
124{
125 float Float ; ///< A \c float value.
126 double Double ; ///< A \c double value.
127
128 float FloatArray [2 * sizeof(uinteger) / sizeof(float )]; ///< Array of \c float. The Length is usually 4 on 64-bit platform, 2 on a 32-bit platform.
129 double DoubleArray [2 * sizeof(uinteger) / sizeof(double )]; ///< Array of \c double. The Length is usually 2 on 64-bit platform, 1 on a 32-bit platform.
130
131 #if !DOXYGEN
132 constexpr UnionFloatingPoints( float value ) : Float { value } {}
133 constexpr UnionFloatingPoints( double value ) : Double { value } {}
134 #endif
135};
136
137
138/// Inner union with various \c constexpr constructors (not shown in documentation) to support
139/// the initialization of the outer union as \c constexpr.
140///
141/// Collects a \c void and a \c char pointer and arrays of those.<br>
142/// In addition, non-pointer field #Memory (type \c char) is given, which can be be used to
143/// receive a pointer to the start of the placeholder by applying <c>operator&</c>.
144/// This \c char* then can be reinterpreted without braking the
145/// \https{strict-aliasing rule,stackoverflow.com/questions/98650/what-is-the-strict-aliasing-rule}
146/// when compiling the code with higher optimization levels.
148{
149 void* Void; ///< A \c void pointer.
150 const void* CVoid; ///< A constant \c void pointer.
151 char* Char; ///< A \c void pointer.
152 const char* CChar; ///< A constant \c void pointer.
153 wchar* WChar; ///< A \c wchar pointer.
154 const wchar* CWChar; ///< A constant \c wchar pointer.
155
156 void* VoidArray[2]; ///< Array of <c>void*</c> of length \c 2.
157 const void* CVoidArray[2]; ///< Array of <c>const void*</c> of length \c 2.
158 char* CharArray[2]; ///< Array of <c>char*</c> of length \c 2.
159 const char* CCharArray[2]; ///< Array of <c>const char*</c> of length \c 2.
160 wchar* WCharArray[2]; ///< Array of <c>wchar*</c> of length \c 2.
161 const wchar* CWCharArray[2]; ///< Array of <c>const wchar*</c> of length \c 2.
162
163 char Memory; ///< Not a pointer but becomes one with applying <c>operator&</c>.
164
165 #if !DOXYGEN
166 constexpr UnionPointers( void* value ) : Void { value } {}
167 constexpr UnionPointers( const void* value ) : CVoid { value } {}
168 constexpr UnionPointers( char* value ) : Char { value } {}
169 constexpr UnionPointers( const char* value ) : CChar { value } {}
170 constexpr UnionPointers( wchar* value ) : WChar { value } {}
171 constexpr UnionPointers( const wchar* value ) : CWChar { value } {}
172
173 constexpr UnionPointers( const void* v1, const void* v2 ) : CVoidArray { v1, v2 } {}
174 constexpr UnionPointers( const char* v1, const char* v2 ) : CCharArray { v1, v2 } {}
175 constexpr UnionPointers( const wchar* v1, const wchar* v2 ) : CWCharArray { v1, v2 } {}
176 #endif
177};
178
179} // namespace alib::boxing[::detail]
180
181//==================================================================================================
182/// A \alib{boxing;Box::data;protected member of this union} is contained in class
183/// \alib{boxing;Box} to store a boxed object.
184/// This member is passed as an argument to static methods \b Write and \b Read of type traits
185/// struct \alib{boxing;T_Boxer}, which implement boxing and unboxing.
186///
187/// This union declares different inner structs and unions and contains one corresponding member of
188/// each. This sorts the union fields into different groups, which his also helpful when
189/// debugging instances of type box.
190///
191/// The overall size of this union is two times the size of \c std::size_t, hence 16 bytes on a
192/// 64-bit and 8 bytes on a 32-bit system.
193///
194/// Virtually any sort of data might be written into the union. With non-injective boxing, what means
195/// that two or more types are boxed to the same target type, the format that type uses has to be
196/// implemented by all \b Write and \b Read methods of any specialization of \alib{boxing;T_Boxer}.
197/// Otherwise, undefined behavior occurs.
198///
199/// This type offers two sets of templated overloaded methods, named \b %Write and \b Read.
200/// In addition to be overloaded, the methods use TMP to be selected by the compiler only for
201/// certain template types.<br>
202/// The methods cover boxing and unboxing of the most frequent types like
203/// - fundamental types,
204/// - "fitting" value types that are copy assignable,
205/// - "fitting" value types that are not copy assignable,
206/// - pointers and
207/// - arrays (only boxing).
208///
209/// For these type, the default implementation of \b T_Boxer::Write and \b Read, as given
210/// for example with macro \ref ALIB_BOXING_CUSTOMIZE_TYPE_MAPPING.
211///
212/// ####Custom Boxing####
213/// Custom implementations of boxing and unboxing may read from and write to the union data
214/// directly.<br>
215/// In the latter case, a "continuous" use of the available data is suggested. Aat least, gaps
216/// in writing should be initialized with a value (e.g., \c 0). The rationale for this is
217/// that the default implementations of box-functions \alib{boxing;FHashcode} and
218/// \alib{boxing;FEquals} use only the first \e N relevant bytes. If now, gaps are not written,
219/// they contain "random" data, what would cause a failure of these default functions.<br>
220///
221/// By the same token, if a customization of a non-array type writes a different length then
222/// C++ operator \c sizeof reports for the mapped type, then also struct TMP
223/// \alib{boxing;T_SizeInPlaceholder} has to be specialized for that type, so that method
224/// \alib{boxing;Box::GetPlaceholderUsageLength} reports the right value.
225/// Not that also method #Clear, used when boxing \e nulled pointers, only clears as much
226/// data in this struct as reported by \alib{boxing;T_SizeInPlaceholder}.
227///
228/// ####Constexpr Boxing####
229/// As explained in chapter \ref alib_boxing_more_opt_constexpr, method
230/// \alib{boxing;T_Boxer::Write} may be defined with a different signature that returns a
231/// value of this union, instead of receiving one to be filled. The aim is to allowing
232/// \c constexpr instances of class \b Box to be created from likewise \c constexpr values.
233/// The C++ language rules for \c constexpr constructors impose some restrictions. No reinterpret
234/// casts have to be performed. Furthermore, an union constructor must not initialize a field of an
235/// inner union by accessing it using the dot operator. Instead, the inner unions need to provide
236/// \c constexpr constructors that are called for the field of the outer union.
237///
238/// While this library defines <c>constexpr</c>-boxing for all fundamental types and for most
239/// library types of other modules (if it provides customized boxing for), still such customization
240/// is considered "expert use" as the gain to do it for custom types is marginal.
241/// For this reason, the constructors of inner structs and unions, and all reflection of those
242/// with a corresponding constructor of this outer union are \b not documented.
243/// This is to keep the documentation lean and non-repetitive. Therefore, for reference
244/// of the \c constexpr constructors available for this union, please consult the
245/// source code, found in file \b alib/boxing/placeholder.inl.
246///
247/// \note
248/// Unions
249/// \alib{boxing::detail;StructArray},
250/// \alib{boxing::detail;UnionIntegrals},
251/// \alib{boxing::detail;UnionFloatingPoints} and
252/// \alib{boxing::detail;UnionPointers} are defined in the \b detail namespace instead of being
253/// inner types. This is due to a restriction of the \b MSC compiler.
254///
255/// \see
256/// Chapter \ref alib_boxing_customizing "7. Customizing Boxing" of the Programmer's Manual of
257/// \alib_boxing_nl.<br>
258/// Furthermore structs \alib{boxing;T_Boxer} and \alib{boxing;T_SizeInPlaceholder}.
259//==================================================================================================
261{
262 detail::UnionPointers Pointers; ///< Collection of \c void, \c char and \b character pointers.
263 detail::StructArray Array; ///< Used when storing C++ arrays.
264 detail::UnionIntegrals Integrals; ///< Collection of integrals of different sizes.
265 detail::UnionFloatingPoints FloatingPoints; ///< Collection of floating points of different sizes.
266
267 #if ALIB_DEBUG
268 character* Debugger_String; ///< This union field was inserted only for debug display.
269 integer Debugger_Integral; ///< This union field was inserted only for debug display.
270 #endif
271
272 /// Default constructor, leaves everything uninitialized.
274
275
276 // constexpr constructors
277 #if !DOXYGEN
278
279 // Pointer construction
280 constexpr Placeholder( void* p ) : Pointers( p ) {}
281 constexpr Placeholder( const void* p ) : Pointers( p ) {}
282 constexpr Placeholder( char* p ) : Pointers( p ) {}
283 constexpr Placeholder( const char* p ) : Pointers( p ) {}
284 constexpr Placeholder( wchar* p ) : Pointers( p ) {}
285 constexpr Placeholder( const wchar* p ) : Pointers( p ) {}
286 constexpr Placeholder( const void* p1, const void* p2 ) : Pointers( p1, p2 ) {}
287 constexpr Placeholder( char* p1, char* p2 ) : Pointers( p1, p2 ) {}
288 constexpr Placeholder( const char* p1, const char* p2 ) : Pointers( p1, p2 ) {}
289 constexpr Placeholder( wchar* p1, wchar* p2 ) : Pointers( p1, p2 ) {}
290 constexpr Placeholder( const wchar* p1, const wchar* p2 ) : Pointers( p1, p2 ) {}
291
292 template<typename TMapped>
293 constexpr Placeholder( const TMapped* p ) : Pointers( p ) {}
294
295 // Integral construction
296 constexpr Placeholder( int8_t value ) : Integrals ( value ) {}
297 constexpr Placeholder( int16_t value ) : Integrals ( value ) {}
298 constexpr Placeholder( int32_t value ) : Integrals ( value ) {}
299 constexpr Placeholder( int64_t value ) : Integrals ( value ) {}
300 constexpr Placeholder( intGap_t value ) : Integrals ( value ) {}
301 constexpr Placeholder( uint8_t value ) : Integrals ( value ) {}
302 constexpr Placeholder( uint16_t value ) : Integrals ( value ) {}
303 constexpr Placeholder( uint32_t value ) : Integrals ( value ) {}
304 constexpr Placeholder( uint64_t value ) : Integrals ( value ) {}
305 constexpr Placeholder( uintGap_t value ) : Integrals ( value ) {}
306 constexpr Placeholder( integer word1, integer word2 ) : Integrals( word1, word2 ) {}
307
308 // Float construction
309 constexpr Placeholder( float value ) : FloatingPoints ( value ) {}
310 constexpr Placeholder( double value ) : FloatingPoints ( value ) {}
311
312 // Array construction
313 template<typename TArray>
314 constexpr Placeholder( const TArray* tpointer, integer length ) : Array( tpointer, length ) {}
315
316 #endif
317
318 /// Returns a pointer of type \p{TReturn}.
319 /// @tparam TReturn The requested pointer type
320 /// @return The pointer stored.
321 template<typename TReturn>
322 constexpr TReturn* Pointer () const { return reinterpret_cast<TReturn*>( Pointers.Char); }
323
324 /// Returns a pointer of type \c void*.
325 /// @return The pointer stored.
326 constexpr void* VoidPointer() const { return Pointers.Void; }
327
328 /// Sets a pointer of type \c char*.
329 /// @param value The value to set.
330 constexpr
331 void Pointer ( const char* value ) { Pointers.CChar= value; }
332
333 /// Sets a pointer of type \c void*.
334 /// @param value The value to set.
335 constexpr
336 void VoidPointer( const void* value ) { Pointers.CVoid= value; }
337
338 /// Returns the length of a stored array (the second word stored).
339 /// @return The length stored.
340 constexpr integer Length () const { return GetInteger(1); }
341
342 /// Returns the length of a stored array (the second word stored).
343 /// @return The length stored.
344 constexpr uinteger ULength () const { return GetUInteger(1); }
345
347 /// Returns the signed integral at index \p{idx}.
348 /// @param idx The index requested. Only \c 0 and \c 1 is allowed.
349 /// @return The integral value one or two.
350 constexpr integer GetInteger( int idx ) const { return Integrals.Array [idx]; }
351
352 /// Sets \p{value} at index \p{idx}.
353 /// @param idx The index to store \p{value} in. Only \c 0 and \c 1 is allowed.
354 /// @param value The value to set.
355 constexpr
356 void SetInteger( int idx, integer value )
357 {
358 Integrals.Array [idx]= value;
359 }
360
361 /// Returns the unsigned integral at index \p{idx}.
362 /// @param idx The index requested. Only \c 0 and \c 1 is allowed.
363 /// @return The integral value one or two.
364 constexpr uinteger GetUInteger( int idx ) const { return Integrals.UArray[idx]; }
365
366 /// Sets \p{value} at index \p{idx}.
367 /// @param idx The index to store \p{value} in. Only \c 0 and \c 1 is allowed.
368 /// @param value The value to set.
369 constexpr
370 void SetUInteger( int idx, uinteger value )
371 {
372 Integrals.UArray[idx]= value;
373 }
375
376
377 //==============================================================================================
378 /// Clears this box data.
379 ///
380 /// It has to be ensured that all memory used by a mapped type are cleared.
381 /// For example, the default implementations of box-functions \alib{boxing;FHashcode} and
382 /// \alib{boxing;FEquals} are using the relevant bytes of this placeholder and those must
383 /// not be of random value.
384 ///
385 /// For efficiency reasons, the rest should not be cleared.
386 ///
387 /// @tparam UsageLength The number of bytes to clear.
388 //==============================================================================================
389 template<unsigned int UsageLength>
390 constexpr void Clear()
391 {
392 static_assert( UsageLength > 0 && ( UsageLength <= 2 * sizeof(uinteger) ),
393 "Invalid usage length given" );
394
395 Integrals.Array[0]= 0;
397 if constexpr( UsageLength > sizeof(integer) )
398 Integrals.Array[1]= 0;
400 }
401
402 // #############################################################################################
403 // ######################### Boxing #####################################
404 // #############################################################################################
405
406 #if DOXYGEN
407
408 //==============================================================================================
409 /// This version of the overloaded methods is selected using TMP with most types, namly
410 /// fundamental, pointers and those value types that are copy assignable.
411 ///
412 /// The type is stored at the start of the data, by reinterpreting the address of field
413 /// \alib{boxing::detail;UnionPointers::Memory} to a pointer to \p{TMapped} and using the
414 /// C++ assign operator on that dereferenced pointer.
415 ///
416 /// @tparam TMapped The mapped type to store.
417 /// @param value The value of type \p{TMapped} to store.
418 //==============================================================================================
419 template<typename TMapped>
420 inline void Write( const TMapped& value);
421 #else
422
423 template<typename TMapped>
425 ATMP_VOID_IF( std::is_copy_assignable<TMapped>::value
426 && (sizeof(TMapped) <= 2 * sizeof(uinteger)) )
427 Write( const TMapped& value)
428 {
429 *reinterpret_cast<TMapped*>( &Pointers ) = value;
430 }
431
432 #endif
433
434 #if DOXYGEN
435 //==============================================================================================
436 /// This version of the overloaded methods is selected using TMP with types boxed as values
437 /// that are not copy-assignbable.
438 ///
439 /// The copying is performed using \c memcpy.
440 /// This is necessary to avoid de-referencing type-punned pointers which would
441 /// break the strict-aliasing rule when compiling the code with higher optimization levels.
442 /// Note that modern compilers like GCC usually optimize the invocation of \c memcpy out.<br>
443 ///
444 /// @tparam TMapped The mapped type to store.
445 /// @param value The value of type \p{TMapped} to store.
446 //==============================================================================================
447 template<typename TMapped>
448 inline void Write( const TMapped& value);
449 #else
450
451 template<typename TMapped>
453 ATMP_VOID_IF( !std::is_copy_assignable<TMapped>::value
454 && (sizeof(TMapped) <= 2 * sizeof(uinteger)) )
455 Write( const TMapped& value)
456 {
457 std::memcpy( &Pointers.Memory, &value, sizeof(TMapped) );
458 }
459
460 #endif
461
462
463 #if DOXYGEN
464 //==============================================================================================
465 /// This version of the overloaded methods is used for boxing C++ array types.
466 /// The type and length of the array is stored in field #Array of the data union.
467 ///
468 /// Note that for unboxing custom types from C++ array types, a custom implementation of
469 /// \alib{boxing;T_Boxer::Read} is needed. Such implementation reads the pointer and length
470 /// directly from this struct.
471 /// (I.e. there is no overloaded method \b Read available for arrays.)
472 ///
473 /// @tparam TArray The templated pointer type.
474 /// @param pointer The pointer to store.
475 /// @param length The array's length to store.
476 //==============================================================================================
477 template<typename TArray>
478 inline constexpr
479 void Write( const TArray* pointer, integer length );
480 #else
481
482 template<typename TArray>
483 ALIB_FORCE_INLINE constexpr
484 void Write( const TArray* pointer, integer length )
485 {
486 Array.Pointer = pointer;
487 Array.Length = length;
488 }
489 #endif
490
491
492 // #############################################################################################
493 // ######################### Unboxing #####################################
494 // #############################################################################################
495
496 //==============================================================================================
497 /// Templated read method for value types.
498 /// The value is dereferenced from the start of the placeholder memory.
499 ///
500 /// @tparam TMapped The value type to unbox.
501 /// @return The value stored.
502 //==============================================================================================
503 template<typename TMapped>
504 ALIB_FORCE_INLINE constexpr
505 TMapped Read() const
506 {
507 return *reinterpret_cast<const TMapped*>( &Pointers.Memory );
508 }
509
510
511}; // union Placeholder
512
513static_assert( sizeof(Placeholder) == 2 * sizeof(std::size_t),
514 "Size of boxing::Placeholder is not two times the size of 'size_t'. "
515 "Compilation platform not supported." );
516
517}} // namespace [alib::boxing]
518
519#endif // HPP_ALIB_BOXING_PLACEHOLDER
520
#define ATMP_VOID_IF(Cond)
Definition tmp.hpp:47
#define ALIB_WARNINGS_RESTORE
Definition alib.hpp:849
#define ALIB_FORCE_INLINE
Definition alib.hpp:650
#define ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE
Definition alib.hpp:760
Definition alib.cpp:69
lang::uinteger uinteger
Type alias in namespace alib.
Definition integers.hpp:276
characters::wchar wchar
Type alias in namespace alib.
lang::intGap_t intGap_t
Type alias in namespace alib.
Definition integers.hpp:279
characters::character character
Type alias in namespace alib.
lang::uintGap_t uintGap_t
Type alias in namespace alib.
Definition integers.hpp:282
lang::integer integer
Type alias in namespace alib.
Definition integers.hpp:273
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.
Placeholder()
Default constructor, leaves everything uninitialized.
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 FloatArray[2 *sizeof(uinteger)/sizeof(float)]
Array of float. The Length is usually 4 on 64-bit platform, 2 on a 32-bit platform.
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.
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.
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.
const void * CVoidArray[2]
Array of const void* of length 2.
char * CharArray[2]
Array of char* of length 2.