src/core/model/integer.h
author Peter D. Barnes, Jr. <barnes26@llnl.gov>
Wed, 07 Jan 2015 15:43:53 -0800
changeset 11136 03bf8fa63bda
parent 11036 1e03af4311bd
permissions -rw-r--r--
[Doxygen] Files implementing attributes.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2581
31d4960dc31b add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2486
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
31d4960dc31b add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2486
diff changeset
     2
/*
31d4960dc31b add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2486
diff changeset
     3
 * Copyright (c) 2008 INRIA
31d4960dc31b add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2486
diff changeset
     4
 *
31d4960dc31b add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2486
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
31d4960dc31b add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2486
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
31d4960dc31b add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2486
diff changeset
     7
 * published by the Free Software Foundation;
31d4960dc31b add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2486
diff changeset
     8
 *
31d4960dc31b add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2486
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
31d4960dc31b add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2486
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31d4960dc31b add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2486
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
31d4960dc31b add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2486
diff changeset
    12
 * GNU General Public License for more details.
31d4960dc31b add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2486
diff changeset
    13
 *
31d4960dc31b add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2486
diff changeset
    14
 * You should have received a copy of the GNU General Public License
31d4960dc31b add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2486
diff changeset
    15
 * along with this program; if not, write to the Free Software
31d4960dc31b add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2486
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
31d4960dc31b add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2486
diff changeset
    17
 *
31d4960dc31b add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2486
diff changeset
    18
 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
31d4960dc31b add missing copyright statements.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2486
diff changeset
    19
 */
2439
4a0b22a3f5fa UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2438
diff changeset
    20
#ifndef INTEGER_H
4a0b22a3f5fa UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2438
diff changeset
    21
#define INTEGER_H
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    22
2438
e2ac9f9aeeb9 value.h -> attribute.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2437
diff changeset
    23
#include "attribute.h"
2451
8979f07befd5 value-helper.h -> attribute-helper.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2439
diff changeset
    24
#include "attribute-helper.h"
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    25
#include <stdint.h>
3365
6409d2460601 bug 245: build failure with gcc 4.3.x
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3182
diff changeset
    26
#include <limits>
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    27
11136
03bf8fa63bda [Doxygen] Files implementing attributes.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 11036
diff changeset
    28
/**
03bf8fa63bda [Doxygen] Files implementing attributes.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 11036
diff changeset
    29
 * \file
03bf8fa63bda [Doxygen] Files implementing attributes.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 11036
diff changeset
    30
 * \ingroup attribute_Integer
03bf8fa63bda [Doxygen] Files implementing attributes.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 11036
diff changeset
    31
 * Integer attribute value declarations and template implementations.
03bf8fa63bda [Doxygen] Files implementing attributes.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 11036
diff changeset
    32
 */
03bf8fa63bda [Doxygen] Files implementing attributes.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 11036
diff changeset
    33
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    34
namespace ns3 {
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    35
11136
03bf8fa63bda [Doxygen] Files implementing attributes.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 11036
diff changeset
    36
//  Additional docs for class IntegerValue:
2584
5011c132ed6c doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2581
diff changeset
    37
/**
11036
1e03af4311bd [Doxygen] Attribute implementations.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 7256
diff changeset
    38
 * Hold a signed integer type
2928
554e10cdc747 add doxygen anchors to avoid warnings.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2599
diff changeset
    39
 *
2584
5011c132ed6c doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2581
diff changeset
    40
 * This class can be used to hold variables of signed integer
5011c132ed6c doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2581
diff changeset
    41
 * type such as int8_t, int16_t, int32_t, int64_t, or,
5011c132ed6c doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2581
diff changeset
    42
 * int, etc.
5011c132ed6c doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2581
diff changeset
    43
 */
7256
b04ba6772f8c rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents: 6821
diff changeset
    44
ATTRIBUTE_VALUE_DEFINE_WITH_NAME (int64_t, Integer);
b04ba6772f8c rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents: 6821
diff changeset
    45
ATTRIBUTE_ACCESSOR_DEFINE (Integer);
2427
9245ec163111 split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2424
diff changeset
    46
9245ec163111 split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2424
diff changeset
    47
template <typename T>
2439
4a0b22a3f5fa UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2438
diff changeset
    48
Ptr<const AttributeChecker> MakeIntegerChecker (void);
2427
9245ec163111 split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2424
diff changeset
    49
11036
1e03af4311bd [Doxygen] Attribute implementations.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 7256
diff changeset
    50
/**
1e03af4311bd [Doxygen] Attribute implementations.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 7256
diff changeset
    51
 * Make a checker with a minimum value.
1e03af4311bd [Doxygen] Attribute implementations.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 7256
diff changeset
    52
 *
1e03af4311bd [Doxygen] Attribute implementations.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 7256
diff changeset
    53
 * The minimum value is included in the allowed range.
1e03af4311bd [Doxygen] Attribute implementations.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 7256
diff changeset
    54
 *
1e03af4311bd [Doxygen] Attribute implementations.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 7256
diff changeset
    55
 * \param [in] min The minimum value.
1e03af4311bd [Doxygen] Attribute implementations.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 7256
diff changeset
    56
 * \returns The AttributeChecker.
1e03af4311bd [Doxygen] Attribute implementations.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 7256
diff changeset
    57
 * \see AttributeChecker
1e03af4311bd [Doxygen] Attribute implementations.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 7256
diff changeset
    58
 */
2486
aeee361ade33 add extra checker construction function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2454
diff changeset
    59
template <typename T>
aeee361ade33 add extra checker construction function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2454
diff changeset
    60
Ptr<const AttributeChecker> MakeIntegerChecker (int64_t min);
aeee361ade33 add extra checker construction function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2454
diff changeset
    61
11036
1e03af4311bd [Doxygen] Attribute implementations.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 7256
diff changeset
    62
/**
1e03af4311bd [Doxygen] Attribute implementations.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 7256
diff changeset
    63
 * Make a checker with a minimum and a maximum value.
1e03af4311bd [Doxygen] Attribute implementations.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 7256
diff changeset
    64
 *
1e03af4311bd [Doxygen] Attribute implementations.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 7256
diff changeset
    65
 * The minimum and maximum values are included in the allowed range.
1e03af4311bd [Doxygen] Attribute implementations.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 7256
diff changeset
    66
 *
1e03af4311bd [Doxygen] Attribute implementations.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 7256
diff changeset
    67
 * \param [in] min The minimum value.
1e03af4311bd [Doxygen] Attribute implementations.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 7256
diff changeset
    68
 * \param [in] max The maximum value.
1e03af4311bd [Doxygen] Attribute implementations.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 7256
diff changeset
    69
 * \returns The AttributeChecker.
1e03af4311bd [Doxygen] Attribute implementations.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 7256
diff changeset
    70
 * \see AttributeChecker
1e03af4311bd [Doxygen] Attribute implementations.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 7256
diff changeset
    71
 */
2599
fcc1728eb669 Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2584
diff changeset
    72
template <typename T>
2439
4a0b22a3f5fa UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2438
diff changeset
    73
Ptr<const AttributeChecker> MakeIntegerChecker (int64_t min, int64_t max);
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    74
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    75
} // namespace ns3
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    76
11136
03bf8fa63bda [Doxygen] Files implementing attributes.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 11036
diff changeset
    77
