| 1234567891011121314151617181920212223242526272829 |
- #ifndef CACHED_SHORTEST_SEQUENCES_H
- #define CACHED_SHORTEST_SEQUENCES_H
- #include <map>
- #include <vector>
- #include <string_view>
- #include <optional>
- #include <functional>
- #include "segmented_sequences.h"
- class CachedShortestSequences {
- private:
- std::map<std::string, std::shared_ptr<SegmentedSequences>> cache_;
- std::map<const SegmentedSequences *, std::shared_ptr<SegmentedSequences>>
- segmented_cache_;
- public:
- std::shared_ptr<SegmentedSequences> Find(
- std::string_view code,
- std::function<std::optional<char>(char, char)> apply_cmd);
- std::shared_ptr<SegmentedSequences> Find(
- std::shared_ptr<SegmentedSequences> codes,
- std::function<std::optional<char>(char, char)> apply_cmd);
- };
- #endif
|