ad_map_access
LandmarkIdValidInputRange.hpp
Go to the documentation of this file.
1 /*
2  * ----------------- BEGIN LICENSE BLOCK ---------------------------------
3  *
4  * Copyright (C) 2018-2020 Intel Corporation
5  *
6  * SPDX-License-Identifier: MIT
7  *
8  * ----------------- END LICENSE BLOCK -----------------------------------
9  */
10 
18 #pragma once
19 
20 #include <cmath>
21 #include <limits>
23 #include "spdlog/fmt/ostr.h"
24 #include "spdlog/spdlog.h"
25 
38 inline bool withinValidInputRange(::ad::map::landmark::LandmarkId const &input, bool const logErrors = true)
39 {
40  // check for generic numeric limits of the type
41  bool inValidInputRange = input.isValid() && (std::numeric_limits<::ad::map::landmark::LandmarkId>::lowest() <= input)
43  if (!inValidInputRange && logErrors)
44  {
45  spdlog::error("withinValidInputRange(::ad::map::landmark::LandmarkId)>> {} out of numerical limits [{}, {}]",
46  input,
49  }
50  return inValidInputRange;
51 }
std::numeric_limits<::ad::map::landmark::LandmarkId >::max
static inline ::ad::map::landmark::LandmarkId max()
Definition: LandmarkId.hpp:406
ad::map::landmark::LandmarkId
DataType LandmarkId.
Definition: LandmarkId.hpp:66
ad::map::landmark::LandmarkId::isValid
bool isValid() const
Definition: LandmarkId.hpp:312
LandmarkId.hpp
withinValidInputRange
bool withinValidInputRange(::ad::map::landmark::LandmarkId const &input, bool const logErrors=true)
check if the given LandmarkId is within valid input range
Definition: LandmarkIdValidInputRange.hpp:38
std::numeric_limits<::ad::map::landmark::LandmarkId >::lowest
static inline ::ad::map::landmark::LandmarkId lowest()
Definition: LandmarkId.hpp:399