TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

class DatasetFileCache in Tinman.Terrain.Datasets

An file-based cache for IDataset s.

sealed class DatasetFileCache extends Disposable
  implements IFlushable

Remarks

Dataset file caches can be shared between multiple processes resp. machines, with the restriction that all shared dataset file caches must be opened read-only mode (see Open), which implies that the shared dataset file cache must have been warmed up in a pre-processing step.

The following table shows the binary layout of a dataset cache (multibyte values are encoded as LittleEndian).

Offset     | Type  | Count | Description
-----------+-------+-------+----------------------------------------------------
#0  ..  #7 |  int8 |     8 | Magic value that identifies a file used by a
           |       |       | dataset cache:
           |       |       | 0x89 0x48 0x47 0x43 0x0D 0x0A 0x1A 0x0A
-----------+-------+-------+----------------------------------------------------
#8  ..  #9 | int16 |     1 | Binary format version (currently 1).
-----------+-------+-------+----------------------------------------------------
#10 .. #17 | int64 |     1 | Maximum file size, in bytes.
-----------+-------+-------+----------------------------------------------------
#18 .. #39 |  int8 |    22 | Reserved (must be all zero).
-----------+-------+-------+----------------------------------------------------
#40 .. #47 | int64 |     1 | Block ID of root of primary block index.
-----------+-------+-------+----------------------------------------------------
#48 .. #55 |  int8 |     8 | Reserved, must be zero.
-----------+-------+-------+----------------------------------------------------
#56 .. #63 | int64 |     1 | Block ID of root of timestamp index "LastUsed".
-----------+-------+-------+----------------------------------------------------
#64 .. EOF |  int8 |     ? | Data area of dataset cache.
-----------+-------+-------+----------------------------------------------------
The data area of a dataset cache is managed by an embedded BlockStorage.

Public / Attributes

IsSoleOwnership

Will this object be disposed upon the next call to Dispose?

[ThreadSafe]
public property IsSoleOwnership { get }
type bool
value true if the object will be disposed when Dispose is called,
false if the object will not be disposed, because some other code is still holding shared ownership (see AcquireBase).
inherited Disposable.IsSoleOwnership

LifecycleState

Returns the lifecycle state of this object.

public property LifecycleState { get }
type LifecycleState
value The lifecycle state.
inherited Disposable.LifecycleState

Public / Constructors

Create

Creates a new dataset file cache.

[OwnerReturn]
public static method Create (Path filePath, int64 maximumFileSize = 0)
type DatasetFileCache
params filePath [not-null] Path to the cache file.
  maximumFileSize [>=0] The maximum file size, in bytes. If zero, the file size will be unlimited. Defaults to 0.
returns [not-null] The dataset file cache.

Exceptions:

CreateOrOpen

Opens an existing dataset file cache or creates a new one if necessary.

[OwnerReturn]
public static method CreateOrOpen (Path filePath, int64 maximumFileSize = 0)
type DatasetFileCache
params filePath [not-null] Path to the cache file.
  maximumFileSize [>=0] The maximum file size, in bytes. If zero, the file size will be unlimited. Defaults to 0.
returns [not-null] The dataset file cache.

Remarks:

If the given file path points to a non-existent file, a new dataset file cache with the given properties will be created. If the file path refers to an existing dataset file cache, it will be opened iff its properties match maximumFileSize- otherwise a new dataset file cache is created and the existing one is overwritten.

Exceptions:

Open

Opens an existing dataset file cache.

[OwnerReturn]
public static method Open (Path filePath, bool readOnly = false)
type DatasetFileCache
params filePath [not-null] Path to the cache file.
  readOnly Open pyramid file cache in read-only mode? Use this for sharing warmed-up file caches between multiple processes or machines. Defaults to false.
returns [not-null] The dataset file cache.

Exceptions:

Public / Methods

AcquireBase

Acquires a strong reference to this disposable object.

[OwnerReturn, Pure]
public method AcquireBase (bool allowNull = false)
type IDisposable
params allowNull Depicts what to do when this object is no longer valid:
true: return null
false: throw an exception
returns The strong reference to this disposable object or null iff allowNull is true and this object is no longer valid.
inherited Disposable.AcquireBase

Remarks:

The object will not be actually disposed by calls to IDisposable when there is at least one strong reference left. Code that calls this method is responsible for calling the IDisposable method accordingly.

This method is not intended to be used in performance-critical code. It should only be used to high-level resource management.

Using this method usually requires type casting. Subclasses may additionally implement IDisposableGeneric, in order to provide some syntactic sugar for that.

Exceptions:

Clear

Clears all cached dataset content from the cache.

[ThreadSafe]
public method Clear ()

Exceptions:

Dispose

Releases all resources held by this object if there are no more strong references to it, decrements the reference counter by one otherwise.

[Dispose, OwnerThis, ThreadSafe]
public method Dispose ()
inherited Disposable.Dispose

Remarks:

The Dispose method silently returns if the object has already been disposed.

Implementing methods must not throw any exceptions.

Flush

Flushes all cached data.

public method Flush ()
implements IFlushable.Flush

Remarks:

Performing a flush may result in I/O work. Depending on the semantics of the implementing class, this work may need to be wrapped in special Begin/End method calls. See the documentation of the implementing classes for details.

In case this object represents a read-only resource, calling the Flush method has no effect.

Exceptions: