ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
message.inl
Go to the documentation of this file.
1//==================================================================================================
2/// \file
3/// This header-file is part of module \alib_exceptions of the \aliblong.
4///
5/// \emoji :copyright: 2013-2025 A-Worx GmbH, Germany.
6/// Published under \ref mainpage_license "Boost Software License".
7//==================================================================================================
9
10//==================================================================================================
11/// This struct stores a list of information objects of arbitrary types, by publicly inheriting type
12/// \alib{BoxesMA}.
13/// In addition, the \alib{lang;CallerInfo} is attached, which usually refers to the place
14/// (and thread) tat constructed an instance of this type.<br>
15/// Finally, a type identifier is available with field #Type.
16///
17/// Note that while message data might be passed with construction, informational data may be added,
18/// changed or removed during the life-cycle of an instance using the inherited interface of
19/// class \alib{boxing;TBoxes}.
20///
21/// Inside \alib, the struct is used with the type \alib{exceptions;Exception}.
22//==================================================================================================
24{
25 CallerInfo CI; ///< The source code location that this message relates to.
26 Enum Type; ///< A type identifier, defined with construction by providing an element
27 ///< of an arbitrary enumeration type.
28 /// Constructor.
29 /// @param ci Information about the scope of invocation.
30 /// @param monoAllocator The allocator to store the arguments in.
31 /// @param type The message type.
32 /// @param args Variadic, templated list of arguments.
33 template <typename... TBoxables>
34 Message( const CallerInfo& ci,
35 MonoAllocator& monoAllocator,
36 const Enum& type,
37 TBoxables&&... args )
38 : TBoxes( monoAllocator )
39 , CI (ci)
40 , Type(type)
41 { Add( std::forward<TBoxables>(args)... ); }
42};
43
44} // namespace [alib::exceptions]
45
46// Customize boxing of type Message to its parent type Boxes. This allows "flattening" all
47// arguments stored in a message when added to an instance of Boxes.
48ALIB_BOXING_CUSTOMIZE_TYPE_MAPPING( alib::exceptions::Message*, boxing::TBoxes<MonoAllocator>* )
#define ALIB_BOXING_CUSTOMIZE_TYPE_MAPPING(TSource, TMapped)
#define ALIB_EXPORT
Definition alib.inl:488
monomem::TMonoAllocator< lang::HeapAllocator > MonoAllocator
boxing::Enum Enum
Type alias in namespace alib.
Definition enum.inl:211
boxing::TBoxes< MonoAllocator > BoxesMA
Type alias in namespace alib.
Definition boxes.inl:245
lang::CallerInfo CallerInfo
Type alias in namespace alib.
CallerInfo CI
The source code location that this message relates to.
Definition message.inl:25
Message(const CallerInfo &ci, MonoAllocator &monoAllocator, const Enum &type, TBoxables &&... args)
Definition message.inl:34