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,