2018-11-28 11:37:12 +00:00
|
|
|
#include "RegionsHierarchies.h"
|
2017-08-24 14:51:13 +00:00
|
|
|
|
|
|
|
#include <Poco/DirectoryIterator.h>
|
2018-12-10 15:25:45 +00:00
|
|
|
#include <common/logger_useful.h>
|
2017-08-24 14:51:13 +00:00
|
|
|
|
2017-01-21 04:24:28 +00:00
|
|
|
|
2017-11-28 22:15:06 +00:00
|
|
|
RegionsHierarchies::RegionsHierarchies(IRegionsHierarchiesDataProviderPtr data_provider)
|
2017-02-07 12:25:18 +00:00
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
Logger * log = &Logger::get("RegionsHierarchies");
|
2017-01-21 04:24:28 +00:00
|
|
|
|
2017-11-28 22:15:06 +00:00
|
|
|
LOG_DEBUG(log, "Adding default regions hierarchy");
|
|
|
|
data.emplace("", data_provider->getDefaultHierarchySource());
|
2017-01-21 04:24:28 +00:00
|
|
|
|
2017-11-28 22:15:06 +00:00
|
|
|
for (const auto & name : data_provider->listCustomHierarchies())
|
2017-04-01 07:20:54 +00:00
|
|
|
{
|
2017-11-28 22:15:06 +00:00
|
|
|
LOG_DEBUG(log, "Adding regions hierarchy for " << name);
|
|
|
|
data.emplace(name, data_provider->getHierarchySource(name));
|
2017-04-01 07:20:54 +00:00
|
|
|
}
|
2017-08-24 14:51:13 +00:00
|
|
|
|
|
|
|
reload();
|
2017-01-21 04:24:28 +00:00
|
|
|
}
|