SourceXtractorPlusPlus
0.19
SourceXtractor++, the next generation SExtractor
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
SEImplementation
src
lib
Output
OutputFactory.cpp
Go to the documentation of this file.
1
22
#include <system_error>
23
#include <iostream>
24
#include <fstream>
25
#include <system_error>
26
#include <CCfits/CCfits>
27
28
#include "
SEFramework/Output/OutputRegistry.h
"
29
30
#include "
SEImplementation/Configuration/DetectionImageConfig.h
"
31
32
#include "
SEImplementation/Output/AsciiOutput.h
"
33
#include "
SEImplementation/Output/FitsOutput.h
"
34
#include "
SEImplementation/Output/LdacOutput.h
"
35
#include "
SEImplementation/Output/OutputFactory.h
"
36
37
using
Euclid::make_unique
;
38
39
namespace
SourceXtractor {
40
41
std::shared_ptr<Output>
OutputFactory::createOutput
()
const
{
42
auto
source_to_row =
m_output_registry
->getSourceToRowConverter(
m_output_properties
);
43
44
if
(
m_output_filename
!=
""
) {
45
switch
(
m_output_format
) {
46
case
OutputConfig::OutputFileFormat::FITS
:
47
return
std::make_shared<FitsOutput>(
m_output_filename
, source_to_row,
m_flush_size
);
48
case
OutputConfig::OutputFileFormat::FITS_LDAC
:
49
return
std::make_shared<LdacOutput>(
m_output_filename
, source_to_row,
m_flush_size
);
50
default
:
51
case
OutputConfig::OutputFileFormat::ASCII
:
52
return
std::make_shared<AsciiOutput>(
m_output_filename
, source_to_row,
m_flush_size
);
53
}
54
}
else
{
55
return
std::make_shared<AsciiOutput>(
m_output_filename
, source_to_row,
m_flush_size
);
56
}
57
}
58
59
void
OutputFactory::reportConfigDependencies
(
Euclid::Configuration::ConfigManager
& manager)
const
{
60
manager.
registerConfiguration
<
OutputConfig
>();
61
}
62
63
void
OutputFactory::configure
(
Euclid::Configuration::ConfigManager
& manager) {
64
auto
& output_config = manager.
getConfiguration
<
OutputConfig
>();
65
m_output_properties
= output_config.getOutputProperties();
66
m_flush_size
= output_config.getFlushSize();
67
m_output_filename
= output_config.getOutputFile();
68
m_output_format
= output_config.getOutputFileFormat();
69
70
if
(
m_output_filename
!=
""
) {
71
// Check if we can, at least, create it.
72
// Otherwise, the error will be triggered only at the end of the full process!
73
std::ofstream
check_writeable{
m_output_filename
};
74
if
(!check_writeable) {
75
throw
Elements::Exception
(
76
std::system_error
(errno,
std::system_category
(),
"Failed to open the output catalog"
).what());
77
}
78
}
79
}
80
81
}
// SourceXtractor namespace
82
LdacOutput.h
std::shared_ptr
AsciiOutput.h
SourceXtractor::OutputFactory::configure
void configure(Euclid::Configuration::ConfigManager &manager) override
Method which should initialize the object.
Definition:
OutputFactory.cpp:63
SourceXtractor::OutputFactory::createOutput
std::shared_ptr< Output > createOutput() const
Definition:
OutputFactory.cpp:41
FitsOutput.h
SourceXtractor::OutputConfig::OutputFileFormat::FITS
SourceXtractor::OutputConfig::OutputFileFormat::ASCII
SourceXtractor::OutputFactory::m_output_registry
std::shared_ptr< OutputRegistry > m_output_registry
Definition:
OutputFactory.h:55
SourceXtractor::OutputConfig::OutputFileFormat::FITS_LDAC
DetectionImageConfig.h
std::system_category
T system_category(T...args)
Euclid::Configuration::ConfigManager::registerConfiguration
void registerConfiguration()
std::ofstream
STL class.
OutputFactory.h
SourceXtractor::OutputFactory::reportConfigDependencies
void reportConfigDependencies(Euclid::Configuration::ConfigManager &manager) const override
Registers all the Configuration dependencies.
Definition:
OutputFactory.cpp:59
Euclid::Configuration::ConfigManager
SourceXtractor::OutputFactory::m_output_filename
std::string m_output_filename
Definition:
OutputFactory.h:60
std::system_error
STL class.
SourceXtractor::OutputFactory::m_flush_size
size_t m_flush_size
Definition:
OutputFactory.h:57
Euclid::Configuration::ConfigManager::getConfiguration
T & getConfiguration()
Elements::Exception
SourceXtractor::OutputFactory::m_output_properties
std::vector< std::string > m_output_properties
Definition:
OutputFactory.h:56
OutputRegistry.h
SourceXtractor::OutputConfig
Definition:
OutputConfig.h:36
Euclid::make_unique
std::unique_ptr< T > make_unique(Args &&...args)
SourceXtractor::OutputFactory::m_output_format
OutputConfig::OutputFileFormat m_output_format
Definition:
OutputFactory.h:59
Generated by
1.8.5