Files
unison/src/core/integer.h

98 lines
2.5 KiB
C
Raw Normal View History

2008-03-10 00:38:48 +01:00
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef INTEGER_H
#define INTEGER_H
2008-02-04 22:18:07 +01:00
2008-02-20 21:45:42 +01:00
#include "attribute.h"
2008-02-21 18:54:02 +01:00
#include "attribute-helper.h"
2008-02-04 22:18:07 +01:00
#include <stdint.h>
2008-07-02 03:16:36 -07:00
#include <limits>
2008-02-04 22:18:07 +01:00
namespace ns3 {
2008-03-10 14:05:26 -07:00
/**
2008-05-29 23:24:10 -07:00
* \ingroup attribute
* \class ns3::IntegerValue
2008-03-10 14:05:26 -07:00
* \brief Hold a signed integer type
*
2008-04-09 13:03:58 -07:00
* \anchor int8_t
* \anchor int16_t
* \anchor int32_t
* \anchor int64_t
*
2008-03-10 14:05:26 -07:00
* This class can be used to hold variables of signed integer
* type such as int8_t, int16_t, int32_t, int64_t, or,
* int, etc.
*/
2008-02-04 22:18:07 +01:00
ATTRIBUTE_VALUE_DEFINE_WITH_NAME(int64_t, Integer);
ATTRIBUTE_ACCESSOR_DEFINE(Integer);
2008-02-18 00:18:45 +01:00
template <typename T>
Ptr<const AttributeChecker> MakeIntegerChecker (void);
2008-02-18 00:18:45 +01:00
template <typename T>
Ptr<const AttributeChecker> MakeIntegerChecker (int64_t min);
template <typename T>
Ptr<const AttributeChecker> MakeIntegerChecker (int64_t min, int64_t max);
2008-02-04 22:18:07 +01:00
} // namespace ns3
#include "type-name.h"
2008-02-04 22:18:07 +01:00
namespace ns3 {
namespace internal {
Ptr<const AttributeChecker> MakeIntegerChecker (int64_t min, int64_t max, std::string name);
} // internal
template <typename T>
Ptr<const AttributeChecker>
MakeIntegerChecker (int64_t min, int64_t max)
{
return internal::MakeIntegerChecker (min,
max, TypeNameGet<T> ());
}
template <typename T>
Ptr<const AttributeChecker>
MakeIntegerChecker (int64_t min)
{
return internal::MakeIntegerChecker (min,
std::numeric_limits<T>::max (),
TypeNameGet<T> ());
}
2008-02-18 00:18:45 +01:00
template <typename T>
2008-02-20 20:57:59 +01:00
Ptr<const AttributeChecker>
MakeIntegerChecker (void)
2008-02-04 22:18:07 +01:00
{
return internal::MakeIntegerChecker (std::numeric_limits<T>::min (),
std::numeric_limits<T>::max (),
TypeNameGet<T> ());
2008-02-04 22:18:07 +01:00
}
} // namespace ns3
#endif /* INTEGER_H */