mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-10-15 10:04:44 +00:00
Formatting
This commit is contained in:
@@ -14,16 +14,16 @@
|
||||
* @brief Interface for services that can enrich a location with context.
|
||||
*/
|
||||
class IEnrichmentService {
|
||||
public:
|
||||
virtual ~IEnrichmentService() = default;
|
||||
public:
|
||||
virtual ~IEnrichmentService() = default;
|
||||
|
||||
/**
|
||||
* @brief Resolves contextual enrichment for a location.
|
||||
*
|
||||
* @param loc City to enrich.
|
||||
* @return Context text, or an empty string if unavailable.
|
||||
*/
|
||||
virtual std::string GetLocationContext(const City& loc) = 0;
|
||||
/**
|
||||
* @brief Resolves contextual enrichment for a location.
|
||||
*
|
||||
* @param loc City to enrich.
|
||||
* @return Context text, or an empty string if unavailable.
|
||||
*/
|
||||
virtual std::string GetLocationContext(const City& loc) = 0;
|
||||
};
|
||||
|
||||
#endif // BIERGARTEN_PIPELINE_INCLUDES_SERVICES_ENRICHMENT_ENRICHMENT_SERVICE_H_
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
* @brief Enrichment service that returns no context for any location.
|
||||
*/
|
||||
class MockEnrichmentService final : public IEnrichmentService {
|
||||
public:
|
||||
std::string GetLocationContext(const City& /*loc*/) override {
|
||||
return {};
|
||||
}
|
||||
public:
|
||||
std::string GetLocationContext(const City& /*loc*/) override { return {}; }
|
||||
};
|
||||
#endif // BIERGARTEN_PIPELINE_INCLUDES_SERVICES_ENRICHMENT_MOCK_ENRICHMENT_H_
|
||||
|
||||
@@ -19,30 +19,30 @@
|
||||
* @brief Provides Wikipedia summary lookups backed by cached raw extracts.
|
||||
*/
|
||||
class WikipediaEnrichmentService final : public IEnrichmentService {
|
||||
public:
|
||||
/**
|
||||
* @brief Creates a new Wikipedia service with the provided web client.
|
||||
*/
|
||||
explicit WikipediaEnrichmentService(std::unique_ptr<WebClient> client,
|
||||
std::shared_ptr<ILogger> logger);
|
||||
public:
|
||||
/**
|
||||
* @brief Creates a new Wikipedia service with the provided web client.
|
||||
*/
|
||||
explicit WikipediaEnrichmentService(std::unique_ptr<WebClient> client,
|
||||
std::shared_ptr<ILogger> logger);
|
||||
|
||||
/**
|
||||
* @brief Returns the Wikipedia-derived context for a location.
|
||||
*/
|
||||
[[nodiscard]] std::string GetLocationContext(const City& loc) override;
|
||||
/**
|
||||
* @brief Returns the Wikipedia-derived context for a location.
|
||||
*/
|
||||
[[nodiscard]] std::string GetLocationContext(const City& loc) override;
|
||||
|
||||
private:
|
||||
std::string FetchExtract(std::string_view query);
|
||||
std::unique_ptr<WebClient> client_;
|
||||
std::shared_ptr<ILogger> logger_;
|
||||
/**
|
||||
* @brief Cache for raw Wikipedia query extracts, keyed by query string.
|
||||
*
|
||||
* GetLocationContext() always queries "brewing" and reuses "beer in
|
||||
* {country}" for every city in that country, so caching avoids refetching
|
||||
* the same extract across locations in a run.
|
||||
*/
|
||||
std::unordered_map<std::string, std::string> extract_cache_;
|
||||
private:
|
||||
std::string FetchExtract(std::string_view query);
|
||||
std::unique_ptr<WebClient> client_;
|
||||
std::shared_ptr<ILogger> logger_;
|
||||
/**
|
||||
* @brief Cache for raw Wikipedia query extracts, keyed by query string.
|
||||
*
|
||||
* GetLocationContext() always queries "brewing" and reuses "beer in
|
||||
* {country}" for every city in that country, so caching avoids refetching
|
||||
* the same extract across locations in a run.
|
||||
*/
|
||||
std::unordered_map<std::string, std::string> extract_cache_;
|
||||
};
|
||||
|
||||
#endif // BIERGARTEN_PIPELINE_INCLUDES_SERVICES_ENRICHMENT_WIKIPEDIA_SERVICE_H_
|
||||
|
||||
Reference in New Issue
Block a user