Branch data Line data Source code
1 : : // ----------------- BEGIN LICENSE BLOCK --------------------------------- 2 : : // 3 : : // Copyright (C) 2018-2021 Intel Corporation 4 : : // 5 : : // SPDX-License-Identifier: MIT 6 : : // 7 : : // ----------------- END LICENSE BLOCK ----------------------------------- 8 : : /** 9 : : * @file 10 : : */ 11 : : 12 : : #pragma once 13 : : 14 : : #include "ad/map/restriction/RestrictionValidInputRange.hpp" 15 : : #include "ad/map/restriction/RestrictionsValidInputRange.hpp" 16 : : #include "ad/map/restriction/VehicleDescriptorValidInputRange.hpp" 17 : : 18 : : /** @brief namespace ad */ 19 : : namespace ad { 20 : : /** @brief namespace map */ 21 : : namespace map { 22 : : /** @brief namespace restriction */ 23 : : namespace restriction { 24 : : 25 : : /** 26 : : * @brief checks if the given VehicleDescriptor is valid 27 : : * 28 : : * The descriptor is valid if it's within valid input range. 29 : : */ 30 : 28 : inline bool isValid(VehicleDescriptor const &descriptor, bool const logErrors = true) 31 : : { 32 : 28 : return withinValidInputRange(descriptor, logErrors); 33 : : } 34 : : 35 : : /** 36 : : * @brief checks if the given Restriction is valid 37 : : * 38 : : * The restriction is valid if it's within valid input range. 39 : : */ 40 : : inline bool isValid(Restriction const &restriction, bool const logErrors = true) 41 : : { 42 : : return withinValidInputRange(restriction, logErrors); 43 : : } 44 : : 45 : : /** 46 : : * @brief checks if the given Restrictions is valid 47 : : * 48 : : * The restrictions is valid if it's within valid input range. 49 : : */ 50 : : inline bool isValid(Restrictions const &restrictions, bool const logErrors = true) 51 : : { 52 : : return withinValidInputRange(restrictions, logErrors); 53 : : } 54 : : 55 : : /** 56 : : * @brief Checks if restriction allows vehicle at this object. 57 : : * @param[in] restriction data. 58 : : * @param[in] vehicle Vehicle data. 59 : : */ 60 : : bool isAccessOk(Restriction const &restriction, VehicleDescriptor const &vehicle); 61 : : 62 : : /** 63 : : * @brief Checks if vehicle fits the restriction criteria. 64 : : * @param vehicle Description of the vehicle. 65 : : * @returns true of vehicle fits the restrictions criteria. 66 : : */ 67 : : bool isAccessOk(Restrictions const &restrictions, VehicleDescriptor const &vehicle); 68 : : 69 : : /** @returns Maximum of HOV restriction found. */ 70 : : PassengerCount getHOV(Restrictions const &restrictions); 71 : : 72 : : } // namespace restriction 73 : : } // namespace map 74 : : } // namespace ad