diff --git a/BenchmarkComponent/BenchmarkComponent.cpp b/BenchmarkComponent/BenchmarkComponent.cpp index cb33abe..bf64c0c 100644 --- a/BenchmarkComponent/BenchmarkComponent.cpp +++ b/BenchmarkComponent/BenchmarkComponent.cpp @@ -207,6 +207,76 @@ namespace winrt::BenchmarkComponent::implementation return createList(); } + Windows::Foundation::Collections::IVector ClassWithMarshalingRoutines::Items(uint32_t count) + { + std::vector values(count); + for (uint32_t i = 0; i < count; ++i) + { + values[i] = static_cast(i); + } + return winrt::single_threaded_vector(std::move(values)); + } + + Windows::Foundation::Collections::IVectorView ClassWithMarshalingRoutines::ItemsView(uint32_t count) + { + return Items(count).GetView(); + } + + Windows::Foundation::Collections::IMap ClassWithMarshalingRoutines::StringMap(uint32_t count) + { + std::map values; + for (uint32_t i = 0; i < count; ++i) + { + values[winrt::to_hstring(i)] = static_cast(i); + } + return winrt::single_threaded_map(std::move(values)); + } + + Windows::Foundation::Collections::IMapView ClassWithMarshalingRoutines::MapView(uint32_t count) + { + std::map values; + for (uint32_t i = 0; i < count; ++i) + { + values[static_cast(i)] = static_cast(i); + } + return winrt::single_threaded_map(std::move(values)).GetView(); + } + + Windows::Foundation::Collections::IVector ClassWithMarshalingRoutines::ObjectItems(uint32_t count) + { + std::vector values(count); + for (uint32_t i = 0; i < count; ++i) + { + values[i] = winrt::make(); + } + return winrt::single_threaded_vector(std::move(values)); + } + + Windows::Foundation::Collections::IVectorView ClassWithMarshalingRoutines::ObjectItemsView(uint32_t count) + { + return ObjectItems(count).GetView(); + } + + Windows::Foundation::Collections::IMap ClassWithMarshalingRoutines::ObjectMap(uint32_t count) + { + std::map values; + for (uint32_t i = 0; i < count; ++i) + { + values[winrt::to_hstring(i)] = winrt::make(); + } + return winrt::single_threaded_map(std::move(values)); + } + + Windows::Foundation::Collections::IMapView ClassWithMarshalingRoutines::ObjectMapView(uint32_t count) + { + std::map values; + for (uint32_t i = 0; i < count; ++i) + { + values[winrt::to_hstring(i)] = winrt::make(); + } + return winrt::single_threaded_map(std::move(values)).GetView(); + } + Windows::Foundation::IInspectable ClassWithMarshalingRoutines::NewTypeErasedKeyValuePairObject() { return createKeyValuePairObject(); diff --git a/BenchmarkComponent/BenchmarkComponent.h b/BenchmarkComponent/BenchmarkComponent.h index 4578b7c..9b4fe00 100644 --- a/BenchmarkComponent/BenchmarkComponent.h +++ b/BenchmarkComponent/BenchmarkComponent.h @@ -137,6 +137,16 @@ namespace winrt::BenchmarkComponent::implementation Windows::Foundation::Collections::IMap ExistingDictionary(); + Windows::Foundation::Collections::IVector Items(uint32_t count); + Windows::Foundation::Collections::IVectorView ItemsView(uint32_t count); + Windows::Foundation::Collections::IMap StringMap(uint32_t count); + Windows::Foundation::Collections::IMapView MapView(uint32_t count); + + Windows::Foundation::Collections::IVector ObjectItems(uint32_t count); + Windows::Foundation::Collections::IVectorView ObjectItemsView(uint32_t count); + Windows::Foundation::Collections::IMap ObjectMap(uint32_t count); + Windows::Foundation::Collections::IMapView ObjectMapView(uint32_t count); + Windows::Foundation::IReference NullableInt(); void NullableInt(Windows::Foundation::IReference const& value); Windows::Foundation::IReference NullableBlittableStruct(); @@ -224,7 +234,7 @@ namespace winrt::BenchmarkComponent::implementation int32_t DerivedNonDefaultIntMethod(int32_t value); }; - struct NonAgileClassWithMultipleInterfaces : NonAgileClassWithMultipleInterfacesT + struct NonAgileClassWithMultipleInterfaces : NonAgileClassWithMultipleInterfacesT { NonAgileClassWithMultipleInterfaces() = default; diff --git a/BenchmarkComponent/BenchmarkComponent.idl b/BenchmarkComponent/BenchmarkComponent.idl index 7c6eb82..98946cb 100644 --- a/BenchmarkComponent/BenchmarkComponent.idl +++ b/BenchmarkComponent/BenchmarkComponent.idl @@ -114,6 +114,16 @@ namespace BenchmarkComponent Windows.Foundation.Collections.IMap ExistingDictionary{ get; }; Windows.Foundation.Collections.IVector NewList(); + Windows.Foundation.Collections.IVector Items(UInt32 count); + Windows.Foundation.Collections.IVectorView ItemsView(UInt32 count); + Windows.Foundation.Collections.IMap StringMap(UInt32 count); + Windows.Foundation.Collections.IMapView MapView(UInt32 count); + + Windows.Foundation.Collections.IVector ObjectItems(UInt32 count); + Windows.Foundation.Collections.IVectorView ObjectItemsView(UInt32 count); + Windows.Foundation.Collections.IMap ObjectMap(UInt32 count); + Windows.Foundation.Collections.IMapView ObjectMapView(UInt32 count); + Windows.Foundation.IReference NullableInt{ get; set; }; Windows.Foundation.IReference NullableBlittableStruct{ get; set; }; Windows.Foundation.IReference NullableNonBlittableStruct{ get; set; };