Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
StandaloneTraceMessage.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2022 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* StandaloneTraceMessage.h (C) 2000-2021 */
9/* */
10/* Message de trace indépendant du 'ITraceMng'. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCCORE_TRACE_STANDALONETRACEMESSAGE_H
13#define ARCCORE_TRACE_STANDALONETRACEMESSAGE_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arccore/trace/TraceMessage.h"
18
19#include <sstream>
20
21/*---------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23
24namespace Arccore
25{
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
32class ARCCORE_TRACE_EXPORT StandaloneTraceMessage
33{
34 public:
35 StandaloneTraceMessage() = default;
36 StandaloneTraceMessage(Trace::eMessageType,int level = TraceMessage::DEFAULT_LEVEL);
38 StandaloneTraceMessage& operator=(const StandaloneTraceMessage& from);
39
40 public:
41 std::ostream& file() const { return m_stream; }
42 Trace::eMessageType type() const { return m_type; }
43 int level() const { return m_level; }
44 int color() const { return m_color; }
45 public:
46 std::string value() const { return m_stream.str(); }
47 private:
49 mutable std::ostringstream m_stream;
51 Trace::eMessageType m_type = Trace::Normal;
53 int m_level = TraceMessage::DEFAULT_LEVEL;
54 public:
56 mutable int m_color = 0;
57};
58
59/*---------------------------------------------------------------------------*/
60/*---------------------------------------------------------------------------*/
61
62inline const StandaloneTraceMessage&
63operator<<(const StandaloneTraceMessage& o,const Trace::Color& c)
64{
65 o.m_color = c.m_color;
66 return o;
67}
68
69template<class T> inline const StandaloneTraceMessage&
70operator<<(const StandaloneTraceMessage& o,const T& v)
71{
72 o.file() << v;
73 return o;
74}
75
76/*---------------------------------------------------------------------------*/
77/*---------------------------------------------------------------------------*/
78
79} // End namespace Arccore
80
81/*---------------------------------------------------------------------------*/
82/*---------------------------------------------------------------------------*/
83
84#endif
85
Gestion d'un message autonome.
std::ostringstream m_stream
Flot sur lequel le message est envoyé
Positionne une couleur pour le message.
eMessageType
Flot sur lequel on envoie les messages.
Espace de nom de Arccore.
Definition ArcaneTypes.h:24