SourceXtractorPlusPlus 1.0.3
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
MemoryConfig.cpp
Go to the documentation of this file.
1
17/*
18 * MemoryConfig.cpp
19 *
20 * Created on: Mar 21, 2018
21 * Author: mschefer
22 */
23
25
26using namespace Euclid::Configuration;
27namespace po = boost::program_options;
28
29namespace SourceXtractor {
30
31static const std::string MAX_TILE_MEMORY {"tile-memory-limit"};
32static const std::string TILE_SIZE {"tile-size"};
33
34MemoryConfig::MemoryConfig(long manager_id) : Configuration(manager_id), m_max_memory(512), m_tile_size(256) {
35}
36
38 return { {"Memory usage", {
39 {MAX_TILE_MEMORY.c_str(), po::value<int>()->default_value(512), "Maximum memory used for image tiles cache in megabytes"},
40 {TILE_SIZE.c_str(), po::value<int>()->default_value(256), "Image tiles size in pixels"},
41 }}};
42}
43
45 m_max_memory = args.at(MAX_TILE_MEMORY).as<int>();
46 m_tile_size = args.at(TILE_SIZE).as<int>();
47 if (m_max_memory <= 0) {
48 throw Elements::Exception() << "Invalid " << MAX_TILE_MEMORY << " value: " << m_max_memory;
49 }
50 if (m_tile_size <= 0) {
51 throw Elements::Exception() << "Invalid " << TILE_SIZE << " value: " << m_tile_size;
52 }
53}
54
55} /* namespace SourceXtractor */
56
57
58
59
T at(T... args)
std::map< std::string, boost::program_options::variable_value > UserValues
std::map< std::string, OptionDescriptionList > getProgramOptions() override
void initialize(const UserValues &args) override
static const std::string TILE_SIZE
static const std::string MAX_TILE_MEMORY