This header-file is part of the ALib C++ Framework.
© 2013-2025 A-Worx GmbH, Germany. Published under Boost Software License.
Definition in file boxing.prepro.hpp.
#include "alib/alib.inl"Go to the source code of this file.
| #define ALIB_BOXING_BOOTSTRAP_REGISTER_FAPPEND_FOR_APPENDABLE_TYPE | ( | TAppendable | ) |
This macro registers templated box-function implementation Appendable for the given type TAppendable.
The macro is to be placed in the bootstrap section of an application, for any type that is appendable to class AString.
This macro selects version box-function type FAppend<character>. If a custom type is appendable to two or three underlying character types of class AString, then macros
should be used. Note that for each character type of ALib Strings, a different box-function is registered.
ALIB_BOXING_BOOTSTRAP_REGISTER_FAPPEND_FOR_APPENDABLE_TYPE( my_namespace::MyType* )
| TAppendable | The appendable type. |
Definition at line 142 of file boxing.prepro.hpp.
| #define ALIB_BOXING_BOOTSTRAP_REGISTER_FAPPEND_FOR_APPENDABLE_TYPE_N | ( | TAppendable | ) |
Same as macro ALIB_BOXING_BOOTSTRAP_REGISTER_FAPPEND_FOR_APPENDABLE_TYPE but implements interface FAppend<nchar> instead of FAppend<character>.
| TAppendable | The appendable type. |
Definition at line 146 of file boxing.prepro.hpp.
| #define ALIB_BOXING_BOOTSTRAP_REGISTER_FAPPEND_FOR_APPENDABLE_TYPE_W | ( | TAppendable | ) |
Same as macro ALIB_BOXING_BOOTSTRAP_REGISTER_FAPPEND_FOR_APPENDABLE_TYPE but implements interface FAppend<wchar> instead of FAppend<character>.
| TAppendable | The appendable type. |
Definition at line 150 of file boxing.prepro.hpp.
| #define ALIB_BOXING_BOOTSTRAP_REGISTER_FAPPEND_FOR_APPENDABLE_TYPE_X | ( | TAppendable | ) |
Same as macro ALIB_BOXING_BOOTSTRAP_REGISTER_FAPPEND_FOR_APPENDABLE_TYPE but implements interface FAppend<xchar> instead of FAppend<character>.
| TAppendable | The appendable type. |
Definition at line 154 of file boxing.prepro.hpp.
| #define ALIB_BOXING_BOOTSTRAP_VTABLE_DBG_REGISTER | ( | Identifier | ) |
Registers a statically created vtable singleton declared with either ALIB_BOXING_VTABLE_DECLARE or ALIB_BOXING_VTABLE_DECLARE_ARRAYTYPE.
This macro has to be placed in the bootstrap code of software. In debug-compilations, this macro is empty.
| Identifier | The identifier name of the vtable singleton as passed to macros ALIB_BOXING_VTABLE_DECLARE or ALIB_BOXING_VTABLE_DECLARE_ARRAYTYPE. |
Definition at line 129 of file boxing.prepro.hpp.
| #define ALIB_BOXING_CUSTOMIZE | ( | TSource, | |
| TMapped, | |||
| ... ) |
Macro used to specialize template struct BoxTraits, which customizes boxing for given boxable type TSource to be mapped to non-array type TMapped.
Type alias Mapping is implemented by the macro to evaluate to TMapped>. The implementations of methods Write and Read are to be provided with the variadic macro arguments.
This macro belongs to a set of sibling macros. For customization of boxing the best suitable macro should be chosen. The set is
ALIB_BOXING_CUSTOMIZE| TSource | The C++ 'source' type to specialize struct BoxTraits for. |
| TMapped | The target type to map TSource to. |
| ... | Definition of static inline methods Write and Read. |
Definition at line 42 of file boxing.prepro.hpp.
| #define ALIB_BOXING_CUSTOMIZE_ARRAY_TYPE | ( | TSource, | |
| TElement, | |||
| ... ) |
Specializes template struct BoxTraits, to customize boxing for given boxable type TSource to be mapped to array type TMapped[].
Type definition Mapping is implemented by the macro to evaluate to TMapped. The implementations of methods Write and Read are to be provided with the variadic macro arguments.
| TSource | The C++ 'source' type to specialize struct BoxTraits for. |
| TElement | The element type of the array to map TSource to. |
| ... | Definition of static inline methods Write and Read. |
Definition at line 51 of file boxing.prepro.hpp.
| #define ALIB_BOXING_CUSTOMIZE_ARRAY_TYPE_NON_UNBOXABLE | ( | TSource, | |
| TElement, | |||
| ... ) |
Specializes template struct BoxTraits, to customize boxing for given boxable type TSource to be mapped to array type TMapped[].
Type definition Mapping is implemented by the macro to evaluate to TMapped and IsArray evaluates to true.
Static method Read is declared to return void, with no implementation given (as it will not be called).
The implementation of method Write is to be provided with the variadic portion of the macro arguments.
| TSource | The C++ 'source' type to specialize struct BoxTraits for. |
| TElement | The element type of the array to map TSource to. |
| ... | Definition of static inline method Write. |
Definition at line 81 of file boxing.prepro.hpp.
| #define ALIB_BOXING_CUSTOMIZE_DENY_BOXING | ( | TSource | ) |
Specializes template struct BoxTraits, to completely forbid boxing and unboxing of type TSource.
For this, type definition Mapping is implemented by the macro to evaluate to TMapped and just declarations of static methods Write and Read are given.
The latter is declared to return void. Note that this in principle is not necessary because using NotBoxableTag already forbids unboxing. Nevertheless, this way concept IsLocked is satisfied for TSource as well.
| TSource | The type that should be denied to be used with ALib Boxing. |
Definition at line 91 of file boxing.prepro.hpp.
| #define ALIB_BOXING_CUSTOMIZE_NOT_UNBOXABLE | ( | TSource, | |
| TMapped ) |
Specializes template struct BoxTraits. This version of a set of sibling macros, is to be used when a simple type mapping is to be performed for types TSource that are statically castable to TMapped.
In contrast to macro ALIB_BOXING_CUSTOMIZE_TYPE_MAPPING, with this macro, unboxing the source type is denied.
The macro provides the implementations of all three entities of the type trait BoxTraits:
void, with no implementation given.| TSource | The C++ 'source' type to specialize struct BoxTraits for. |
| TMapped | The target type to map TSource to. |
Definition at line 71 of file boxing.prepro.hpp.
| #define ALIB_BOXING_CUSTOMIZE_TYPE_MAPPING | ( | TSource, | |
| TMapped ) |
Specializes template struct BoxTraits. This version of a set of sibling macros, is to be used when simple type mappings are to be performed between types that are statically castable, or when boxing as pointer should be enforced.
The macro provides the implementations of all three entities of the type trait BoxTraits:
| TSource | The C++ 'source' type to specialize struct BoxTraits for. |
| TMapped | The target type to map TSource to. |
Definition at line 61 of file boxing.prepro.hpp.
| #define ALIB_BOXING_DEFINE_FEQUALS_FOR_COMPARABLE_TYPE | ( | TComparable | ) |
This macro registers templated box-function ComparableTypes for given mapped type TComparable.
If a type is boxed as pointer type, then TComparable has to be given as pointer type. For comparison, the unboxed pointers will be dereferenced. If both are nulled, true is returned, if one is nulled, false.
As all function registrations have to be performed at run-time, this macro is to be placed in the bootstrap section of an application.
| TComparable | The comparable type name. |
Definition at line 136 of file boxing.prepro.hpp.
| #define ALIB_BOXING_DEFINE_FISLESS_FOR_COMPARABLE_TYPE | ( | TComparable | ) |
This macro registers templated box-function ComparableTypes for given type TComparable.
If a type is boxed as pointer type, then TComparable has to be given as pointer type. For comparison, the unboxed pointers will be dereferenced. If both are nulled, false is returned, if only lhs is nulled, true and if only rhs is nulled, then false.
As all function registrations have to be performed at run-time, this macro is to be placed in the bootstrap section of an application.
| TComparable | The comparable type name. |
Definition at line 139 of file boxing.prepro.hpp.
| #define ALIB_BOXING_VTABLE_DECLARE | ( | TMapped, | |
| Identifier ) |
Declares an extern object of type VTable named Identifier in namespace detail.
Furthermore specializes the type trait VTableOptimizationTraits for mapped type TMapped to have its method Get return the extern VTable-instance.
This macro has to be placed in a header included by each compilation unit that creates or accesses boxes of type TMapped.
| TMapped | The mapped type to declare a vtable singleton for. |
| Identifier | The identifier name of the vtable singleton. |
Definition at line 101 of file boxing.prepro.hpp.
| #define ALIB_BOXING_VTABLE_DECLARE_ARRAYTYPE | ( | TMapped, | |
| Identifier ) |
Same as ALIB_BOXING_VTABLE_DECLARE, but used with mapped array types. Specializes VTableOptimizationTraits for mapped type TMapped.
| TMapped | The mapped type to declare a vtable singleton for. |
| Identifier | The identifier name of the vtable singleton. |
Definition at line 107 of file boxing.prepro.hpp.
| #define ALIB_BOXING_VTABLE_DEFINE | ( | TMapped, | |
| Identifier ) |
Defines the external object declared with ALIB_BOXING_VTABLE_DECLARE.
This macro has to be placed in a compilation unit.
| TMapped | The mapped type to define a vtable singleton for. |
| Identifier | The identifier name of the vtable singleton. |
Definition at line 113 of file boxing.prepro.hpp.
| #define ALIB_BOXING_VTABLE_DEFINE_ARRAYTYPE | ( | TMapped, | |
| Identifier ) |
Defines the external object declared with ALIB_BOXING_VTABLE_DECLARE_ARRAYTYPE.
This macro has to be placed in a compilation unit.
| TMapped | The mapped type to define a vtable singleton for. |
| Identifier | The identifier name of the vtable singleton. |
Definition at line 123 of file boxing.prepro.hpp.