Named Objects Library

From TrainzOnline
Revision as of 09:46, 15 October 2018 by Pguy (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Surveyor's Hotkeys
Driver's Hotkeys
Notations
Glossary

Contents

 


Named Objects Library (SP2 and later)

NamedObjectsLib.jpg



The Named Objects Library is a library that may be used to manage information about available named objects in the current session. The library can manage cached data for several common objects type, which can be individually asynchronously refreshed in the background using threads inside the library, and can return at any time synchronously the content of any of the managed caches.

Usually, an asset using the Named Objects Library will first load and initialize the library in its init routine, will then register the objects type to be cached in the library (which will immediately start the asynchronous process of collecting the cached data for this object type), and will later use the cached data by calling the library to retrieve the current cached data. The library uses all the new object search API available since Tane SP2 and will automaticly refresh in the background any expired cache data. Under surveyor mode, all cached data are refreshed every 3 seconds to include new added objects edited under surveyor ; under driver mode only consists cached data are refreshed every 3 seconds to ensure that consists emited from portals are added to the cached data.


The present article is for scripters who wants to use the Named Objects Library and details below how to configure an asset to use the Named Objects Library, how to initialise in an asset the library and how to register the objects type you want to cache, and finaly how later to retrieve the current content of a cache for a specific object type.


Personal tools