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
SEFramework
SEFramework
Source
SourceFlags.h
Go to the documentation of this file.
1
17
/*
18
* SourceFlags.h
19
*
20
* Created on: Oct 19, 2018
21
* Author: Alejandro Alvarez Ayllon
22
*/
23
24
#ifndef _SEFRAMEWORK_SOURCE_SOURCEFLAGS_H_
25
#define _SEFRAMEWORK_SOURCE_SOURCEFLAGS_H_
26
27
#include <stdint.h>
28
#include <iostream>
29
#include <map>
30
#include <string>
31
#include <vector>
32
#include <type_traits>
33
34
namespace
SourceXtractor {
35
37
enum class
Flags
:
int64_t
{
38
NONE
= 0,
39
BIASED
= 1ll << 0,
40
BLENDED
= 1ll << 1,
41
SATURATED
= 1ll << 2,
42
BOUNDARY
= 1ll << 3,
43
NEIGHBORS
= 1ll << 4,
44
OUTSIDE
= 1ll << 5,
45
PARTIAL_FIT
= 1ll << 6,
46
INSUFFICIENT_DATA
= 1ll << 7,
47
ERROR
= 1ll << 10,
48
MEMORY
= 1ll << 11,
49
BAD_PROJECTION
= 1ll << 12,
50
DOWNSAMPLED
= 1ll << 13,
51
SENTINEL
= 1ll << 14,
52
};
53
55
const
std::map<Flags, std::string>
FlagsStr
= {
56
{
Flags::NONE
,
"NONE"
},
57
{
Flags::BIASED
,
"BIASED"
},
58
{
Flags::BLENDED
,
"BLENDED"
},
59
{
Flags::BOUNDARY
,
"BOUNDARY"
},
60
{
Flags::NEIGHBORS
,
"NEIGHBORS"
},
61
{
Flags::OUTSIDE
,
"OUTSIDE"
},
62
{
Flags::PARTIAL_FIT
,
"PARTIAL_FIT"
},
63
{
Flags::INSUFFICIENT_DATA
,
"INSUFFICIENT_DATA"
},
64
{
Flags::ERROR
,
"ERROR"
},
65
{
Flags::MEMORY
,
"MEMORY"
},
66
{
Flags::BAD_PROJECTION
,
"BAD_PROJECTION"
},
67
{
Flags::DOWNSAMPLED
,
"DOWNSAMPLED"
}
68
};
69
70
71
constexpr
inline
Flags
operator|
(
const
Flags
&a,
const
Flags
&b) {
72
typedef
typename
std::underlying_type<Flags>::type
base_int_t;
73
return
static_cast<
Flags
>
(
static_cast<
base_int_t
>
(a) | static_cast<base_int_t>(b));
74
}
75
76
constexpr
inline
Flags
operator&
(
const
Flags
&a,
const
Flags
&b) {
77
typedef
typename
std::underlying_type<Flags>::type
base_int_t;
78
return
static_cast<
Flags
>
(
static_cast<
base_int_t
>
(a) & static_cast<base_int_t>(b));
79
}
80
81
constexpr
Flags
operator*
(
const
Flags
&a,
const
bool
b) {
82
return
b ? a :
Flags::NONE
;
83
}
84
85
inline
Flags
&
operator|=
(
Flags
&a,
const
Flags
&b) {
86
a = a | b;
87
return
a;
88
}
89
90
constexpr
inline
int64_t
flags2long
(
const
Flags
&a) {
91
return
static_cast<
int64_t
>
(a);
92
}
93
94
inline
std::vector<int64_t>
flags2long
(
const
std::vector<Flags>
&v) {
95
std::vector<int64_t>
vl;
96
for
(
auto
a : v) {
97
vl.
emplace_back
(
flags2long
(a));
98
}
99
return
vl;
100
}
101
102
inline
std::ostream
&
operator<<
(
std::ostream
& out,
Flags
flags) {
103
std::underlying_type<Flags>::type
i;
104
bool
some_printed =
false
;
105
for
(i =
static_cast<
decltype(i)
>
(
Flags::BIASED
);
106
i < static_cast<decltype(i)>(
Flags::SENTINEL
); i <<= 1) {
107
if
((flags & static_cast<Flags>(i)) !=
Flags::NONE
) {
108
if
(some_printed)
109
out <<
" | "
;
110
else
111
out <<
"("
;
112
out <<
FlagsStr
.at(static_cast<Flags>(i));
113
some_printed =
true
;
114
}
115
}
116
if
(some_printed)
117
out <<
")"
;
118
else
119
out <<
"NONE"
;
120
return
out;
121
}
122
123
}
// end SourceXtractor
124
125
#endif // _SEFRAMEWORK_SOURCE_SOURCEFLAGS_H_
SourceXtractor::Flags::BAD_PROJECTION
Failed to project some of the coordinates into one of the measurement frames.
SourceXtractor::Flags::NEIGHBORS
The object has neighbors, bright and close enough.
SourceXtractor::flags2long
constexpr int64_t flags2long(const Flags &a)
Definition:
SourceFlags.h:90
SourceXtractor::Flags::MEMORY
Failed to allocate an object, buffer, etc.
SourceXtractor::Flags::OUTSIDE
The object is completely outside of the measurement frame.
SourceXtractor::Flags::DOWNSAMPLED
The fit was done on a downsampled image due to exceeding max size.
SourceXtractor::Flags::NONE
No flag is set.
SourceXtractor::operator|
constexpr Flags operator|(const Flags &a, const Flags &b)
Definition:
SourceFlags.h:71
SourceXtractor::Flags::SENTINEL
Used to find the boundary of possible values.
std::map
STL class.
std::int64_t
SourceXtractor::FlagsStr
const std::map< Flags, std::string > FlagsStr
String representation of the flags.
Definition:
SourceFlags.h:55
SourceXtractor::Flags::BOUNDARY
The object is truncated (too close to an image boundary)
SourceXtractor::operator&
constexpr Flags operator&(const Flags &a, const Flags &b)
Definition:
SourceFlags.h:76
SourceXtractor::Flags::BIASED
The object has bad pixels.
SourceXtractor::operator<<
std::ostream & operator<<(std::ostream &out, const TileKey &tk)
Definition:
TileManager.h:51
std::underlying_type
std::vector
STL class.
SourceXtractor::Flags::INSUFFICIENT_DATA
There are not enough good pixels to fit the parameters.
SourceXtractor::operator*
constexpr Flags operator*(const Flags &a, const bool b)
Definition:
SourceFlags.h:81
SourceXtractor::Flags::SATURATED
At least one pixel of the object is saturated.
SourceXtractor::Flags::PARTIAL_FIT
Some/all of the model parameters could not be fitted.
SourceXtractor::Flags
Flags
Flagging of bad sources.
Definition:
SourceFlags.h:37
SourceXtractor::operator|=
Flags & operator|=(Flags &a, const Flags &b)
Definition:
SourceFlags.h:85
SourceXtractor::Flags::BLENDED
The object was originally blended with another one.
std::ostream
STL class.
SourceXtractor::Flags::ERROR
Error flag: something bad happened during the measurement, model fitting, etc.
std::vector::emplace_back
T emplace_back(T...args)
Generated by
1.8.5