6 #ifndef ACE_TIME_ZONE_PROCESSOR_CACHE_H 7 #define ACE_TIME_ZONE_PROCESSOR_CACHE_H 9 #include "common/common.h" 10 #include "TimeOffset.h" 11 #include "OffsetDateTime.h" 12 #include "BasicZoneProcessor.h" 13 #include "ExtendedZoneProcessor.h" 14 #include "ZoneRegistrar.h" 27 static const uint8_t kTypeExtendedManaged =
56 template<u
int8_t SIZE, u
int8_t TYPE,
typename ZS,
typename ZI,
typename ZIB>
61 uint8_t
getType()
override {
return TYPE; }
65 ZS* zoneProcessor = findUsingZoneInfo((
const ZI*) zoneInfo);
66 if (zoneProcessor)
return zoneProcessor;
69 zoneProcessor = &mZoneProcessors[mCurrentIndex];
71 if (mCurrentIndex >= SIZE) mCurrentIndex = 0;
72 zoneProcessor->setZoneInfo((
const ZI*) zoneInfo);
86 ZS* findUsingZoneInfo(
const ZI* zoneInfoKey) {
87 for (uint8_t i = 0; i < SIZE; i++) {
88 const ZI* zoneInfo = (
const ZI*) mZoneProcessors[i].getZoneInfo();
89 if (zoneInfo == zoneInfoKey) {
90 return &mZoneProcessors[i];
96 ZS mZoneProcessors[SIZE];
97 uint8_t mCurrentIndex = 0;
101 template<u
int8_t SIZE>
103 SIZE, ZoneProcessorCache::kTypeBasicManaged,
104 BasicZoneProcessor, basic::ZoneInfo, basic::ZoneInfoBroker> {
107 template<u
int8_t SIZE>
109 SIZE, ZoneProcessorCache::kTypeExtendedManaged,
110 ExtendedZoneProcessor, extended::ZoneInfo, extended::ZoneInfoBroker> {
120 template<u
int8_t SIZE>
122 SIZE, ZoneProcessorCache::kTypeBasicManaged,
125 template<u
int8_t SIZE>
127 SIZE, ZoneProcessorCache::kTypeExtendedManaged,
Base interface for ZoneProcessor classes.
uint8_t getType() override
Return the type of this cache.
A cache of ZoneProcessors that provides a ZoneProcessor to the TimeZone upon request.
Representation of a given time zone, implemented as an array of ZoneEra records.
static const uint8_t kTypeExtended
Indicate ExtendedZoneProcessor.
virtual ZoneProcessor * getZoneProcessor(const void *zoneInfo)=0
Get ZoneProcessor from either a basic::ZoneInfo or an extended::ZoneInfo.
ZoneProcessor * getZoneProcessor(const void *zoneInfo) override
Get the ZoneProcessor from the zoneInfo.
Representation of a given time zone, implemented as an array of ZoneEra records.
virtual uint8_t getType()=0
Return the type of this cache.
An implementation of ZoneProcessor that supports for all zones defined by the TZ Database.
An implementation of ZoneProcessor that supports a subset of the zones containing in the TZ Database...
Data broker for accessing ZoneInfo.
Common interface to BasicZoneProcessorCache and ExtendedZoneProcessorCache.
static const uint8_t kTypeBasic
Indicate BasicZoneProcessor.
Data broker for accessing ZoneInfo.