A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
type-name.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2007 Georgia Tech Research Corporation
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
*/
7
8
#ifndef TYPE_NAME_H
9
#define TYPE_NAME_H
10
11
#include "
fatal-error.h
"
12
13
#include <string>
14
15
/**
16
* @file
17
* @ingroup attributeimpl
18
* ns3::TypeNameGet() function declarations.
19
*/
20
21
namespace
ns3
22
{
23
24
/**
25
* @ingroup attributeimpl
26
*
27
* Type name strings for AttributeValue types.
28
* Custom classes should add a template specialization of this function
29
* using the macro \c TYPENAMEGET_DEFINE(T).
30
*
31
* @tparam T \explicit The type.
32
* @returns The type name as a string.
33
*/
34
template
<
typename
T>
35
std::string
36
TypeNameGet
()
37
{
38
NS_FATAL_ERROR
(
"Type name not defined."
);
39
return
"unknown"
;
40
}
41
42
/**
43
* @ingroup attributeimpl
44
*
45
* Macro that defines a template specialization for \c TypeNameGet<T>() .
46
*
47
* @param T The type.
48
*/
49
#define TYPENAMEGET_DEFINE(T) \
50
template <> \
51
inline std::string TypeNameGet<T>() \
52
{ \
53
return #T; \
54
}
55
56
/**
57
* @ingroup attributeimpl
58
* ns3::TypeNameGet() specialization for numeric types.
59
* @returns The numeric type name as a string.
60
* @{
61
*/
62
TYPENAMEGET_DEFINE
(
bool
);
63
TYPENAMEGET_DEFINE
(
int8_t
);
64
TYPENAMEGET_DEFINE
(int16_t);
65
TYPENAMEGET_DEFINE
(
int32_t
);
66
TYPENAMEGET_DEFINE
(int64_t);
67
TYPENAMEGET_DEFINE
(uint8_t);
68
TYPENAMEGET_DEFINE
(uint16_t);
69
TYPENAMEGET_DEFINE
(
uint32_t
);
70
TYPENAMEGET_DEFINE
(uint64_t);
71
TYPENAMEGET_DEFINE
(
float
);
72
TYPENAMEGET_DEFINE
(
double
);
73
TYPENAMEGET_DEFINE
(
long
double
);
74
/** @} */
75
76
}
// namespace ns3
77
78
#endif
/* TYPE_NAME_H */
int32_t
int8_t
uint32_t
fatal-error.h
NS_FATAL_x macro definitions.
TYPENAMEGET_DEFINE
#define TYPENAMEGET_DEFINE(T)
Macro that defines a template specialization for TypeNameGet<T>() .
Definition
type-name.h:49
ns3::TypeNameGet
std::string TypeNameGet()
Type name strings for AttributeValue types.
Definition
type-name.h:36
NS_FATAL_ERROR
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition
fatal-error.h:168
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
core
model
type-name.h
Generated on Fri Dec 13 2024 18:20:38 for ns-3 by
1.11.0