Loader
Description
- Derived from
-
Disposable abstract
A helper class for loading objects asynchronously using background tasks.
To set up a Loader object, performs the following steps:
-
Choose a base path to use for resolving relative paths (see BasePath) and create a Loader object.
-
Call Begin to start submitting load jobs, using the specified LoaderDelegate. The static
Load*methods of this class perform loading of various built-in objects. With the Wrap method, IHeightmapProvider object can be used directly. -
Use Load1, Load2, PushLoad1 and PushLoad2 to start loading objects asynchronously.
-
Use Wait and IsIdle to query the status of the pending load jobs. The Get, GetNull and PopLoad method can be used to fetch the loaded objects.
The Loader uses canonical Path values to identify objects and their associated load jobs. To obtain that value up-front without loading any object, use the Normalize method.
- See also
Public / Methods
Get
Fetches the result of the given load job, waiting for it to finish if necessary.
If an object has been loaded but the requested type does not match, DisposableUtil.DisposeOrDelete is used to dispose the loaded object.
- IOException
-
If the load job has failed, in which case the result is considered having been fetched, or if GetNull would have returned
null, indicated by IOError.BadPath.
- See also
GetNull
Fetches the result of the given load job, waiting for it to finish if necessary.
If an object has been loaded but the requested type does not match, DisposableUtil.DisposeOrDelete is used to dispose the loaded object.
- IOException
-
If the load job has failed, in which case the result is considered having been fetched.
- See also
Load
2 overloads
Submits a load job for the given object.
- See also
Submits a load job for the given object.
- See also
LoadShape
A LoaderDelegate that uses IShapeReader.ReadAll of ShapeFormat.ReadShapes1 of ShapeFormat.Any.
- TinmanException
-
If loading has failed.
PopLoad
Fetches the result of the oldest load job in the internal queue, waiting for it to finish if necessary.
If an object has been loaded but the requested type does not match, DisposableUtil.DisposeOrDelete is used to dispose the loaded object.
- IOException
-
If the load job has failed, in which case the result is considered having been fetched, or if GetNull would have returned
null, indicated by IOError.BadPath.
- See also
Public / Attributes
BasePath
Returns the base path of this loader.
The base path is used by Normalize to resolve relative paths.
- See also