// C++/WinRT v2.0.250303.1 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #pragma once #ifndef WINRT_Windows_System_Diagnostics_Telemetry_H #define WINRT_Windows_System_Diagnostics_Telemetry_H #include "winrt/base.h" static_assert(winrt::check_version(CPPWINRT_VERSION, "2.0.250303.1"), "Mismatched C++/WinRT headers."); #define CPPWINRT_VERSION "2.0.250303.1" #include "winrt/Windows.System.Diagnostics.h" #include "winrt/impl/Windows.System.Diagnostics.Telemetry.2.h" namespace winrt::impl { template auto consume_Windows_System_Diagnostics_Telemetry_IPlatformTelemetryClientStatics::Register(param::hstring const& id) const { void* result{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->Register(*(void**)(&id), &result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->Register(*(void**)(&id), &result)); } return winrt::Windows::System::Diagnostics::Telemetry::PlatformTelemetryRegistrationResult{ result, take_ownership_from_abi }; } template auto consume_Windows_System_Diagnostics_Telemetry_IPlatformTelemetryClientStatics::Register(param::hstring const& id, winrt::Windows::System::Diagnostics::Telemetry::PlatformTelemetryRegistrationSettings const& settings) const { void* result{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->RegisterWithSettings(*(void**)(&id), *(void**)(&settings), &result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->RegisterWithSettings(*(void**)(&id), *(void**)(&settings), &result)); } return winrt::Windows::System::Diagnostics::Telemetry::PlatformTelemetryRegistrationResult{ result, take_ownership_from_abi }; } template auto consume_Windows_System_Diagnostics_Telemetry_IPlatformTelemetryRegistrationResult::Status() const { winrt::Windows::System::Diagnostics::Telemetry::PlatformTelemetryRegistrationStatus value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Status(reinterpret_cast(&value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_Status(reinterpret_cast(&value))); } return value; } template auto consume_Windows_System_Diagnostics_Telemetry_IPlatformTelemetryRegistrationSettings::StorageSize() const { uint32_t value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_StorageSize(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_StorageSize(&value)); } return value; } template auto consume_Windows_System_Diagnostics_Telemetry_IPlatformTelemetryRegistrationSettings::StorageSize(uint32_t value) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->put_StorageSize(value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->put_StorageSize(value)); } } template auto consume_Windows_System_Diagnostics_Telemetry_IPlatformTelemetryRegistrationSettings::UploadQuotaSize() const { uint32_t value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_UploadQuotaSize(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_UploadQuotaSize(&value)); } return value; } template auto consume_Windows_System_Diagnostics_Telemetry_IPlatformTelemetryRegistrationSettings::UploadQuotaSize(uint32_t value) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->put_UploadQuotaSize(value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->put_UploadQuotaSize(value)); } } #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall Register(void* id, void** result) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *result = detach_from(this->shim().Register(*reinterpret_cast(&id))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall RegisterWithSettings(void* id, void* settings, void** result) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *result = detach_from(this->shim().Register(*reinterpret_cast(&id), *reinterpret_cast(&settings))); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall get_Status(int32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Status()); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall get_StorageSize(uint32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().StorageSize()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_StorageSize(uint32_t value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().StorageSize(value); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_UploadQuotaSize(uint32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().UploadQuotaSize()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_UploadQuotaSize(uint32_t value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().UploadQuotaSize(value); return 0; } catch (...) { return to_hresult(); } }; #endif } WINRT_EXPORT namespace winrt::Windows::System::Diagnostics::Telemetry { inline auto PlatformTelemetryClient::Register(param::hstring const& id) { return impl::call_factory([&](IPlatformTelemetryClientStatics const& f) { return f.Register(id); }); } inline auto PlatformTelemetryClient::Register(param::hstring const& id, winrt::Windows::System::Diagnostics::Telemetry::PlatformTelemetryRegistrationSettings const& settings) { return impl::call_factory([&](IPlatformTelemetryClientStatics const& f) { return f.Register(id, settings); }); } inline PlatformTelemetryRegistrationSettings::PlatformTelemetryRegistrationSettings() : PlatformTelemetryRegistrationSettings(impl::call_factory_cast([](winrt::Windows::Foundation::IActivationFactory const& f) { return f.template ActivateInstance(); })) { } } namespace std { #ifndef WINRT_LEAN_AND_MEAN template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; #endif #ifdef __cpp_lib_format #endif } #endif