aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Dictionaries/Embedded/GeodataProviders/IHierarchiesProvider.h
blob: f7d511354406e2348ae5ff723556f26683ff4032 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#pragma once

#include <memory>
#include <string>
#include <vector>
#include "Entries.h"


// Iterates over all regions in data source
class IRegionsHierarchyReader
{
public:
    virtual bool readNext(RegionEntry & entry) = 0;

    virtual ~IRegionsHierarchyReader() {}
};

using IRegionsHierarchyReaderPtr = std::unique_ptr<IRegionsHierarchyReader>;


// Data source for single regions hierarchy
class IRegionsHierarchyDataSource
{
public:
    // data modified since last createReader invocation
    virtual bool isModified() const = 0;

    virtual IRegionsHierarchyReaderPtr createReader() = 0;

    virtual ~IRegionsHierarchyDataSource() = default;
};

using IRegionsHierarchyDataSourcePtr = std::shared_ptr<IRegionsHierarchyDataSource>;


// Provides data sources for different regions hierarchies
class IRegionsHierarchiesDataProvider
{
public:
    virtual std::vector<std::string> listCustomHierarchies() const = 0;

    virtual IRegionsHierarchyDataSourcePtr getDefaultHierarchySource() const = 0;
    virtual IRegionsHierarchyDataSourcePtr getHierarchySource(const std::string & name) const = 0;

    virtual ~IRegionsHierarchiesDataProvider() = default;
};

using IRegionsHierarchiesDataProviderPtr = std::shared_ptr<IRegionsHierarchiesDataProvider>;