A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
integer.h
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2008 INRIA
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 #ifndef INTEGER_H
21 #define INTEGER_H
22 
23 #include "attribute.h"
24 #include "attribute-helper.h"
25 #include <stdint.h>
26 #include <limits>
27 
28 namespace ns3 {
29 
45 ATTRIBUTE_VALUE_DEFINE_WITH_NAME (int64_t, Integer);
47 
48 template <typename T>
49 Ptr<const AttributeChecker> MakeIntegerChecker (void);
50 
51 template <typename T>
52 Ptr<const AttributeChecker> MakeIntegerChecker (int64_t min);
53 
54 template <typename T>
55 Ptr<const AttributeChecker> MakeIntegerChecker (int64_t min, int64_t max);
56 
57 } // namespace ns3
58 
59 #include "type-name.h"
60 
61 namespace ns3 {
62 
63 namespace internal {
64 
65 Ptr<const AttributeChecker> MakeIntegerChecker (int64_t min, int64_t max, std::string name);
66 
67 } // internal
68 
69 template <typename T>
70 Ptr<const AttributeChecker>
71 MakeIntegerChecker (int64_t min, int64_t max)
72 {
73  return internal::MakeIntegerChecker (min,
74  max, TypeNameGet<T> ());
75 }
76 
77 template <typename T>
78 Ptr<const AttributeChecker>
79 MakeIntegerChecker (int64_t min)
80 {
81  return internal::MakeIntegerChecker (min,
82  std::numeric_limits<T>::max (),
83  TypeNameGet<T> ());
84 }
85 
86 template <typename T>
87 Ptr<const AttributeChecker>
88 MakeIntegerChecker (void)
89 {
90  return internal::MakeIntegerChecker (std::numeric_limits<T>::min (),
91  std::numeric_limits<T>::max (),
92  TypeNameGet<T> ());
93 }
94 
95 } // namespace ns3
96 
97 #endif /* INTEGER_H */
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:59
#define ATTRIBUTE_ACCESSOR_DEFINE(type)