Branch data Line data Source code
1 : : // ----------------- BEGIN LICENSE BLOCK --------------------------------- 2 : : // 3 : : // Copyright (C) 2018-2022 Intel Corporation 4 : : // 5 : : // SPDX-License-Identifier: LGPL-2.1-only 6 : : // 7 : : // ----------------- END LICENSE BLOCK ----------------------------------- 8 : : 9 : : #include "ad/rss/core/RssCheck.hpp" 10 : : #include "ad/rss/core/Logging.hpp" 11 : : #include "ad/rss/core/RssResponseResolving.hpp" 12 : : #include "ad/rss/core/RssSituationChecking.hpp" 13 : : #include "ad/rss/core/RssSituationExtraction.hpp" 14 : : 15 : : namespace ad { 16 : : namespace rss { 17 : : namespace core { 18 : : 19 : 28 : void RssCheck::registerCalculateTrajectorySetsCallback( 20 : : world::ObjectType objectType, 21 : : unstructured::RssUnstructuredConstellationChecker::CalculateTrajectorySetsCallbackFunctionType 22 : : calculateTrajectorySetsCallback) 23 : : { 24 : : // global try catch block to ensure this library call doesn't throw an exception 25 : : try 26 : : { 27 [ + - + - ]: 28 : mSituationChecking.registerCalculateTrajectorySetsCallback(objectType, calculateTrajectorySetsCallback); 28 : : } 29 : 0 : catch (...) 30 : : { 31 [ - - - - ]: 0 : core::getLogger()->critical("RssCheck::registerCalculateTrajectorySetsCallback>> Exception caught"); 32 : 0 : } 33 : 28 : } 34 : : 35 : 0 : void RssCheck::dropObjectHistory(world::ObjectId const &object_id) 36 : : { 37 : 0 : mSituationExtraction.dropObjectHistory(object_id); 38 : 0 : } 39 : : 40 : 4268 : bool RssCheck::calculateProperResponse(world::WorldModel const &worldModel, 41 : : RssSituationSnapshot &situationSnapshot, 42 : : state::RssStateSnapshot &rssStateSnapshot, 43 : : state::ProperResponse &properResponse) 44 : : { 45 : 4268 : bool result = false; 46 : : // global try catch block to ensure this library call doesn't throw an exception 47 : : try 48 : : { 49 [ + - ]: 4268 : result = mSituationExtraction.extractSituation(worldModel, situationSnapshot); 50 : : 51 [ + + ]: 4268 : if (result) 52 : : { 53 [ + - ]: 3885 : result = mSituationChecking.checkSituation(situationSnapshot, rssStateSnapshot); 54 : : } 55 : : 56 [ + + ]: 4268 : if (result) 57 : : { 58 [ + - ]: 3831 : result = mResponseResolving.provideProperResponse(rssStateSnapshot, properResponse); 59 : : } 60 : : } 61 : : // LCOV_EXCL_START: unreachable code, keep to be on the safe side 62 : : catch (...) 63 : : { 64 : : core::getLogger()->critical("RssCheck::calculateProperResponse>> Exception caught"); 65 : : result = false; 66 : : } 67 : : // LCOV_EXCL_STOP: unreachable code, keep to be on the safe side 68 : 4268 : return result; 69 : : } 70 : : 71 : 4267 : bool RssCheck::calculateProperResponse(world::WorldModel const &worldModel, state::ProperResponse &properResponse) 72 : : { 73 [ + - ]: 4267 : RssSituationSnapshot situationSnapshot; 74 [ + - ]: 4267 : state::RssStateSnapshot rssStateSnapshot; 75 : : 76 [ + - ]: 8534 : return calculateProperResponse(worldModel, situationSnapshot, rssStateSnapshot, properResponse); 77 : 4267 : } 78 : : 79 : : } // namespace core 80 : : } // namespace rss 81 : : } // namespace ad