A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
type-name.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2007 Georgia Tech Research Corporation
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
*/
18
19
#ifndef TYPE_NAME_H
20
#define TYPE_NAME_H
21
22
#include "
fatal-error.h
"
23
24
#include <string>
25
32
namespace
ns3
33
{
34
45
template
<
typename
T>
46
std::string
47
TypeNameGet
()
48
{
49
NS_FATAL_ERROR
(
"Type name not defined."
);
50
return
"unknown"
;
51
}
52
60
#define TYPENAMEGET_DEFINE(T) \
61
template <> \
62
inline std::string TypeNameGet<T>() \
63
{ \
64
return #T; \
65
}
66
73
TYPENAMEGET_DEFINE
(
bool
);
74
TYPENAMEGET_DEFINE
(int8_t);
75
TYPENAMEGET_DEFINE
(int16_t);
76
TYPENAMEGET_DEFINE
(int32_t);
77
TYPENAMEGET_DEFINE
(int64_t);
78
TYPENAMEGET_DEFINE
(uint8_t);
79
TYPENAMEGET_DEFINE
(uint16_t);
80
TYPENAMEGET_DEFINE
(uint32_t);
81
TYPENAMEGET_DEFINE
(uint64_t);
82
TYPENAMEGET_DEFINE
(
float
);
83
TYPENAMEGET_DEFINE
(
double
);
84
TYPENAMEGET_DEFINE
(
long
double
);
87
}
// namespace ns3
88
89
#endif
/* TYPE_NAME_H */
fatal-error.h
NS_FATAL_x macro definitions.
ns3::TypeNameGet
std::string TypeNameGet()
Type name strings for AttributeValue types.
Definition:
type-name.h:47
NS_FATAL_ERROR
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition:
fatal-error.h:179
ns3::TYPENAMEGET_DEFINE
TYPENAMEGET_DEFINE(Time)
ns3::TypeNameGet<Time>() specialization.
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
core
model
type-name.h
Generated on Sun Mar 3 2024 17:10:56 for ns-3 by
1.9.1