AceTime  1.2
Date and time classes for Arduino that support timezones from the TZ Database, and a system clock that can synchronize from an NTP server or an RTC chip.
Public Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
ace_time::ZoneRegistrar< ZI, ZRB, ZIB, STRCMP_P, STRCMP_PP > Class Template Reference

Class that allows looking up the ZoneInfo (ZI) from its TZDB identifier (e.g. More...

#include <ZoneRegistrar.h>

Public Member Functions

 ZoneRegistrar (uint16_t registrySize, const ZI *const *zoneRegistry)
 Constructor.
 
uint16_t registrySize () const
 Return the number of zones.
 
bool isSorted () const
 Return true if zoneRegistry is sorted, and eligible to use a binary search.
 
const ZI * getZoneInfoForIndex (uint16_t i) const
 
const ZI * getZoneInfoForName (const char *name) const
 Return the ZoneInfo corresponding to the given zone name. More...
 
const ZI * getZoneInfoForId (uint32_t zoneId) const
 

Static Protected Member Functions

static bool isSorted (const ZI *const *zr, uint16_t registrySize)
 
static const ZI * linearSearch (const ZI *const *zr, uint16_t registrySize, const char *name)
 
static const ZI * binarySearch (const ZI *const *zr, uint16_t registrySize, const char *name)
 
static const ZI * linearSearchUsingId (const ZI *const *zr, uint16_t registrySize, uint32_t zoneId)
 

Protected Attributes

const uint16_t mRegistrySize
 
const ZI *const *const mZoneRegistry
 
const bool mIsSorted
 

Static Protected Attributes

static const uint8_t kBinarySearchThreshold = 6
 Use binarySearch() if registrySize >= threshold.
 

Friends

class ::BasicZoneRegistrarTest_Sorted_isSorted
 
class ::BasicZoneRegistrarTest_Sorted_linearSearch
 
class ::BasicZoneRegistrarTest_Sorted_linearSearch_not_found
 
class ::BasicZoneRegistrarTest_Sorted_binarySearch
 
class ::BasicZoneRegistrarTest_Sorted_binarySearch_not_found
 
class ::BasicZoneRegistrarTest_Unsorted_isSorted
 
class ::BasicZoneRegistrarTest_Unsorted_linearSearch
 

Detailed Description

template<typename ZI, typename ZRB, typename ZIB, strcmp_t STRCMP_P, strcmp_t STRCMP_PP>
class ace_time::ZoneRegistrar< ZI, ZRB, ZIB, STRCMP_P, STRCMP_PP >

Class that allows looking up the ZoneInfo (ZI) from its TZDB identifier (e.g.

"America/Los_Angeles"), or index, or zoneId (hash from its name).

Template Parameters
ZIZoneInfo type (e.g. basic::ZoneInfo)
ZRBZoneRegistryBroker type (e.g. basic::ZoneRegistryBroker)
ZIBZoneInfoBroker type (e.g. basic::ZoneInfoBroker)
STRCMP_Pa function that compares a normal string to flash string (e.g strcmp_P())
STRCMP_PPa function that compares 2 flash strings (must be custom written)

Definition at line 43 of file ZoneRegistrar.h.

Member Function Documentation

◆ getZoneInfoForName()

template<typename ZI , typename ZRB , typename ZIB , strcmp_t STRCMP_P, strcmp_t STRCMP_PP>
const ZI* ace_time::ZoneRegistrar< ZI, ZRB, ZIB, STRCMP_P, STRCMP_PP >::getZoneInfoForName ( const char *  name) const
inline

Return the ZoneInfo corresponding to the given zone name.

Return nullptr if not found.

Definition at line 69 of file ZoneRegistrar.h.


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