ad_rss
RssStateVectorValidInputRange.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: LGPL-2.1-only
7  *
8  * ----------------- END LICENSE BLOCK -----------------------------------
9  */
10 
18 #pragma once
19 
20 #include <cmath>
21 #include <limits>
24 #include "spdlog/fmt/ostr.h"
25 #include "spdlog/spdlog.h"
26 
39 inline bool withinValidInputRange(::ad::rss::state::RssStateVector const &input, bool const logErrors = true)
40 {
41  bool inValidInputRange = (input.size() <= std::size_t(1000));
42  if (!inValidInputRange && logErrors)
43  {
44  spdlog::error("withinValidInputRange(::ad::rss::state::RssStateVector)>> {}, invalid input range",
45  input); // LCOV_EXCL_BR_LINE
46  }
47 
48  if (inValidInputRange)
49  {
50  for (auto const &member : input)
51  {
52  bool memberInValidInputRange = withinValidInputRange(member, logErrors);
53  inValidInputRange = inValidInputRange && memberInValidInputRange;
54  if (!memberInValidInputRange && logErrors)
55  {
56  spdlog::error("withinValidInputRange(::ad::rss::state::RssStateVector)>> {}, invalid member {}",
57  input,
58  member); // LCOV_EXCL_BR_LINE
59  }
60  }
61  }
62  return inValidInputRange;
63 }
ad::rss::state::RssStateVector
std::vector<::ad::rss::state::RssState > RssStateVector
DataType RssStateVector.
Definition: RssStateVector.hpp:42
withinValidInputRange
bool withinValidInputRange(::ad::rss::state::RssStateVector const &input, bool const logErrors=true)
check if the given RssStateVector is within valid input range
Definition: RssStateVectorValidInputRange.hpp:39
RssStateValidInputRange.hpp
RssStateVector.hpp