destruct static vector and unorderd_map when last RasterContainer is destructed.
This commit is contained in:
parent
f9ee74d78e
commit
a587b14006
@ -126,7 +126,14 @@ class RasterSource
|
|||||||
class RasterContainer
|
class RasterContainer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RasterContainer() = default;
|
RasterContainer() { ++count; }
|
||||||
|
~RasterContainer() {
|
||||||
|
--count;
|
||||||
|
if (0 == count) {
|
||||||
|
LoadedSources.clear();
|
||||||
|
LoadedSourcePaths.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int LoadRasterSource(const std::string &path_string,
|
int LoadRasterSource(const std::string &path_string,
|
||||||
double xmin,
|
double xmin,
|
||||||
@ -143,6 +150,7 @@ class RasterContainer
|
|||||||
private:
|
private:
|
||||||
static std::vector<RasterSource> LoadedSources;
|
static std::vector<RasterSource> LoadedSources;
|
||||||
static std::unordered_map<std::string, int> LoadedSourcePaths;
|
static std::unordered_map<std::string, int> LoadedSourcePaths;
|
||||||
|
static int count;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,6 +81,7 @@ RasterDatum RasterSource::GetRasterInterpolate(const int lon, const int lat) con
|
|||||||
// static member of Raster Container
|
// static member of Raster Container
|
||||||
std::vector<RasterSource> RasterContainer::LoadedSources;
|
std::vector<RasterSource> RasterContainer::LoadedSources;
|
||||||
std::unordered_map<std::string, int> RasterContainer::LoadedSourcePaths;
|
std::unordered_map<std::string, int> RasterContainer::LoadedSourcePaths;
|
||||||
|
int RasterContainer::count = 0;
|
||||||
|
|
||||||
// Load raster source into memory
|
// Load raster source into memory
|
||||||
int RasterContainer::LoadRasterSource(const std::string &path_string,
|
int RasterContainer::LoadRasterSource(const std::string &path_string,
|
||||||
|
Loading…
Reference in New Issue
Block a user