AceTime  2.2.0
Date and time classes for Arduino that support timezones from the TZ Database.
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ace_time::ZoneManagerTemplate< ZI, ZRR, ZP, Z > Class Template Reference

A templatized implementation of ZoneManager that binds the ZoneRegistrar with the corresponding (Basic|Extended)ZoneProcessorCache. More...

#include <ZoneManager.h>

Inheritance diagram for ace_time::ZoneManagerTemplate< ZI, ZRR, ZP, Z >:
Inheritance graph
[legend]
Collaboration diagram for ace_time::ZoneManagerTemplate< ZI, ZRR, ZP, Z >:
Collaboration graph
[legend]

Public Member Functions

TimeZone createForZoneName (const char *name)
 Create a TimeZone for the given zone name (e.g. More...
 
TimeZone createForZoneId (uint32_t id)
 Create a TimeZone for the given 32-bit zoneId.
 
TimeZone createForZoneIndex (uint16_t index)
 Create a TimeZone for the given index in the ZoneInfo registry that was used to create this ZoneManager.
 
TimeZone createForTimeZoneData (const TimeZoneData &d)
 Create a TimeZone from the TimeZoneData created by TimeZone::toTimeZoneData().
 
uint16_t indexForZoneName (const char *name) const
 Find the registry index for the given time zone name. More...
 
uint16_t indexForZoneId (uint32_t id) const
 Find the registry index for the given time zone id. More...
 
uint16_t zoneRegistrySize () const
 Return the number of elements in the Zone and Fat Link registry. More...
 
TimeZone createForZoneInfo (const ZI *zoneInfo)
 Create a TimeZone from an explicit ZoneInfo reference. More...
 
ZP * getZoneProcessor (const char *name)
 Return the ZoneProcessor for given zone name. More...
 
getZoneForIndex (uint16_t index) const
 Return the Zone wrapper object for the given index.
 
void resetZoneProcessors ()
 Reset the transition cache of the zone processors in the cache. More...
 

Protected Member Functions

 ZoneManagerTemplate (uint16_t zoneRegistrySize, const ZI *const *zoneRegistry, ZoneProcessorCacheBaseTemplate< ZP > &zoneProcessorCache)
 Constructor. More...
 
 ZoneManagerTemplate (const ZoneManagerTemplate &)=delete
 
ZoneManagerTemplateoperator= (const ZoneManagerTemplate &)=delete
 

Protected Attributes

const ZRR mZoneRegistrar
 
ZoneProcessorCacheBaseTemplate< ZP > & mZoneProcessorCache
 

Additional Inherited Members

- Static Public Attributes inherited from ace_time::ZoneManager
static const uint16_t kInvalidIndex = 0xffff
 Registry index which is not valid. More...
 

Detailed Description

template<typename ZI, typename ZRR, typename ZP, typename Z>
class ace_time::ZoneManagerTemplate< ZI, ZRR, ZP, Z >

A templatized implementation of ZoneManager that binds the ZoneRegistrar with the corresponding (Basic|Extended)ZoneProcessorCache.

Applications will normally use two specific instantiation of this class: BasicZoneManager and ExtendedZoneManager.

If an entry in the ZoneRegistrar is not found, then TimeZone::forError() will be returned.

If a ZoneProcessor exists in the ZoneProcessorCache that is already bound to the given ZoneInfo, then the ZoneProcessor is reused. If not, another ZoneProcessor is picked from the cache in a round-robin fashion (kicking off the previously bound TimeZone). The type of the TimeZone will be assigned based on the ZoneProcessor, which will be either kTypeBasic or kTypeExtended.

Template Parameters
ZItype of ZoneInfo (basic::ZoneInfo or extended::ZoneInfo) which make up the zone registry
ZRRclass of ZoneRegistrar which holds the registry of ZoneInfo (e.g. basic::ZoneRegistrar, extended::ZoneRegistrar)
ZPclass of ZoneProcessor (e.g. BasicZoneProcessor, ExtendedZoneProcessor)
Zzone wrapper class, either BasicZone or ExtendedZone

Definition at line 88 of file ZoneManager.h.

Constructor & Destructor Documentation

◆ ZoneManagerTemplate()

template<typename ZI , typename ZRR , typename ZP , typename Z >
ace_time::ZoneManagerTemplate< ZI, ZRR, ZP, Z >::ZoneManagerTemplate ( uint16_t  zoneRegistrySize,
const ZI *const *  zoneRegistry,
ZoneProcessorCacheBaseTemplate< ZP > &  zoneProcessorCache 
)
inlineprotected

Constructor.

Parameters
zoneRegistrySizenumber of ZoneInfo entries in zoneRegistry
zoneRegistryan array of ZoneInfo entries

Definition at line 202 of file ZoneManager.h.

Member Function Documentation

◆ createForZoneInfo()

template<typename ZI , typename ZRR , typename ZP , typename Z >
TimeZone ace_time::ZoneManagerTemplate< ZI, ZRR, ZP, Z >::createForZoneInfo ( const ZI *  zoneInfo)
inline

Create a TimeZone from an explicit ZoneInfo reference.

The ZoneRegistrar will be bypassed because the ZoneInfo is already available, but the TimeZone will use a ZoneProcessor from its ZoneProcessorCache. This is expected to be used mostly in tests, but it could be useful for applications.

Definition at line 164 of file ZoneManager.h.

◆ createForZoneName()

template<typename ZI , typename ZRR , typename ZP , typename Z >
TimeZone ace_time::ZoneManagerTemplate< ZI, ZRR, ZP, Z >::createForZoneName ( const char *  name)
inline

Create a TimeZone for the given zone name (e.g.

"America/Los_Angeles").

Definition at line 93 of file ZoneManager.h.

◆ getZoneProcessor()

template<typename ZI , typename ZRR , typename ZP , typename Z >
ZP* ace_time::ZoneManagerTemplate< ZI, ZRR, ZP, Z >::getZoneProcessor ( const char *  name)
inline

Return the ZoneProcessor for given zone name.

Mostly for debugging purposes.

Definition at line 175 of file ZoneManager.h.

◆ indexForZoneId()

template<typename ZI , typename ZRR , typename ZP , typename Z >
uint16_t ace_time::ZoneManagerTemplate< ZI, ZRR, ZP, Z >::indexForZoneId ( uint32_t  id) const
inline

Find the registry index for the given time zone id.

Returns kInvalidIndex if not found.

Definition at line 145 of file ZoneManager.h.

◆ indexForZoneName()

template<typename ZI , typename ZRR , typename ZP , typename Z >
uint16_t ace_time::ZoneManagerTemplate< ZI, ZRR, ZP, Z >::indexForZoneName ( const char *  name) const
inline

Find the registry index for the given time zone name.

Returns kInvalidIndex if not found.

Definition at line 137 of file ZoneManager.h.

◆ resetZoneProcessors()

template<typename ZI , typename ZRR , typename ZP , typename Z >
void ace_time::ZoneManagerTemplate< ZI, ZRR, ZP, Z >::resetZoneProcessors ( )
inline

Reset the transition cache of the zone processors in the cache.

Useful when Epoch::currentEpochYear() is changed at runtime.

Definition at line 191 of file ZoneManager.h.

◆ zoneRegistrySize()

template<typename ZI , typename ZRR , typename ZP , typename Z >
uint16_t ace_time::ZoneManagerTemplate< ZI, ZRR, ZP, Z >::zoneRegistrySize ( ) const
inline

Return the number of elements in the Zone and Fat Link registry.

Previously named registrySize().

Definition at line 153 of file ZoneManager.h.


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