A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
uinteger.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 UINTEGER_H
21 #define UINTEGER_H
22 
23 #include "attribute.h"
24 #include "attribute-helper.h"
25 #include <stdint.h>
26 #include <limits>
27 
28 namespace ns3 {
29 
46 ATTRIBUTE_VALUE_DEFINE_WITH_NAME (uint64_t, Uinteger);
47 ATTRIBUTE_ACCESSOR_DEFINE (Uinteger);
48 
49 template <typename T>
50 Ptr<const AttributeChecker> MakeUintegerChecker (void);
51 
52 template <typename T>
53 Ptr<const AttributeChecker> MakeUintegerChecker (uint64_t min);
54 
55 template <typename T>
56 Ptr<const AttributeChecker> MakeUintegerChecker (uint64_t min, uint64_t max);
57 
58 } // namespace ns3
59 
60 #include "type-name.h"
61 
62 namespace ns3 {
63 
64 namespace internal {
65 
66 Ptr<const AttributeChecker> MakeUintegerChecker (uint64_t min, uint64_t max, std::string name);
67 
68 } // namespace internal
69 
70 
71 template <typename T>
72 Ptr<const AttributeChecker> MakeUintegerChecker (void)
73 {
74  return internal::MakeUintegerChecker (std::numeric_limits<T>::min (),
75  std::numeric_limits<T>::max (),
76  TypeNameGet<T> ());
77 }
78 
79 template <typename T>
80 Ptr<const AttributeChecker> MakeUintegerChecker (uint64_t min)
81 {
82  return internal::MakeUintegerChecker (min,
83  std::numeric_limits<T>::max (),
84  TypeNameGet<T> ());
85 }
86 
87 template <typename T>
88 Ptr<const AttributeChecker> MakeUintegerChecker (uint64_t min, uint64_t max)
89 {
90  return internal::MakeUintegerChecker (min,
91  max,
92  TypeNameGet<T> ());
93 }
94 
95 } // namespace ns3
96 
97 #endif /* UINTEGER_H */
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:59
#define ATTRIBUTE_ACCESSOR_DEFINE(type)