MCPcopy Create free account
hub / github.com/apache/trafficserver / ContFlags

Class ContFlags

include/tscore/ContFlags.h:39–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37#include "tscore/ink_thread.h"
38
39class ContFlags
40{
41public:
42 enum flags { DEBUG_OVERRIDE = 0, DISABLE_PLUGINS = 1, LAST_FLAG };
43
44 ContFlags() {}
45 ContFlags(ContFlags const &that) = default;
46 ContFlags(uint32_t in_flags) : raw_flags(in_flags) {}
47 void
48 set_flags(uint32_t new_flags)
49 {
50 raw_flags = new_flags;
51 }
52 ContFlags &
53 operator=(ContFlags const &other)
54 {
55 this->set_flags(other.get_flags());
56 return *this;
57 }
58
59 uint32_t
60 get_flags() const
61 {
62 return raw_flags;
63 }
64 void
65 set_flag(enum flags flag_bit, bool value)
66 {
67 if (flag_bit >= 0 && flag_bit < LAST_FLAG) {
68 if (value) {
69 raw_flags |= (1 << flag_bit);
70 } else {
71 raw_flags &= ~(1 << flag_bit);
72 }
73 }
74 }
75 bool
76 get_flag(enum flags flag_bit) const
77 {
78 if (flag_bit >= 0 && flag_bit < LAST_FLAG) {
79 return (raw_flags & (1 << flag_bit)) != 0;
80 } else {
81 return false;
82 }
83 }
84 bool
85 is_set() const
86 {
87 return raw_flags != 0;
88 }
89
90private:
91 uint32_t raw_flags = 0;
92};
93
94void set_cont_flags(const ContFlags &flags);
95void set_cont_flag(ContFlags::flags flag_bit, bool value);

Callers

nothing calls this directly

Calls 2

set_flagsMethod · 0.95
get_flagsMethod · 0.45

Tested by

no test coverage detected