Quick Links:

bal | bbl | bdl | bsl

Static Public Member Functions

bdlt::DefaultCalendarCache Struct Reference

#include <bdlt_defaultcalendarcache.h>

List of all members.

Static Public Member Functions

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

Detailed Description

This struct provides a namespace for functions that manage the lifetime of, and access to, a process-wide default bdlt::CalendarCache 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 calendar 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_defaultcalendarcache


Member Function Documentation

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

Destroy the default CalendarCache 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::DefaultCalendarCache::initialize ( CalendarLoader loader,
bslma::Allocator allocator 
) [static]

Initialize the default CalendarCache object managed by this class to use the specified loader to obtain calendars, 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::DefaultCalendarCache::initialize ( CalendarLoader loader,
const bsls::TimeInterval timeout,
bslma::Allocator allocator 
) [static]

Initialize the default CalendarCache object managed by this class to use the specified loader to obtain calendars, 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 calendar will be loaded into the default cache by each (successful) call to CalendarCache::getCalendar on the cache returned by instance.

static CalendarCache* bdlt::DefaultCalendarCache::instance (  )  [static]

Return an address providing modifiable access to the default CalendarCache object managed by this class, if the default cache is in the initialized state, and 0 otherwise. The cache obtains calendars 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: