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
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7
*/
8
#ifndef INTEGER_H
9
#define INTEGER_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_Integer
20
* ns3::IntegerValue attribute value declarations and template implementations.
21
*/
22
23
namespace
ns3
24
{
25
26
// Additional docs for class IntegerValue:
27
/**
28
* Hold a signed integer type
29
*
30
* This class can be used to hold variables of signed integer
31
* type such as int8_t, int16_t, int32_t, int64_t, or,
32
* int, etc.
33
*/
34
ATTRIBUTE_VALUE_DEFINE_WITH_NAME
(int64_t, Integer);
35
ATTRIBUTE_ACCESSOR_DEFINE
(Integer);
36
37
template
<
typename
T>
38
Ptr<const AttributeChecker>
MakeIntegerChecker
();
39
40
/**
41
* Make a checker with a minimum value.
42
*
43
* The minimum value is included in the allowed range.
44
*
45
* \param [in] min The minimum value.
46
* \returns The AttributeChecker.
47
* \see AttributeChecker
48
*/
49
template
<
typename
T>
50
Ptr<const AttributeChecker>
MakeIntegerChecker
(int64_t min);
51
52
/**
53
* Make a checker with a minimum and a maximum value.
54
*
55
* The minimum and maximum values are included in the allowed range.
56
*
57
* \param [in] min The minimum value.
58
* \param [in] max The maximum value.
59
* \returns The AttributeChecker.
60
* \see AttributeChecker
61
*/
62
template
<
typename
T>
63
Ptr<const AttributeChecker>
MakeIntegerChecker
(int64_t min, int64_t max);
64
65
}
// namespace ns3
66
67
/***************************************************************
68
* Implementation of the templates declared above.
69
***************************************************************/
70
71
#include "
type-name.h
"
72
73
namespace
ns3
74
{
75
76
namespace
internal
77
{
78
79
Ptr<const AttributeChecker>
MakeIntegerChecker
(int64_t min, int64_t max, std::string name);
80
81
}
// namespace internal
82
83
template
<
typename
T>
84
Ptr<const AttributeChecker>
85
MakeIntegerChecker
(int64_t min, int64_t max)
86
{
87
return
internal::MakeIntegerChecker
(min, max,
TypeNameGet<T>
());
88
}
89
90
template
<
typename
T>
91
Ptr<const AttributeChecker>
92
MakeIntegerChecker
(int64_t min)
93
{
94
return
internal::MakeIntegerChecker
(min, std::numeric_limits<T>::max(),
TypeNameGet<T>
());
95
}
96
97
template
<
typename
T>
98
Ptr<const AttributeChecker>
99
MakeIntegerChecker
()
100
{
101
return
internal::MakeIntegerChecker
(std::numeric_limits<T>::min(),
102
std::numeric_limits<T>::max(),
103
TypeNameGet<T>
());
104
}
105
106
}
// namespace ns3
107
108
#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
mpi-test-fixtures.h:37
ns3::MakeIntegerChecker
Ptr< const AttributeChecker > MakeIntegerChecker()
Definition
integer.h:99
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:41
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
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 Fri Oct 11 2024 18:20:40 for ns-3 by
1.11.0