A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
src
core
model
log-macros-disabled.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2014 Andrey Mazo
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Andrey Mazo <ahippo@yandex.com>
19
*/
20
28
#ifndef NS3_LOG_MACROS_DISABLED_H
29
#define NS3_LOG_MACROS_DISABLED_H
30
31
#ifndef NS3_LOG_ENABLE
32
/*
33
Implementation Note:
34
35
std::clog << msg
36
This expression is required for forms like NS_LOG_LOGIC (... << std::endl ...)
37
38
39
ns3::ParameterLogger (std::clog) << msg
40
This expression is required for NS_LOG_FUNCTION (... << vector ...)
41
42
IMO ParameterLogger should work for both cases, but it fails
43
with the error:
44
45
note: in expansion of macro NS_LOG_LOGIC (std::endl...
46
error: no match for operator<< (operand types are ns3::ParameterLogger
47
and <unresolved overloaded function type>)
48
49
note: candidate: template<class T> ns3::ParameterLogger&
50
ns3::ParameterLogger::operator<<(T)
51
note: template argument deduction/substitution failed
52
note: couldn't deduce template parameter T
53
54
Note that std::endl is templated manipulator function, which needs the
55
target stream to resolve it's own template parameters. The compiler
56
should deduce this from the ParameterLogger::operator<< <T> ()
57
implementation, but evidently fails to do so.
58
59
*/
60
61
66
#define NS_LOG_NOOP_INTERNAL(msg) \
67
do \
68
if (false) \
69
{ \
70
std::clog << msg; \
71
} \
72
while (false)
73
74
#define NS_LOG(level, msg) \
75
NS_LOG_NOOP_INTERNAL (msg)
76
77
#define NS_LOG_FUNCTION_NOARGS()
78
83
#define NS_LOG_NOOP_FUNC_INTERNAL(msg) \
84
do \
85
if (false) \
86
{ \
87
ns3::ParameterLogger (std::clog) << msg; \
88
} \
89
while (false)
90
91
#define NS_LOG_FUNCTION(parameters) \
92
NS_LOG_NOOP_FUNC_INTERNAL (parameters)
93
94
#define NS_LOG_UNCOND(msg) \
95
NS_LOG_NOOP_INTERNAL (msg)
96
97
98
#endif
/* !NS3_LOG_ENABLE */
99
100
#endif
/* NS3_LOG_MACROS_DISABLED_H */
Generated on Wed Nov 7 2018 10:01:49 for ns-3 by
1.8.14