// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// Copyright (C) Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// This file incorporates work covered by the following copyright and permission
// notice:
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
//
//===----------------------------------------------------------------------===//

#ifndef _ONEDPL_EXECUTION
#define _ONEDPL_EXECUTION

#include "oneapi/dpl/internal/common_config.h"
// ATTENTION!!! Include the header from the C++ standard library before the oneDPL config header to see whether the _PSTL_VERSION macro is defined
#if _ONEDPL___cplusplus >= 201703L
#    if __has_include(<execution>)
#        include <execution>
#    endif // __has_include(<execution>)
#endif     // _ONEDPL___cplusplus >= 201703L

#include "oneapi/dpl/pstl/onedpl_config.h"
#include "oneapi/dpl/pstl/execution_defs.h"

#define _ONEDPL_EXECUTION_POLICIES_DEFINED 1

// If the forward declarations have already been processed, pull the implementations
#if _ONEDPL_ALGORITHM_FORWARD_DECLARED
#    include "oneapi/dpl/pstl/glue_algorithm_impl.h"
#    include "oneapi/dpl/pstl/glue_algorithm_ranges_impl.h"
#    include "oneapi/dpl/pstl/histogram_impl.h"

#    include "oneapi/dpl/internal/exclusive_scan_by_segment_impl.h"
#    include "oneapi/dpl/internal/inclusive_scan_by_segment_impl.h"
#    include "oneapi/dpl/internal/binary_search_impl.h"
#    include "oneapi/dpl/internal/reduce_by_segment_impl.h"
#endif // _ONEDPL_ALGORITHM_FORWARD_DECLARED

#if _ONEDPL_MEMORY_FORWARD_DECLARED
#    include "oneapi/dpl/pstl/glue_memory_impl.h"
// Even though no forward declaration for the range memory algorithms are defined,
// pull the implementations if the memory header is included first.
#    include "oneapi/dpl/pstl/glue_memory_ranges_impl.h"
#endif // _ONEDPL_MEMORY_FORWARD_DECLARED

#if _ONEDPL_NUMERIC_FORWARD_DECLARED
#    include "oneapi/dpl/pstl/glue_numeric_impl.h"
#endif // _ONEDPL_NUMERIC_FORWARD_DECLARED

#if _ONEDPL_ALGORITHM_RANGES_FORWARD_DECLARED
#    include "oneapi/dpl/pstl/glue_algorithm_ranges_impl.h"
#endif // _ONEDPL_ALGORITHM_RANGES_FORWARD_DECLARED

#if _ONEDPL_NUMERIC_RANGES_FORWARD_DECLARED
#    include "oneapi/dpl/pstl/glue_numeric_ranges_impl.h"
#endif // _ONEDPL_NUMERIC_RANGES_FORWARD_DECLARED

#if _ONEDPL_ASYNC_FORWARD_DECLARED
#    include "oneapi/dpl/internal/async_impl/glue_async_impl.h"
#endif // _ONEDPL_ASYNC_FORWARD_DECLARED

#if _ONEDPL_CPP17_EXECUTION_POLICIES_PRESENT
_PSTL_PRAGMA_MESSAGE_POLICIES(
    "The <Parallel STL> execution policies are defined in the namespace oneapi::dpl::execution")
#    include "oneapi/dpl/pstl/algorithm_impl.h"
#    include "oneapi/dpl/pstl/numeric_impl.h"
#    include "oneapi/dpl/pstl/parallel_backend.h"
#else
#    include "oneapi/dpl/pstl/glue_execution_defs.h"
_PSTL_PRAGMA_MESSAGE_POLICIES(
    "The <Parallel STL> execution policies are injected into the standard namespace std::execution")
#endif // _ONEDPL_CPP17_EXECUTION_POLICIES_PRESENT

namespace dpl = oneapi::dpl;

#endif // _ONEDPL_EXECUTION
