ALib C++ Framework
by
Library Version: 2605 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
message.hpp
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/// Copyright 2013-2026 A-Worx GmbH, Germany.
6/// Published under #"mainpage_license".
7//==================================================================================================
9
10//==================================================================================================
11/// This struct stores a list of information objects of arbitrary types, by publicly inheriting type
12/// #"BoxesMA;2".
13/// In addition, the #"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 #"TBoxes".
20///
21/// Inside \alib, the struct is used with the type #"exc Exception".
22//==================================================================================================
23struct Message : BoxesMA {
24 CallerInfo CI; ///< The source code location that this message relates to.
25 Enum Type; ///< A type identifier, defined with construction by providing an element
26 ///< of an arbitrary enumeration type.
27 /// Constructor.
28 /// @param ci Information about the scope of invocation.
29 /// @param monoAllocator The allocator to store the arguments in.
30 /// @param type The message type.
31 /// @param args Variadic, templated list of arguments.
32 template <typename... TBoxables>
33 Message( const CallerInfo& ci,
34 MonoAllocator& monoAllocator,
35 const Enum& type,
36 TBoxables&&... args )
37 : TBoxes( monoAllocator )
38 , CI (ci)
39 , Type(type) { Add( std::forward<TBoxables>(args)... ); }
40};
41
42} // namespace [alib::exceptions]
43
44// Customize boxing of type Message to its parent type Boxes. This allows "flattening" all
45// arguments stored in a message when added to an instance of Boxes.
46ALIB_BOXING_CUSTOMIZE_TYPE_MAPPING( alib::exceptions::Message*, boxing::TBoxes<MonoAllocator>* )
#define ALIB_EXPORT
#define ALIB_BOXING_CUSTOMIZE_TYPE_MAPPING(TSource, TMapped)
monomem::TMonoAllocator< lang::HeapAllocator > MonoAllocator
boxing::TBoxes< MonoAllocator > BoxesMA
Type alias in namespace #"%alib".
Definition boxes.hpp:192
lang::CallerInfo CallerInfo
Type alias in namespace #"%alib".
boxing::Enum Enum
Type alias in namespace #"%alib".
Definition enum.hpp:210
CallerInfo CI
The source code location that this message relates to.
Definition message.hpp:24
Message(const CallerInfo &ci, MonoAllocator &monoAllocator, const Enum &type, TBoxables &&... args)
Definition message.hpp:33