A Discrete-Event Network Simulator
API
type-name.h
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2007 Georgia Tech Research Corporation
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 */
19
20#ifndef TYPE_NAME_H
21#define TYPE_NAME_H
22
23#include "fatal-error.h"
24
25#include <string>
26
33namespace ns3 {
34
45template <typename T>
46std::string TypeNameGet (void)
47{
48 NS_FATAL_ERROR ("Type name not defined.");
49 return "unknown";
50}
51
59#define TYPENAMEGET_DEFINE(T) \
60 template <> \
61 inline std::string TypeNameGet<T> (void) \
62 { \
63 return #T; \
64 }
65
83TYPENAMEGET_DEFINE (long double);
86} // namespace ns3
87
88#endif /* TYPE_NAME_H */
NS_FATAL_x macro definitions.
std::string TypeNameGet(void)
Type name strings for AttributeValue types.
Definition: type-name.h:46
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
TYPENAMEGET_DEFINE(Time)
ns3::TypeNameGet<Time>() specialization.
Every class exported by the ns3 library is enclosed in the ns3 namespace.