< Summary

Information
Class: GridForge.Grids.Pools
Assembly: GridForge
File(s): /home/runner/work/GridForge/GridForge/src/GridForge/Grids/Support/Pools.cs
Line coverage
100%
Covered lines: 30
Uncovered lines: 0
Coverable lines: 30
Total lines: 68
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.cctor()100%11100%
ClearPools()100%11100%

File(s)

/home/runner/work/GridForge/GridForge/src/GridForge/Grids/Support/Pools.cs

#LineLine coverage
 1using GridForge.Spatial;
 2using SwiftCollections;
 3using SwiftCollections.Pool;
 4
 5namespace GridForge.Grids;
 6
 7internal static class Pools
 8{
 9    #region Grid Pooling
 10
 11    /// <summary>
 12    /// Object pool for reusing <see cref="VoxelGrid"/> instances.
 13    /// </summary>
 114    public static readonly SwiftObjectPool<VoxelGrid> GridPool = new(
 915        createFunc: () => new VoxelGrid(),
 18216        actionOnRelease: grid => grid.Reset()
 117    );
 18
 19    /// <summary>
 20    /// Object pool for reusing <see cref="Voxel"/> instances.
 21    /// </summary>
 122    public static readonly SwiftObjectPool<Voxel> VoxelPool = new(
 7087623        createFunc: () => new Voxel(),
 7814324        actionOnRelease: voxel => voxel.Reset()
 125    );
 26
 127    public static readonly SwiftObjectPool<SwiftSparseMap<ScanCell>> ScanCellMapPool = new(
 1028        createFunc: () => new SwiftSparseMap<ScanCell>(),
 18629        actionOnRelease: map => map.Clear()
 130    );
 31
 32    /// <summary>
 33    /// Object pool for reusing <see cref="ScanCell"/> instances.
 34    /// </summary>
 135    public static readonly SwiftObjectPool<ScanCell> ScanCellPool = new(
 35936        createFunc: () => new ScanCell(),
 125537        actionOnRelease: cell => cell.Reset()
 138    );
 39
 40    #endregion
 41
 42    #region Node Pooling
 43
 44    /// <summary>
 45    /// Object pool for caching neighbor voxel arrays.
 46    /// </summary>
 147    public static readonly SwiftArrayPool<Voxel> VoxelNeighborPool = new();
 48
 149    public static readonly SwiftDictionaryPool<WorldVoxelIndex, SwiftBucket<IVoxelOccupant>> VoxelOccupantDictionaryPool
 50
 151    public static readonly SwiftObjectPool<SwiftBucket<IVoxelOccupant>> VoxelOccupantBucketPool = new(
 6752        createFunc: () => new SwiftBucket<IVoxelOccupant>(),
 11253        actionOnRelease: bucket => bucket.Clear()
 154    );
 55
 56    #endregion
 57
 58    public static void ClearPools()
 59    {
 260        GridPool.Clear();
 261        VoxelPool.Clear();
 262        ScanCellMapPool.Clear();
 263        ScanCellPool.Clear();
 264        VoxelNeighborPool.Clear();
 265        VoxelOccupantDictionaryPool.Clear();
 266        VoxelOccupantBucketPool.Clear();
 267    }
 68}

Methods/Properties

.cctor()
ClearPools()