Quick Links:

bal | bbl | bdl | bsl

Static Public Member Functions

bdlt::DefaultTimetableCache Struct Reference

#include <bdlt_defaulttimetablecache.h>

List of all members.

Static Public Member Functions

static void destroy ()
static int initialize (TimetableLoader *loader, bslma::Allocator *allocator)
static int initialize (TimetableLoader *loader, const bsls::TimeInterval &timeout, bslma::Allocator *allocator)
static TimetableCacheinstance ()

Detailed Description

This struct provides a namespace for functions that manage the lifetime of, and access to, a process-wide default bdlt::TimetableCache object. The default cache is initialized by an explicit call to the initialize class method, and destroyed by the destroy class method. The default cache may be initialized and destroyed multiple times during the lifetime of a process. The lifetimes of the timetable loader and memory allocator supplied to initialize must extend beyond the following (matching) call to destroy.

All methods of this struct are fully thread-safe (see bsldoc_glossary).

See Component bdlt_defaulttimetablecache


Member Function Documentation

static void bdlt::DefaultTimetableCache::destroy (  )  [static]

Destroy the default TimetableCache object managed by this class. If the default cache is not in the initialized state, this method has no effect. Note that all addresses returned by earlier calls to instance are invalidated by this method.

static int bdlt::DefaultTimetableCache::initialize ( TimetableLoader loader,
bslma::Allocator allocator 
) [static]

Initialize the default TimetableCache object managed by this class to use the specified loader to obtain timetables, to have no timeout, and to use the specified allocator to supply memory. If the default cache is already in the initialized state, this method has no effect. Return 0 on success, and a non-zero value otherwise. The behavior is undefined unless loader and allocator remain valid until a subsequent call to destroy.

static int bdlt::DefaultTimetableCache::initialize ( TimetableLoader loader,
const bsls::TimeInterval timeout,
bslma::Allocator allocator 
) [static]

Initialize the default TimetableCache object managed by this class to use the specified loader to obtain timetables, to have the specified timeout, and to use the specified allocator to supply memory. If the default cache is already in the initialized state, this method has no effect. Return 0 on success, and a non-zero value otherwise. The behavior is undefined unless loader and allocator remain valid until a subsequent call to destroy, and bsls::TimeInterval() <= timeout <= bsls::TimeInterval(INT_MAX, 0). Note that a timeout value of 0 indicates that a timetable will be loaded into the default cache by each (successful) call to TimetableCache::getTimetable on the cache returned by instance.

static TimetableCache* bdlt::DefaultTimetableCache::instance (  )  [static]

Return an address providing modifiable access to the default TimetableCache object managed by this class, if the default cache is in the initialized state, and 0 otherwise. The cache obtains timetables using the loader that was supplied to the initialize method. Note that the returned address is invalidated by a subsequent call to destroy.


The documentation for this struct was generated from the following file: