// ============ Forward declarations ============== template inline const auto & GET_VALUE( const T &x) ; template inline auto & GET_VALUE( T &x) ; template inline bool HAS_VALUE( const T &x) ; template inline bool HAS_VALUE( T &x) ; #ifndef IGNORE_Scalar template inline const auto & GET_VALUE( const Fortran::parser::Scalar &x) ; template inline auto & GET_VALUE( Fortran::parser::Scalar &x) ; template inline bool HAS_VALUE( const Fortran::parser::Scalar &x) ; template inline bool HAS_VALUE( Fortran::parser::Scalar &x) ; #endif #ifndef IGNORE_Constant template inline const auto & GET_VALUE( const Fortran::parser::Constant &x) ; template inline auto & GET_VALUE( Fortran::parser::Constant &x) ; template inline bool HAS_VALUE( const Fortran::parser::Constant &x) ; template inline bool HAS_VALUE( Fortran::parser::Constant &x) ; #endif #ifndef IGNORE_Integer template inline const auto & GET_VALUE( const Fortran::parser::Integer &x) ; template inline auto & GET_VALUE( Fortran::parser::Integer &x) ; template inline bool HAS_VALUE( const Fortran::parser::Integer &x) ; template inline bool HAS_VALUE( Fortran::parser::Integer &x) ; #endif #ifndef IGNORE_Logical template inline const auto & GET_VALUE( const Fortran::parser::Logical &x) ; template inline auto & GET_VALUE( Fortran::parser::Logical &x) ; template inline bool HAS_VALUE( const Fortran::parser::Logical &x) ; template inline bool HAS_VALUE( Fortran::parser::Logical &x) ; #endif #ifndef IGNORE_DefaultChar template inline const auto & GET_VALUE( const Fortran::parser::DefaultChar &x) ; template inline auto & GET_VALUE( Fortran::parser::DefaultChar &x) ; template inline bool HAS_VALUE( const Fortran::parser::DefaultChar &x) ; template inline bool HAS_VALUE( Fortran::parser::DefaultChar &x) ; #endif #ifndef IGNORE_Indirection template inline const auto & GET_VALUE( const Fortran::parser::Indirection &x) ; template inline auto & GET_VALUE( Fortran::parser::Indirection &x) ; template inline bool HAS_VALUE( const Fortran::parser::Indirection &x) ; template inline bool HAS_VALUE( Fortran::parser::Indirection &x) ; #endif #ifndef IGNORE_Statement template inline const auto & GET_VALUE( const Fortran::parser::Statement &x) ; template inline auto & GET_VALUE( Fortran::parser::Statement &x) ; template inline bool HAS_VALUE( const Fortran::parser::Statement &x) ; template inline bool HAS_VALUE( Fortran::parser::Statement &x) ; #endif #ifndef IGNORE_optional template inline const auto & GET_VALUE( const std::optional &x) ; template inline auto & GET_VALUE( std::optional &x) ; template inline bool HAS_VALUE( const std::optional &x) ; template inline bool HAS_VALUE( std::optional &x) ; #endif // =========== Actual implementation of GET_VALUE() and HAS_VALUE() ============================== template inline const auto & GET_VALUE( const T &x) { return x ;} template inline auto & GET_VALUE( T &x) { return x ;} template inline bool HAS_VALUE( const T &x) { return true; } template inline bool HAS_VALUE( T &x) { return true; } #ifndef IGNORE_Scalar template inline const auto & GET_VALUE( const Fortran::parser::Scalar &x) { return GET_VALUE(x.thing) ;} template inline auto & GET_VALUE( Fortran::parser::Scalar &x) { return GET_VALUE(x.thing) ;} template inline bool HAS_VALUE( const Fortran::parser::Scalar &x) { return HAS_VALUE(x.thing) ;} template inline bool HAS_VALUE( Fortran::parser::Scalar &x) { return HAS_VALUE(x.thing) ;} #endif #ifndef IGNORE_Constant template inline const auto & GET_VALUE( const Fortran::parser::Constant &x) { return GET_VALUE(x.thing) ;} template inline auto & GET_VALUE( Fortran::parser::Constant &x) { return GET_VALUE(x.thing) ;} template inline bool HAS_VALUE( const Fortran::parser::Constant &x) { return HAS_VALUE(x.thing) ;} template inline bool HAS_VALUE( Fortran::parser::Constant &x) { return HAS_VALUE(x.thing) ;} #endif #ifndef IGNORE_Integer template inline const auto & GET_VALUE( const Fortran::parser::Integer &x) { return GET_VALUE(x.thing) ;} template inline auto & GET_VALUE( Fortran::parser::Integer &x) { return GET_VALUE(x.thing) ;} template inline bool HAS_VALUE( const Fortran::parser::Integer &x) { return HAS_VALUE(x.thing) ;} template inline bool HAS_VALUE( Fortran::parser::Integer &x) { return HAS_VALUE(x.thing) ;} #endif #ifndef IGNORE_Logical template inline const auto & GET_VALUE( const Fortran::parser::Logical &x) { return GET_VALUE(x.thing) ;} template inline auto & GET_VALUE( Fortran::parser::Logical &x) { return GET_VALUE(x.thing) ;} template inline bool HAS_VALUE( const Fortran::parser::Logical &x) { return HAS_VALUE(x.thing) ;} template inline bool HAS_VALUE( Fortran::parser::Logical &x) { return HAS_VALUE(x.thing) ;} #endif #ifndef IGNORE_DefaultChar template inline const auto & GET_VALUE( const Fortran::parser::DefaultChar &x) { return GET_VALUE(x.thing) ;} template inline auto & GET_VALUE( Fortran::parser::DefaultChar &x) { return GET_VALUE(x.thing) ;} template inline bool HAS_VALUE( const Fortran::parser::DefaultChar &x) { return HAS_VALUE(x.thing) ;} template inline bool HAS_VALUE( Fortran::parser::DefaultChar &x) { return HAS_VALUE(x.thing) ;} #endif #ifndef IGNORE_Indirection template inline const auto & GET_VALUE( const Fortran::parser::Indirection &x) { return GET_VALUE(*x) ;} template inline auto & GET_VALUE( Fortran::parser::Indirection &x) { return GET_VALUE(*x) ;} template inline bool HAS_VALUE( const Fortran::parser::Indirection &x) { return GET_VALUE(*x) ;} template inline bool HAS_VALUE( Fortran::parser::Indirection &x) { return GET_VALUE(*x) ;} #endif #ifndef IGNORE_Statement template inline const auto & GET_VALUE( const Fortran::parser::Statement &x) { return GET_VALUE(x.statement) ;} template inline auto & GET_VALUE( Fortran::parser::Statement &x) { return GET_VALUE(x.statement) ;} template inline bool HAS_VALUE( const Fortran::parser::Statement &x) { return HAS_VALUE(x.statement) ;} template inline bool HAS_VALUE( Fortran::parser::Statement &x) { return HAS_VALUE(x.statement) ;} #endif #ifndef IGNORE_optional template inline const auto & GET_VALUE( const std::optional &x) { return GET_VALUE(x.value()) ; } template inline auto & GET_VALUE( std::optional &x) { return GET_VALUE(x.value()) ; } template inline bool HAS_VALUE( const std::optional &x) { return x.has_value() && HAS_VALUE(*x); } template inline bool HAS_VALUE( std::optional &x) { return x.has_value() && HAS_VALUE(*x); } #endif template inline auto GET_OPT_VALUE(const T &x) { if ( HAS_VALUE(x) ) { return & GET_VALUE(x) ; } else { return decltype(&GET_VALUE(x)){0} ; } } template inline auto GET_OPT_VALUE(T &x) { if ( HAS_VALUE(x) ) { return & GET_VALUE(x) ; } else { return decltype(&GET_VALUE(x)){0} ; } } #undef GET_VALUE #undef HAS_VALUE #undef GET_OPT_VALUE