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
integer.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2008 INRIA
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
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18
*/
19
#ifndef INTEGER_H
20
#define INTEGER_H
21
22
#include "
attribute-helper.h
"
23
#include "
attribute.h
"
24
25
#include <limits>
26
#include <stdint.h>
27
28
/**
29
* \file
30
* \ingroup attribute_Integer
31
* ns3::IntegerValue attribute value declarations and template implementations.
32
*/
33
34
namespace
ns3
35
{
36
37
// Additional docs for class IntegerValue:
38
/**
39
* Hold a signed integer type
40
*
41
* This class can be used to hold variables of signed integer
42
* type such as int8_t, int16_t, int32_t, int64_t, or,
43
* int, etc.
44
*/
45
ATTRIBUTE_VALUE_DEFINE_WITH_NAME
(int64_t, Integer);
46
ATTRIBUTE_ACCESSOR_DEFINE
(Integer);
47
48
template
<
typename
T>
49
Ptr<const AttributeChecker>
MakeIntegerChecker
();
50
51
/**
52
* Make a checker with a minimum value.
53
*
54
* The minimum value is included in the allowed range.
55
*
56
* \param [in] min The minimum value.
57
* \returns The AttributeChecker.
58
* \see AttributeChecker
59
*/
60
template
<
typename
T>
61
Ptr<const AttributeChecker>
MakeIntegerChecker
(int64_t min);
62
63
/**
64
* Make a checker with a minimum and a maximum value.
65
*
66
* The minimum and maximum values are included in the allowed range.
67
*
68
* \param [in] min The minimum value.
69
* \param [in] max The maximum value.
70
* \returns The AttributeChecker.
71
* \see AttributeChecker
72
*/
73
template
<
typename
T>
74
Ptr<const AttributeChecker>
MakeIntegerChecker
(int64_t min, int64_t max);
75
76
}
// namespace ns3
77
78
/***************************************************************
79
* Implementation of the templates declared above.
80
***************************************************************/
81
82
#include "
type-name.h
"
83
84
namespace
ns3
85
{
86
87
namespace
internal
88
{
89
90
Ptr<const AttributeChecker>
MakeIntegerChecker
(int64_t min, int64_t max, std::string name);
91
92
}
// namespace internal
93
94
template
<
typename
T>
95
Ptr<const AttributeChecker>
96
MakeIntegerChecker
(int64_t min, int64_t max)
97
{
98
return
internal::MakeIntegerChecker
(min, max, TypeNameGet<T>());
99
}
100
101
template
<
typename
T>
102
Ptr<const AttributeChecker>
103
MakeIntegerChecker
(int64_t min)
104
{
105
return
internal::MakeIntegerChecker
(min, std::numeric_limits<T>::max(), TypeNameGet<T>());
106
}
107
108
template
<
typename
T>
109
Ptr<const AttributeChecker>
110
MakeIntegerChecker
()
111
{
112
return
internal::MakeIntegerChecker
(std::numeric_limits<T>::min(),
113
std::numeric_limits<T>::max(),
114
TypeNameGet<T>());
115
}
116
117
}
// namespace ns3
118
119
#endif
/* INTEGER_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:
ptr.h:77
ns3::MakeIntegerChecker
Ptr< const AttributeChecker > MakeIntegerChecker()
Definition:
integer.h:110
ns3::internal::MakeIntegerChecker
Ptr< const AttributeChecker > MakeIntegerChecker(int64_t min, int64_t max, std::string name)
Make an Integer attribute checker with embedded numeric type name.
Definition:
integer.cc:52
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:203
ATTRIBUTE_ACCESSOR_DEFINE
#define ATTRIBUTE_ACCESSOR_DEFINE(type)
Define the attribute accessor functions MakeTypeAccessor for class type.
Definition:
attribute-helper.h:174
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
type-name.h
ns3::TypeNameGet() function declarations.
src
core
model
integer.h
Generated on Tue May 28 2024 23:34:32 for ns-3 by
1.9.6