replace UINT_MAX by numeric limits max()
This commit is contained in:
parent
3d68769503
commit
6abbb06ff6
@ -25,29 +25,25 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef RESTRICTION_H_
|
#ifndef RESTRICTION_H
|
||||||
#define RESTRICTION_H_
|
#define RESTRICTION_H
|
||||||
|
|
||||||
#include "../typedefs.h"
|
#include "../typedefs.h"
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
struct TurnRestriction {
|
struct TurnRestriction
|
||||||
|
{
|
||||||
NodeID viaNode;
|
NodeID viaNode;
|
||||||
NodeID fromNode;
|
NodeID fromNode;
|
||||||
NodeID toNode;
|
NodeID toNode;
|
||||||
struct Bits { //mostly unused
|
struct Bits
|
||||||
|
{ // mostly unused
|
||||||
Bits()
|
Bits()
|
||||||
:
|
: isOnly(false), unused1(false), unused2(false), unused3(false), unused4(false),
|
||||||
isOnly(false),
|
unused5(false), unused6(false), unused7(false)
|
||||||
unused1(false),
|
{
|
||||||
unused2(false),
|
}
|
||||||
unused3(false),
|
|
||||||
unused4(false),
|
|
||||||
unused5(false),
|
|
||||||
unused6(false),
|
|
||||||
unused7(false)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
bool isOnly : 1;
|
bool isOnly : 1;
|
||||||
bool unused1 : 1;
|
bool unused1 : 1;
|
||||||
@ -59,91 +55,72 @@ struct TurnRestriction {
|
|||||||
bool unused7 : 1;
|
bool unused7 : 1;
|
||||||
} flags;
|
} flags;
|
||||||
|
|
||||||
explicit TurnRestriction(NodeID viaNode) :
|
explicit TurnRestriction(NodeID viaNode)
|
||||||
viaNode(viaNode),
|
: viaNode(viaNode), fromNode(std::numeric_limits<unsigned>::max()),
|
||||||
fromNode(std::numeric_limits<unsigned>::max()),
|
toNode(std::numeric_limits<unsigned>::max())
|
||||||
toNode(std::numeric_limits<unsigned>::max()) {
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit TurnRestriction(const bool isOnly = false) :
|
explicit TurnRestriction(const bool isOnly = false)
|
||||||
viaNode(UINT_MAX),
|
: viaNode(std::numeric_limits<unsigned>::max()),
|
||||||
fromNode(UINT_MAX),
|
fromNode(std::numeric_limits<unsigned>::max()),
|
||||||
toNode(UINT_MAX) {
|
toNode(std::numeric_limits<unsigned>::max())
|
||||||
|
{
|
||||||
flags.isOnly = isOnly;
|
flags.isOnly = isOnly;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct InputRestrictionContainer {
|
struct InputRestrictionContainer
|
||||||
|
{
|
||||||
EdgeID fromWay;
|
EdgeID fromWay;
|
||||||
EdgeID toWay;
|
EdgeID toWay;
|
||||||
unsigned viaNode;
|
unsigned viaNode;
|
||||||
TurnRestriction restriction;
|
TurnRestriction restriction;
|
||||||
|
|
||||||
InputRestrictionContainer(
|
InputRestrictionContainer(EdgeID fromWay, EdgeID toWay, NodeID vn, unsigned vw)
|
||||||
EdgeID fromWay,
|
: fromWay(fromWay), toWay(toWay), viaNode(vw)
|
||||||
EdgeID toWay,
|
|
||||||
NodeID vn,
|
|
||||||
unsigned vw
|
|
||||||
) :
|
|
||||||
fromWay(fromWay),
|
|
||||||
toWay(toWay),
|
|
||||||
viaNode(vw)
|
|
||||||
{
|
{
|
||||||
restriction.viaNode = vn;
|
restriction.viaNode = vn;
|
||||||
}
|
}
|
||||||
explicit InputRestrictionContainer(
|
explicit InputRestrictionContainer(bool isOnly = false)
|
||||||
bool isOnly = false
|
: fromWay(std::numeric_limits<unsigned>::max()),
|
||||||
) :
|
toWay(std::numeric_limits<unsigned>::max()), viaNode(std::numeric_limits<unsigned>::max())
|
||||||
fromWay(std::numeric_limits<unsigned>::max()),
|
|
||||||
toWay(std::numeric_limits<unsigned>::max()),
|
|
||||||
viaNode(std::numeric_limits<unsigned>::max())
|
|
||||||
{
|
{
|
||||||
restriction.flags.isOnly = isOnly;
|
restriction.flags.isOnly = isOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
static InputRestrictionContainer min_value() {
|
static InputRestrictionContainer min_value() { return InputRestrictionContainer(0, 0, 0, 0); }
|
||||||
return InputRestrictionContainer(0, 0, 0, 0);
|
static InputRestrictionContainer max_value()
|
||||||
}
|
{
|
||||||
static InputRestrictionContainer max_value() {
|
return InputRestrictionContainer(std::numeric_limits<unsigned>::max(),
|
||||||
return InputRestrictionContainer(
|
|
||||||
std::numeric_limits<unsigned>::max(),
|
std::numeric_limits<unsigned>::max(),
|
||||||
std::numeric_limits<unsigned>::max(),
|
std::numeric_limits<unsigned>::max(),
|
||||||
std::numeric_limits<unsigned>::max(),
|
std::numeric_limits<unsigned>::max());
|
||||||
std::numeric_limits<unsigned>::max()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CmpRestrictionContainerByFrom {
|
struct CmpRestrictionContainerByFrom
|
||||||
|
{
|
||||||
typedef InputRestrictionContainer value_type;
|
typedef InputRestrictionContainer value_type;
|
||||||
inline bool operator()(
|
inline bool operator()(const InputRestrictionContainer &a, const InputRestrictionContainer &b)
|
||||||
const InputRestrictionContainer & a,
|
const
|
||||||
const InputRestrictionContainer & b
|
{
|
||||||
) const {
|
|
||||||
return a.fromWay < b.fromWay;
|
return a.fromWay < b.fromWay;
|
||||||
}
|
}
|
||||||
inline value_type max_value() const {
|
inline value_type max_value() const { return InputRestrictionContainer::max_value(); }
|
||||||
return InputRestrictionContainer::max_value();
|
inline value_type min_value() const { return InputRestrictionContainer::min_value(); }
|
||||||
}
|
|
||||||
inline value_type min_value() const {
|
|
||||||
return InputRestrictionContainer::min_value();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CmpRestrictionContainerByTo {
|
struct CmpRestrictionContainerByTo
|
||||||
|
{
|
||||||
typedef InputRestrictionContainer value_type;
|
typedef InputRestrictionContainer value_type;
|
||||||
inline bool operator()(
|
inline bool operator()(const InputRestrictionContainer &a, const InputRestrictionContainer &b)
|
||||||
const InputRestrictionContainer & a,
|
const
|
||||||
const InputRestrictionContainer & b
|
{
|
||||||
) const {
|
|
||||||
return a.toWay < b.toWay;
|
return a.toWay < b.toWay;
|
||||||
}
|
}
|
||||||
value_type max_value() const {
|
value_type max_value() const { return InputRestrictionContainer::max_value(); }
|
||||||
return InputRestrictionContainer::max_value();
|
value_type min_value() const { return InputRestrictionContainer::min_value(); }
|
||||||
}
|
|
||||||
value_type min_value() const {
|
|
||||||
return InputRestrictionContainer::min_value();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* RESTRICTION_H_ */
|
#endif // RESTRICTION_H
|
||||||
|
Loading…
Reference in New Issue
Block a user