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

class PyramidFileCache in Tinman.Terrain.Pyramids

An file-based cache for IPixelPyramid s and ITexelPyramid s.

sealed class PyramidFileCache extends Disposable
  implements IConfigurable
  IFlushable

Remarks

Instances of PyramidFileCache are automatically shared between threads of the same process. This is transparent to the using code. Pyramid file caches can also be shared between multiple processes resp. machines, with the restriction that all shared pyramid file caches must be opened read-only mode (see Open), which implies that the shared pyramid file cache must have been warmed up in a pre-processing step.

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

Offset     | Type  | Count | Description
-----------+-------+-------+----------------------------------------------------
#0  ..  #7 |  int8 |     8 | Magic value that identifies a file used by a
           |       |       | pyramid cache:
           |       |       | 0x89 0x50 0x59 0x43 0x0D 0x0A 0x1A 0x0A
-----------+-------+-------+----------------------------------------------------
#8  ..  #9 | int16 |     1 | Binary format version (currently 1).
-----------+-------+-------+----------------------------------------------------
#10 .. #17 | int64 |     1 | Maximum file size, in bytes.
-----------+-------+-------+----------------------------------------------------
#18 .. #21 | int32 |     1 | Maximum tile age, in seconds.
-----------+-------+-------+----------------------------------------------------
#22 .. #39 |  int8 |    18 | Reserved (must be all zero).
-----------+-------+-------+----------------------------------------------------
#40 .. #47 | int64 |     1 | Block ID of root of primary tile 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 pyramid cache.
-----------+-------+-------+----------------------------------------------------
The data area of a pyramid cache dataset is managed by an embedded BlockStorage.

Configuration

Config

The configurator object for this type.

public static property Config { get }
type IConfigurator<PyramidFileCache>
value [not-null] The configurator object.

Public / Attributes

LifecycleState

Returns the lifecycle state of this object.

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

Public / Methods

AcquireTry

Acquires a strong reference to this disposable object.

[OwnerReturn, ThreadSafe]
public method AcquireTry ()
type IDisposable
returns this if a new strong reference has been acquired, null if this object is already being disposed.
inherited Disposable.AcquireTry

Remarks:

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

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

Clear

Clears all cached pyramid tile data from the cache.

[ThreadSafe]
public method Clear ()

Create

Creates a new pyramid file cache.

[OwnerReturn]
public static method Create (Path filePath, PyramidFileCacheOptions options = null)
type PyramidFileCache
params filePath [not-null] Path to the cache file.
  options The options to use. If null, the default options will be used.
returns [not-null] The pyramid file cache.

CreateOrOpen

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

[OwnerReturn]
public static method CreateOrOpen (Path filePath, PyramidFileCacheOptions options = null)
type PyramidFileCache
params filePath [not-null] Path to the cache file.
  options The options to use. If null, the default options will be used.
returns [not-null] The pyramid file cache.

Remarks:

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

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.

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.

Open

Opens an existing pyramid file cache.

[OwnerReturn]
public static method Open (Path filePath, bool readOnly = false)
type PyramidFileCache
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 pyramid file cache.

ToConfig

Returns the configuration value that describes this object.

public method ToConfig ()
type ConfigValue
returns [not-null] The configuration value.
implements IConfigurable.ToConfig

Remarks:

All configurable objects need to implement this interface. For simple types, it is preferable to delegate to ToValue.

The returned value may be of type Invalid, which means that this object in its current state cannot be described with the configuration API.

Before returning the resulting configuration value, Cache must be called on it, passing this IConfigurable object as parameter.