03bf8fa63bda [Doxygen] Files implementing attributes.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 11036
diff changeset
    78
/***************************************************************
03bf8fa63bda [Doxygen] Files implementing attributes.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 11036
diff changeset
    79
 *  Implementation of the templates declared above.
03bf8fa63bda [Doxygen] Files implementing attributes.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 11036
diff changeset
    80
 ***************************************************************/
03bf8fa63bda [Doxygen] Files implementing attributes.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 11036
diff changeset
    81
2599
fcc1728eb669 Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2584
diff changeset
    82
#include "type-name.h"
fcc1728eb669 Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2584
diff changeset
    83
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    84
namespace ns3 {
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    85
2599
fcc1728eb669 Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2584
diff changeset
    86
namespace internal {
fcc1728eb669 Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2584
diff changeset
    87
fcc1728eb669 Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2584
diff changeset
    88
Ptr<const AttributeChecker> MakeIntegerChecker (int64_t min, int64_t max, std::string name);
fcc1728eb669 Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2584
diff changeset
    89
fcc1728eb669 Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2584
diff changeset
    90
} // internal
fcc1728eb669 Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2584
diff changeset
    91
fcc1728eb669 Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2584
diff changeset
    92
template <typename T>
fcc1728eb669 Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2584
diff changeset
    93
Ptr<const AttributeChecker>
fcc1728eb669 Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2584
diff changeset
    94
MakeIntegerChecker (int64_t min, int64_t max)
fcc1728eb669 Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2584
diff changeset
    95
{
fcc1728eb669 Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2584
diff changeset
    96
  return internal::MakeIntegerChecker (min,
fcc1728eb669 Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2584
diff changeset
    97
                                       max, TypeNameGet<T> ());
fcc1728eb669 Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2584
diff changeset
    98
}
fcc1728eb669 Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2584
diff changeset
    99
2427
9245ec163111 split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2424
diff changeset
   100
template <typename T>
2436
23415bac7eaf Accessor -> AttributeAccessor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2435
diff changeset
   101
Ptr<const AttributeChecker>
2486
aeee361ade33 add extra checker construction function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2454
diff changeset
   102
MakeIntegerChecker (int64_t min)
aeee361ade33 add extra checker construction function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2454
diff changeset
   103
{
2599
fcc1728eb669 Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2584
diff changeset
   104
  return internal::MakeIntegerChecker (min,
fcc1728eb669 Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2584
diff changeset
   105
                                       std::numeric_limits<T>::max (),
fcc1728eb669 Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2584
diff changeset
   106
                                       TypeNameGet<T> ());
2486
aeee361ade33 add extra checker construction function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2454
diff changeset
   107
}
aeee361ade33 add extra checker construction function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2454
diff changeset
   108
aeee361ade33 add extra checker construction function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2454
diff changeset
   109
template <typename T>
aeee361ade33 add extra checker construction function
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2454
diff changeset
   110
Ptr<const AttributeChecker>
2439
4a0b22a3f5fa UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2438
diff changeset
   111
MakeIntegerChecker (void)
2427
9245ec163111 split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2424
diff changeset
   112
{
2599
fcc1728eb669 Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2584
diff changeset
   113
  return internal::MakeIntegerChecker (std::numeric_limits<T>::min (),
fcc1728eb669 Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2584
diff changeset
   114
                                       std::numeric_limits<T>::max (),
fcc1728eb669 Add sufficient information to AttributeChecker to generate nice-looking doxygen documentation.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2584
diff changeset
   115
                                       TypeNameGet<T> ());
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   116
}
2427
9245ec163111 split checker from ParamSpec.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2424
diff changeset
   117
2375
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   118
} // namespace ns3
6f8733409b3b add back IntValue support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   119
2439
4a0b22a3f5fa UintValue -> Uinteger, IntValue -> Integer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2438
diff changeset
   120
#endif /* INTEGER_H */