Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions BenchmarkComponent/BenchmarkComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,76 @@ namespace winrt::BenchmarkComponent::implementation
return createList();
}

Windows::Foundation::Collections::IVector<int32_t> ClassWithMarshalingRoutines::Items(uint32_t count)
{
std::vector<int32_t> values(count);
for (uint32_t i = 0; i < count; ++i)
{
values[i] = static_cast<int32_t>(i);
}
return winrt::single_threaded_vector(std::move(values));
}

Windows::Foundation::Collections::IVectorView<int32_t> ClassWithMarshalingRoutines::ItemsView(uint32_t count)
{
return Items(count).GetView();
}

Windows::Foundation::Collections::IMap<hstring, int32_t> ClassWithMarshalingRoutines::StringMap(uint32_t count)
{
std::map<hstring, int32_t> values;
for (uint32_t i = 0; i < count; ++i)
{
values[winrt::to_hstring(i)] = static_cast<int32_t>(i);
}
return winrt::single_threaded_map(std::move(values));
}

Windows::Foundation::Collections::IMapView<int32_t, int32_t> ClassWithMarshalingRoutines::MapView(uint32_t count)
{
std::map<int32_t, int32_t> values;
for (uint32_t i = 0; i < count; ++i)
{
values[static_cast<int32_t>(i)] = static_cast<int32_t>(i);
}
return winrt::single_threaded_map(std::move(values)).GetView();
}

Windows::Foundation::Collections::IVector<BenchmarkComponent::WrappedClass> ClassWithMarshalingRoutines::ObjectItems(uint32_t count)
{
std::vector<BenchmarkComponent::WrappedClass> values(count);
for (uint32_t i = 0; i < count; ++i)
{
values[i] = winrt::make<WrappedClass>();
}
return winrt::single_threaded_vector(std::move(values));
}

Windows::Foundation::Collections::IVectorView<BenchmarkComponent::WrappedClass> ClassWithMarshalingRoutines::ObjectItemsView(uint32_t count)
{
return ObjectItems(count).GetView();
}

Windows::Foundation::Collections::IMap<hstring, BenchmarkComponent::WrappedClass> ClassWithMarshalingRoutines::ObjectMap(uint32_t count)
{
std::map<hstring, BenchmarkComponent::WrappedClass> values;
for (uint32_t i = 0; i < count; ++i)
{
values[winrt::to_hstring(i)] = winrt::make<WrappedClass>();
}
return winrt::single_threaded_map(std::move(values));
}

Windows::Foundation::Collections::IMapView<hstring, BenchmarkComponent::WrappedClass> ClassWithMarshalingRoutines::ObjectMapView(uint32_t count)
{
std::map<hstring, BenchmarkComponent::WrappedClass> values;
for (uint32_t i = 0; i < count; ++i)
{
values[winrt::to_hstring(i)] = winrt::make<WrappedClass>();
}
return winrt::single_threaded_map(std::move(values)).GetView();
}

Windows::Foundation::IInspectable ClassWithMarshalingRoutines::NewTypeErasedKeyValuePairObject()
{
return createKeyValuePairObject();
Expand Down
12 changes: 11 additions & 1 deletion BenchmarkComponent/BenchmarkComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,16 @@ namespace winrt::BenchmarkComponent::implementation

Windows::Foundation::Collections::IMap<winrt::hstring, BenchmarkComponent::WrappedClass> ExistingDictionary();

Windows::Foundation::Collections::IVector<int32_t> Items(uint32_t count);
Windows::Foundation::Collections::IVectorView<int32_t> ItemsView(uint32_t count);
Windows::Foundation::Collections::IMap<hstring, int32_t> StringMap(uint32_t count);
Windows::Foundation::Collections::IMapView<int32_t, int32_t> MapView(uint32_t count);

Windows::Foundation::Collections::IVector<BenchmarkComponent::WrappedClass> ObjectItems(uint32_t count);
Windows::Foundation::Collections::IVectorView<BenchmarkComponent::WrappedClass> ObjectItemsView(uint32_t count);
Windows::Foundation::Collections::IMap<hstring, BenchmarkComponent::WrappedClass> ObjectMap(uint32_t count);
Windows::Foundation::Collections::IMapView<hstring, BenchmarkComponent::WrappedClass> ObjectMapView(uint32_t count);

Windows::Foundation::IReference<int32_t> NullableInt();
void NullableInt(Windows::Foundation::IReference<int32_t> const& value);
Windows::Foundation::IReference<BenchmarkComponent::BlittableStruct> NullableBlittableStruct();
Expand Down Expand Up @@ -224,7 +234,7 @@ namespace winrt::BenchmarkComponent::implementation
int32_t DerivedNonDefaultIntMethod(int32_t value);
};

struct NonAgileClassWithMultipleInterfaces : NonAgileClassWithMultipleInterfacesT<NonAgileClassWithMultipleInterfaces>
struct NonAgileClassWithMultipleInterfaces : NonAgileClassWithMultipleInterfacesT<NonAgileClassWithMultipleInterfaces, winrt::non_agile>
{
NonAgileClassWithMultipleInterfaces() = default;

Expand Down
10 changes: 10 additions & 0 deletions BenchmarkComponent/BenchmarkComponent.idl
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@ namespace BenchmarkComponent
Windows.Foundation.Collections.IMap<String, WrappedClass> ExistingDictionary{ get; };
Windows.Foundation.Collections.IVector<String> NewList();

Windows.Foundation.Collections.IVector<Int32> Items(UInt32 count);
Windows.Foundation.Collections.IVectorView<Int32> ItemsView(UInt32 count);
Windows.Foundation.Collections.IMap<String, Int32> StringMap(UInt32 count);
Windows.Foundation.Collections.IMapView<Int32, Int32> MapView(UInt32 count);

Windows.Foundation.Collections.IVector<WrappedClass> ObjectItems(UInt32 count);
Windows.Foundation.Collections.IVectorView<WrappedClass> ObjectItemsView(UInt32 count);
Windows.Foundation.Collections.IMap<String, WrappedClass> ObjectMap(UInt32 count);
Windows.Foundation.Collections.IMapView<String, WrappedClass> ObjectMapView(UInt32 count);

Windows.Foundation.IReference<Int32> NullableInt{ get; set; };
Windows.Foundation.IReference<BlittableStruct> NullableBlittableStruct{ get; set; };
Windows.Foundation.IReference<NonBlittable> NullableNonBlittableStruct{ get; set; };
Expand Down
Loading