SourceXtractorPlusPlus  0.12
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 <type_traits>
28 #include <vector>
29 #include <stdint.h>
30 
31 namespace SourceXtractor {
32 
34 enum class Flags : int64_t {
35  NONE = 0,
36  BIASED = 1ll << 0,
37  BLENDED = 1ll << 1,
38  SATURATED = 1ll << 2,
39  BOUNDARY = 1ll << 3,
40  NEIGHBORS = 1ll << 4,
41  OUTSIDE = 1ll << 5,
42  PARTIAL_FIT = 1ll << 6,
43  INSUFFICIENT_DATA = 1ll << 7,
44  ERROR = 1ll << 10,
45 };
46 
47 
48 constexpr inline Flags operator|(const Flags &a, const Flags &b) {
49  typedef typename std::underlying_type<Flags>::type base_int_t;
50  return static_cast<Flags>(static_cast<base_int_t>(a) | static_cast<base_int_t>(b));
51 }
52 
53 constexpr inline Flags operator&(const Flags &a, const Flags &b) {
54  typedef typename std::underlying_type<Flags>::type base_int_t;
55  return static_cast<Flags>(static_cast<base_int_t>(a) & static_cast<base_int_t>(b));
56 }
57 
58 constexpr Flags operator*(const Flags &a, const bool b) {
59  return b ? a : Flags::NONE;
60 }
61 
62 inline Flags &operator|=(Flags &a, const Flags &b) {
63  a = a | b;
64  return a;
65 }
66 
67 constexpr inline int64_t flags2long(const Flags &a) {
68  return static_cast<int64_t>(a);
69 }
70 
73  for (auto a : v) {
74  vl.emplace_back(flags2long(a));
75  }
76  return vl;
77 }
78 
79 } // end SourceXtractor
80 
81 #endif // _SEFRAMEWORK_SOURCE_SOURCEFLAGS_H_
The object has neighbors, bright and close enough.
constexpr int64_t flags2long(const Flags &a)
Definition: SourceFlags.h:67
The object is completely outside of the measurement frame.
constexpr Flags operator|(const Flags &a, const Flags &b)
Definition: SourceFlags.h:48
The object is truncated (too close to an image boundary)
constexpr Flags operator&(const Flags &a, const Flags &b)
Definition: SourceFlags.h:53
The object has bad pixels.
STL class.
There are not enough good pixels to fit the parameters.
constexpr Flags operator*(const Flags &a, const bool b)
Definition: SourceFlags.h:58
At least one pixel of the object is saturated.
Some/all of the model parameters could not be fitted.
Flags
Flagging of bad sources.
Definition: SourceFlags.h:34
Flags & operator|=(Flags &a, const Flags &b)
Definition: SourceFlags.h:62
The object was originally blended with another one.
Error flag: something bad happened during the measurement, model fitting, etc.
T emplace_back(T...args)