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
uinteger.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 UINTEGER_H
9
#define UINTEGER_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_Uinteger
20
* ns3::UintegerValue attribute value declarations and template implementations.
21
*/
22
23
namespace
ns3
24
{
25
26
// Additional docs for class UintegerValue:
27
/**
28
* Hold an unsigned integer type.
29
*
30
* This class can be used to hold variables of unsigned integer
31
* type such as uint8_t, uint16_t, uint32_t, uint64_t, or,
32
* unsigned int, etc.
33
*/
34
ATTRIBUTE_VALUE_DEFINE_WITH_NAME
(uint64_t, Uinteger);
35
ATTRIBUTE_ACCESSOR_DEFINE
(Uinteger);
36
37
template
<
typename
T>
38
Ptr<const AttributeChecker>
MakeUintegerChecker
();
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>
MakeUintegerChecker
(uint64_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>
MakeUintegerChecker
(uint64_t min, uint64_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>
MakeUintegerChecker
(uint64_t min, uint64_t max, std::string name);
80
81
}
// namespace internal
82
83
template
<
typename
T>
84
Ptr<const AttributeChecker>
85
MakeUintegerChecker
()
86
{
87
return
internal::MakeUintegerChecker
(std::numeric_limits<T>::min(),
88
std::numeric_limits<T>::max(),
89
TypeNameGet<T>
());
90
}
91
92
template
<
typename
T>
93
Ptr<const AttributeChecker>
94
MakeUintegerChecker
(uint64_t min)
95
{
96
return
internal::MakeUintegerChecker
(min, std::numeric_limits<T>::max(),
TypeNameGet<T>
());
97
}
98
99
template
<
typename
T>
100
Ptr<const AttributeChecker>
101
MakeUintegerChecker
(uint64_t min, uint64_t max)
102
{
103
return
internal::MakeUintegerChecker
(min, max,
TypeNameGet<T>
());
104
}
105
106
}
// namespace ns3
107
108
#endif
/* UINTEGER_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::MakeUintegerChecker
Ptr< const AttributeChecker > MakeUintegerChecker()
Definition
uinteger.h:85
ns3::internal::MakeUintegerChecker
Ptr< const AttributeChecker > MakeUintegerChecker(uint64_t min, uint64_t max, std::string name)
Make an Uinteger attribute checker with embedded numeric type name.
Definition
uinteger.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
uinteger.h
Generated on Sun Oct 13 2024 18:21:13 for ns-3 by
1.11.0