26 namespace lsst {
namespace meas {
namespace base {
32 std::string
const & doc
38 afw::table::Schema & schema,
39 std::string
const & prefix,
44 r._vector.reserve(flagDefs.
size());
45 for (std::size_t i = 0; i < flagDefs.
size(); i++) {
48 afw::table::Key<afw::table::Flag> key;
49 r._vector.push_back( std::make_pair( flagDef.
name, key));
52 afw::table::Key<afw::table::Flag> key(schema.addField<afw::table::Flag>(schema.join(prefix, flagDef.
name), flagDef.
doc));
53 r._vector.push_back( std::make_pair( flagDef.
name, key));
63 afw::table::SubSchema
const & s,
67 _vector.reserve(flagDefs.
size());
68 for (std::size_t i = 0; i < flagDefs.
size(); i++ ) {
71 afw::table::Key<afw::table::Flag> key;
94 std::size_t
const numFlags = _vector.size();
100 record.set(_vector[error->
getFlagBit()].second,
true);
std::size_t size() const
return the current size (number of defined elements) of the collection
Simple class used to define and document flags The name and doc constitute the identity of the FlagDe...
Exception to be thrown when a measurement algorithm experiences a known failure mode.
FlagDefinition addFailureFlag(std::string const &doc="General Failure Flag")
Add a Flag Defintion to act as a "General" failure flag This flag will be set if a Measurement error ...
static constexpr std::size_t number_undefined
Utility class for handling flag fields that indicate the failure modes of an algorithm.
std::size_t failureFlagNumber
FlagHandler()
Each error should have a corresponding static FlagDefinition object.
bool hasDefinition(std::string const &name) const
See if there is a FlagDefinition with specified name.
FlagDefinition add(std::string const &name, std::string const &doc)
Add a new FlagDefinition to this list.
static FlagHandler addFields(afw::table::Schema &schema, std::string const &prefix, FlagDefinitionList const &flagDefs, FlagDefinitionList const &exclDefs=FlagDefinitionList::getEmptyList())
Add Flag fields to a schema, creating a FlagHandler object to manage them.
static std::string const & getFailureFlagName()
Define the universal name of the general failure flag.
std::size_t getFlagBit() const
Return the flag bit associated with the error.
void handleFailure(afw::table::BaseRecord &record, MeasurementError const *error=nullptr) const
Handle an expected or unexpected Exception thrown by a measurement algorithm.
vector-type utility class to build a collection of FlagDefinitions