ALib C++ Library
Library Version: 2312 R0
Documentation generated by doxygen
Public Fields | Public Methods | Protected Fields | List of all members
Message Struct Reference

#include <message.hpp>

Inheritance diagram for Message:
[legend]
Collaboration diagram for Message:
[legend]

Class Description


This struct stores a list of information objects of arbitrary type by publically inheriting type Boxes. In addition, source code location information is attached, which usually refers to the place of construction of an instance of this type.
Finally, a type identifier is available with field Type.

Note that while message data might be passed with construction, informational data may be added, changed or removed during the life-cycle of an instance using the inherited interface of class Boxes.

Inside ALib, the struct is used with types Exception and Report.

Definition at line 43 of file message.hpp.

Public Fields

NCString File
 
NCString Function
 
int Line
 
Enum Type
 

Public Methods

template<typename... TBoxables>
 Message (const NCString &file, int line, const NCString &function, const Enum &type, TBoxables &&... args)
 
template<typename... TBoxables>
 Message (const NCString &file, int line, const NCString &function, MonoAllocator *monoAllocator, Responsibility monoAllocatorResp, const Enum &type, TBoxables &&... args)
 
 ~Message ()
 
void CloneArguments ()
 
- Public Methods inherited from Boxes
 Boxes ()=default
 
 Boxes (Boxes &)=delete
 
 Boxes (monomem::MonoAllocator *monoAllocator)
 
BoxesAdd ()
 
BoxesAdd (const Box &box)
 
template<size_t TExtend>
BoxesAdd (const Box(&boxArray)[TExtend])
 
BoxesAdd (const Boxes &boxes)
 
template<typename... TBoxables>
BoxesAdd (TBoxables &&... args)
 
ALIB_API void AddArray (const Box *boxArray, integer length)
 
template<typename TFDecl , typename... TArgs>
void CallAll (TArgs &&... args)
 
template<typename TFDecl , typename... TArgs>
void CallAll (TArgs &&... args) const
 
ALIB_API void CloneAll (monomem::MonoAllocator &memory)
 
template<typename TBoxable >
Boxesoperator+= (TBoxable &&src)
 
template<typename TBoxable >
Boxesoperator<< (TBoxable &&src)
 
Boxesoperator= (Boxes &)=delete
 
void Reserve (integer newCapacity)
 
integer Size () const
 

Protected Fields

Responsibility monoAllocatorResponsibility
 

Constructor & Destructor Documentation

◆ Message() [1/2]

Message ( const NCString file,
int  line,
const NCString function,
const Enum type,
TBoxables &&...  args 
)
inline

Constructs a message that does not use a MonoAllocator and therefore uses dynamic memory allocation for storing the boxable arguments.

Parameters
fileInformation about the scope of invocation.
lineInformation about the scope of invocation.
functionInformation about the scope of invocation.
typeThe message type.
argsVariadic, templated list of arguments.

Definition at line 79 of file message.hpp.

Here is the call graph for this function:

◆ Message() [2/2]

Message ( const NCString file,
int  line,
const NCString function,
MonoAllocator monoAllocator,
Responsibility  monoAllocatorResp,
const Enum type,
TBoxables &&...  args 
)
inline

Constructs a message that uses a MonoAllocator to store the boxable arguments. If parameter monoAllocatorResp equals Responsibility::Transfer, then this destructor of this class will delete the object given with monoAllocator.

Parameters
fileInformation about the scope of invocation.
lineInformation about the scope of invocation.
functionInformation about the scope of invocation.
monoAllocatorThe allocator to store the arguments in.
monoAllocatorRespThe responsibility for the allocator.
typeThe message type.
argsVariadic, templated list of arguments.

Definition at line 102 of file message.hpp.

Here is the call graph for this function:

◆ ~Message()

~Message ( )
inline

Destructor. If a monotonic allocator was provided in the constructor along with flag Responsibility::Transfer, this allocator is deleted.

Definition at line 116 of file message.hpp.

Member Function Documentation

◆ CloneArguments()

void CloneArguments ( )
inline

Loops over all contained boxes and invokes box-function FClone. The monotonic allocator passed in the constructor of this message is passed to FClone. If no allocator was passed in the constructor, this method must not be invoked. This condition is asserted in debug-compilations.

It is the responsibility of the user or creator of a message object to invoke this method and to ensure that objects that are referenced in the stored boxes either survive the lifetime of the methods or are duly cloned.

See also
Manual chapter 1.5 Argument Life-Cycle for details.

Definition at line 132 of file message.hpp.

Here is the call graph for this function:

Member Data Documentation

◆ File

NCString File

The file name that this message relates to.

Definition at line 47 of file message.hpp.

◆ Function

NCString Function

The function/method name that this message relates to.

Definition at line 53 of file message.hpp.

◆ Line

int Line

The line number within File, that this message relates to.

Definition at line 50 of file message.hpp.

◆ monoAllocatorResponsibility

Responsibility monoAllocatorResponsibility
protected

Denotes whether this instance is responsible for deleting the (inherited) monotonic allocator or not.

Definition at line 66 of file message.hpp.

◆ Type

Enum Type

A type identifier, defined with construction by providing an element of arbitrary enumeration type.

Definition at line 59 of file message.hpp.


The documentation for this struct was generated from the following file: