SourceXtractorPlusPlus
0.15
Please provide a description of the project.
SEImplementation
src
lib
Configuration
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
24
#include "
SEImplementation/Configuration/MemoryConfig.h
"
25
26
using namespace
Euclid::Configuration
;
27
namespace
po = boost::program_options;
28
29
namespace
SourceXtractor
{
30
31
static
const
std::string
MAX_TILE_MEMORY
{
"tile-memory-limit"
};
32
static
const
std::string
TILE_SIZE
{
"tile-size"
};
33
34
MemoryConfig::MemoryConfig(
long
manager_id) :
Configuration
(manager_id), m_max_memory(512), m_tile_size(256) {
35
}
36
37
auto
MemoryConfig::getProgramOptions
() ->
std::map<std::string, OptionDescriptionList>
{
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
44
void
MemoryConfig::initialize
(
const
UserValues
& args) {
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
std::string
STL class.
SourceXtractor::MemoryConfig::m_max_memory
int m_max_memory
Definition:
MemoryConfig.h:51
SourceXtractor::MemoryConfig::getProgramOptions
std::map< std::string, OptionDescriptionList > getProgramOptions() override
Definition:
MemoryConfig.cpp:37
SourceXtractor::MemoryConfig::m_tile_size
int m_tile_size
Definition:
MemoryConfig.h:52
Euclid::Configuration
SourceXtractor
Definition:
Aperture.h:30
SourceXtractor::MemoryConfig::initialize
void initialize(const UserValues &args) override
Definition:
MemoryConfig.cpp:44
std::map::at
T at(T... args)
std::string::c_str
T c_str(T... args)
SourceXtractor::MAX_TILE_MEMORY
static const std::string MAX_TILE_MEMORY
Definition:
MemoryConfig.cpp:31
Elements::Exception
std::map
STL class.
MemoryConfig.h
Euclid::Configuration::Configuration
SourceXtractor::TILE_SIZE
static const std::string TILE_SIZE
Definition:
MemoryConfig.cpp:32
Generated by
1.8.20