Ara3D.Buffers 1.3.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Ara3D.Buffers --version 1.3.0                
NuGet\Install-Package Ara3D.Buffers -Version 1.3.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Ara3D.Buffers" Version="1.3.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Ara3D.Buffers --version 1.3.0                
#r "nuget: Ara3D.Buffers, 1.3.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Ara3D.Buffers as a Cake Addin
#addin nuget:?package=Ara3D.Buffers&version=1.3.0

// Install Ara3D.Buffers as a Cake Tool
#tool nuget:?package=Ara3D.Buffers&version=1.3.0                

Ara3D.Buffers

A collection of utilities for working with large arrays of unmanaged types.

IBuffer

The IBuffer interface is presents a simple interface for an array of unmanaged types, where the type is not known at compile-time.

This allows us to work more easily with collections of buffers where the underlying type can vary at run-time.

   /// <summary>
   /// Provides an interface to an object that manages a potentially
   /// large array of elements all of the same unmanaged type.
   /// </summary>
   public interface IBuffer
   {
       Array Data { get; }
       void WithPointer(Action<IntPtr> action);
       int ElementSize { get; }
   }

The total number of bytes is determined by multiply the data array by the element size. This is provided in an extension function

    public static long GetNumBytes(this IBuffer buffer)
        => (long)buffer.NumElements() * buffer.ElementSize;

Accessing the raw bytes can be done using a pattern similar to:

    public static unsafe void Write(this Stream stream, IBuffer buffer)
        => buffer.WithPointer(ptr => {
            stream.WriteBytesBuffered((byte*)ptr.ToPointer(), buffer.GetNumBytes());
        });

INamedBuffer

Frequently a buffer is associated with a name or identifier. The INamedBuffer introduces a string name property, for convenience.

Use Case

This structure is particularly useful when serializing and manipulating raw memory such as attribute buffers associated with 3D geometry, ZIP files (or other binary archive formats), or color data associated with bitmaps.

Documentation

This is a very small library, and we recommend reading the source code and looking at some projects that use it:

  • Ara3D.Graphics
  • Ara3D.Serialization.BFAST
  • Ara3D.Serialization.G3D
  • Ara3D.Serialization.VIM

Size Limitations

Due to limitations in C# the array can have at most 2^31 elements (approximately 2 billion).

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on Ara3D.Buffers:

Package Downloads
Ara3D.Serialization.BFAST

A library for reading and writing collections of arrays of binary data (archives).

Ara3D.Serialization.VIM

A library for reading and writing architectural BIM models in the VIM format.

Ara3D.Graphics

A library for working with and rendering 2D and 3D graphics.

Speckle.WebIfc.Importer

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.4.5 251 10/9/2024
1.4.4 279 8/25/2024
1.4.3 234 3/19/2024
1.4.1 222 3/12/2024
1.3.2 105 3/5/2024
1.3.0 112 3/3/2024