Gamgee
You miserable little maggot. I'll stove your head in!
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
missing.h
Go to the documentation of this file.
1 #ifndef gamgee__missing__guard
2 #define gamgee__missing__guard
3 
4 #include "sam/sam_tag.h"
5 #include "utils/utils.h"
6 
7 #include "htslib/vcf.h"
8 
9 #include <vector>
10 #include <string>
11 #include <cmath>
12 
13 namespace gamgee {
14 
15 namespace missing_values {
16  constexpr auto int8 = bcf_int8_missing;
17  constexpr auto int16 = bcf_int16_missing;
18  constexpr auto int32 = bcf_int32_missing;
19  constexpr auto string_empty = "";
20  constexpr auto string_dot = ".";
21 }
22 
23 inline bool missing (const bool value) { return !value; }
24 inline bool missing (const float value) { return bcf_float_is_missing(value); }
25 inline bool missing (const int8_t value) { return value == missing_values::int8; }
26 inline bool missing (const int16_t value) { return value == missing_values::int16; }
27 inline bool missing (const int32_t value) { return value == missing_values::int32; }
28 inline bool missing (const std::string& value) { return value.empty() || value == missing_values::string_dot;}
29 inline bool missing (const char* value) { return value == missing_values::string_empty || value == missing_values::string_dot;}
30 
36 template <class MISSING_TYPE>
37 inline bool missing(const MISSING_TYPE& value) {
38  return value.missing();
39 }
40 
47 template <class VALUE>
48 inline bool missing(const std::vector<VALUE>& v) { return v.empty(); }
49 
50 }
51 
52 #endif // gamgee__missing__guard
constexpr auto string_dot
"dot" is a missing string in the VCF spec.
Definition: missing.h:20
constexpr auto int16
missing value for an int16
Definition: missing.h:17
#define bcf_int32_missing
Definition: vcf.h:756
constexpr auto string_empty
empty string is a missing string
Definition: missing.h:19
constexpr auto int32
missing value for an int32
Definition: missing.h:18
constexpr auto int8
missing value for an int8
Definition: missing.h:16
Definition: exceptions.h:9
#define bcf_int16_missing
Definition: vcf.h:755
#define bcf_int8_missing
Definition: vcf.h:754
bool missing(const bool value)
Returns true if bool is false (missing).
Definition: missing.h:23