1 write to CollectionSource
Microsoft.Interop.SourceGeneration (1)
Marshalling\ElementsMarshalling.cs (1)
31CollectionSource = collectionSource;
53 references to CollectionSource
Microsoft.Interop.SourceGeneration (53)
Marshalling\ElementsMarshalling.cs (53)
36writer.WriteLine($"{CollectionSource.GetUnmanagedValuesDestination(context)}.Clear();"); 41writer.WriteLine($"{CollectionSource.GetManagedValuesDestination(context)}.Clear();"); 103string source = CollectionSource.GetUnmanagedValuesSource(context); 105writer.WriteLine($"{CollectionSource.GetManagedValuesDestination(context)}.CopyTo({destination});"); 110string destination = CastToManagedIfNecessary(CollectionSource.GetUnmanagedValuesDestination(context)); 111writer.WriteLine($"{CollectionSource.GetManagedValuesSource(context)}.CopyTo({destination});"); 116string source = CastToManagedIfNecessary(CollectionSource.GetUnmanagedValuesDestination(context)); 117string managedSource = CollectionSource.GetManagedValuesSource(context); 124string source = CastToManagedIfNecessary(CollectionSource.GetUnmanagedValuesSource(context)); 125writer.WriteLine($"{source}.CopyTo({CollectionSource.GetManagedValuesDestination(context)});"); 154string managedSpanIdentifier = MarshallerHelpers.GetManagedSpanIdentifier(CollectionSource.TypeInfo, context); 155string nativeSpanIdentifier = MarshallerHelpers.GetNativeSpanIdentifier(CollectionSource.TypeInfo, context); 159writer.WriteLine($"{TypeNames.System_ReadOnlySpan}<{elementMarshaller.TypeInfo.ManagedType.FullTypeName}> {managedSpanIdentifier} = {CollectionSource.GetManagedValuesSource(context)};"); 160writer.WriteLine($"{TypeNames.System_Span}<{unmanagedElementType}> {nativeSpanIdentifier} = {CollectionSource.GetUnmanagedValuesDestination(context)};"); 163if (ShouldCleanUpAllElements(CollectionSource.TypeInfo, CollectionSource.CodeContext)) 174string managedSpanIdentifier = MarshallerHelpers.GetManagedSpanIdentifier(CollectionSource.TypeInfo, context); 175string nativeSpanIdentifier = MarshallerHelpers.GetNativeSpanIdentifier(CollectionSource.TypeInfo, context); 179writer.WriteLine($"{TypeNames.System_ReadOnlySpan}<{unmanagedElementType}> {nativeSpanIdentifier} = {CollectionSource.GetUnmanagedValuesSource(context)};"); 180writer.WriteLine($"{TypeNames.System_Span}<{elementMarshaller.TypeInfo.ManagedType.FullTypeName}> {managedSpanIdentifier} = {CollectionSource.GetManagedValuesDestination(context)};"); 189string numElementsIdentifier = MarshallerHelpers.GetNumElementsIdentifier(CollectionSource.TypeInfo, context); 190string managedSpanIdentifier = MarshallerHelpers.GetManagedSpanIdentifier(CollectionSource.TypeInfo, context); 191string nativeSpanIdentifier = MarshallerHelpers.GetNativeSpanIdentifier(CollectionSource.TypeInfo, context); 195CollectionSource.GenerateNumElementsAssignmentFromManagedValuesSource(writer, CollectionSource.TypeInfo, context); 196writer.WriteLine($"{TypeNames.System_Span}<{elementMarshaller.TypeInfo.ManagedType.FullTypeName}> {managedSpanIdentifier} = {MemoryMarshalType}.CreateSpan(ref {UnsafeType}.AsRef(in {CollectionSource.GetManagedValuesSource(context)}.GetPinnableReference()), {numElementsIdentifier});"); 197writer.WriteLine($"{TypeNames.System_Span}<{unmanagedElementType}> {nativeSpanIdentifier} = {CollectionSource.GetUnmanagedValuesDestination(context)};"); 205string nativeSpanIdentifier = MarshallerHelpers.GetNativeSpanIdentifier(CollectionSource.TypeInfo, context); 206bool usesLastIndexMarshalled = UsesLastIndexMarshalled(CollectionSource.TypeInfo, CollectionSource.CodeContext); 208? MarshallerHelpers.GetLastIndexMarshalledIdentifier(CollectionSource.TypeInfo, context) 224string source = MarshallerHelpers.GetMarshalDirection(CollectionSource.TypeInfo, CollectionSource.CodeContext) == MarshalDirection.ManagedToUnmanaged 225? CollectionSource.GetUnmanagedValuesDestination(context) 226: CollectionSource.GetUnmanagedValuesSource(context); 235string numElementsIdentifier = MarshallerHelpers.GetNumElementsIdentifier(CollectionSource.TypeInfo, context); 236string managedSpanIdentifier = MarshallerHelpers.GetManagedSpanIdentifier(CollectionSource.TypeInfo, context); 237string nativeSpanIdentifier = MarshallerHelpers.GetNativeSpanIdentifier(CollectionSource.TypeInfo, context); 241if (CollectionSource.CodeContext.Direction is MarshalDirection.UnmanagedToManaged && CollectionSource.TypeInfo.ByValueContentsMarshalKind is ByValueContentsMarshalKind.Out) 252CollectionSource.GenerateNumElementsAssignmentFromManagedValuesDestination(writer, CollectionSource.TypeInfo, context); 253writer.WriteLine($"{TypeNames.System_Span}<{unmanagedElementType}> {nativeSpanIdentifier} = {MemoryMarshalType}.CreateSpan(ref {UnsafeType}.AsRef(in {CollectionSource.GetUnmanagedValuesSource(context)}.GetPinnableReference()), {numElementsIdentifier});"); 254writer.WriteLine($"{TypeNames.System_Span}<{elementMarshaller.TypeInfo.ManagedType.FullTypeName}> {managedSpanIdentifier} = {CollectionSource.GetManagedValuesDestination(context)};"); 267string managedSpanIdentifier = MarshallerHelpers.GetManagedSpanIdentifier(CollectionSource.TypeInfo, context); 268string nativeSpanIdentifier = MarshallerHelpers.GetNativeSpanIdentifier(CollectionSource.TypeInfo, context); 269StubCodeContext elementCodeContext = StubCodeContext.CreateElementMarshallingContext(CollectionSource.CodeContext); 334if (UsesLastIndexMarshalled(CollectionSource.TypeInfo, CollectionSource.CodeContext) 337incrementors += $", ++{MarshallerHelpers.GetLastIndexMarshalledIdentifier(CollectionSource.TypeInfo, context)}"; 361if (UsesLastIndexMarshalled(CollectionSource.TypeInfo, CollectionSource.CodeContext)) 363writer.WriteLine($"int {MarshallerHelpers.GetLastIndexMarshalledIdentifier(CollectionSource.TypeInfo, context)} = 0;");