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
double.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2008 INRIA
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7
*/
8
#ifndef NS_DOUBLE_H
9
#define NS_DOUBLE_H
10
11
#include "
attribute-helper.h
"
12
#include "
attribute.h
"
13
14
#include <limits>
15
#include <stdint.h>
16
17
/**
18
* \file
19
* \ingroup attribute_Double
20
* ns3::DoubleValue attribute value declarations and template implementations.
21
*/
22
23
namespace
ns3
24
{
25
26
// Additional docs for class DoubleValue:
27
/**
28
* This class can be used to hold variables of floating point type
29
* such as 'double' or 'float'. The internal format is 'double'.
30
*/
31
ATTRIBUTE_VALUE_DEFINE_WITH_NAME
(
double
, Double);
32
ATTRIBUTE_ACCESSOR_DEFINE
(Double);
33
34
template
<
typename
T>
35
Ptr<const AttributeChecker>
MakeDoubleChecker
();
36
37
/**
38
* Make a checker with a minimum value.
39
*
40
* The minimum value is included in the allowed range.
41
*
42
* \param [in] min The minimum value.
43
* \returns The AttributeChecker.
44
* \see AttributeChecker
45
*/
46
template
<
typename
T>
47
Ptr<const AttributeChecker>
MakeDoubleChecker
(
double
min);
48
49
/**
50
* Make a checker with a minimum and a maximum value.
51
*
52
* The minimum and maximum values are included in the allowed range.
53
*
54
* \param [in] min The minimum value.
55
* \param [in] max The maximum value.
56
* \returns The AttributeChecker.
57
* \see AttributeChecker
58
*/
59
template
<
typename
T>
60
Ptr<const AttributeChecker>
MakeDoubleChecker
(
double
min,
double
max);
61
62
}
// namespace ns3
63
64
/***************************************************************
65
* Implementation of the templates declared above.
66
***************************************************************/
67
68
#include "
type-name.h
"
69
70
namespace
ns3
71
{
72
73
namespace
internal
74
{
75
76
Ptr<const AttributeChecker>
MakeDoubleChecker
(
double
min,
double
max, std::string name);
77
78
}
// namespace internal
79
80
template
<
typename
T>
81
Ptr<const AttributeChecker>
82
MakeDoubleChecker
()
83
{
84
return
internal::MakeDoubleChecker
(-std::numeric_limits<T>::max(),
85
std::numeric_limits<T>::max(),
86
TypeNameGet<T>
());
87
}
88
89
template
<
typename
T>
90
Ptr<const AttributeChecker>
91
MakeDoubleChecker
(
double
min)
92
{
93
return
internal::MakeDoubleChecker
(min, std::numeric_limits<T>::max(),
TypeNameGet<T>
());
94
}
95
96
template
<
typename
T>
97
Ptr<const AttributeChecker>
98
MakeDoubleChecker
(
double
min,
double
max)
99
{
100
return
internal::MakeDoubleChecker
(min, max,
TypeNameGet<T>
());
101
}
102
103
}
// namespace ns3
104
105
#endif
/* NS_DOUBLE_H */
attribute-helper.h
Attribute helper (ATTRIBUTE_ )macros definition.
attribute.h
ns3::AttributeValue, ns3::AttributeAccessor and ns3::AttributeChecker declarations.
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ATTRIBUTE_VALUE_DEFINE_WITH_NAME
#define ATTRIBUTE_VALUE_DEFINE_WITH_NAME(type, name)
Declare the attribute value class nameValue for underlying class type .
Definition
attribute-helper.h:192
ATTRIBUTE_ACCESSOR_DEFINE
#define ATTRIBUTE_ACCESSOR_DEFINE(type)
Define the attribute accessor functions MakeTypeAccessor for class type .
Definition
attribute-helper.h:163
ns3::TypeNameGet
std::string TypeNameGet()
Type name strings for AttributeValue types.
Definition
type-name.h:36
ns3::internal::MakeDoubleChecker
Ptr< const AttributeChecker > MakeDoubleChecker(double min, double max, std::string name)
Make a Double attribute checker with embedded numeric type name.
Definition
double.cc:42
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::MakeDoubleChecker
Ptr< const AttributeChecker > MakeDoubleChecker()
Definition
double.h:82
type-name.h
ns3::TypeNameGet() function declarations.
src
core
model
double.h
Generated on Fri Nov 8 2024 13:58:59 for ns-3 by
1.11.0