MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Flag

Class Flag

tensorflow/lite/tools/command_line_flags.h:65–103  ·  view source on GitHub ↗

A description of a single command line flag, holding its name, type, usage text, and a pointer to the corresponding variable.

Source from the content-addressed store, hash-verified

63// A description of a single command line flag, holding its name, type, usage
64// text, and a pointer to the corresponding variable.
65class Flag {
66 public:
67 template <typename T>
68 static Flag CreateFlag(const char* name, T* val, const char* usage) {
69 return Flag(name, [val](const T& v) { *val = v; }, *val, usage);
70 }
71
72 Flag(const char* name, const std::function<void(const int32_t&)>& hook,
73 int32_t default_value, const std::string& usage_text);
74 Flag(const char* name, const std::function<void(const int64_t&)>& hook,
75 int64_t default_value, const std::string& usage_text);
76 Flag(const char* name, const std::function<void(const float&)>& hook,
77 float default_value, const std::string& usage_text);
78 Flag(const char* name, const std::function<void(const bool&)>& hook,
79 bool default_value, const std::string& usage_text);
80 Flag(const char* name, const std::function<void(const std::string&)>& hook,
81 const std::string& default_value, const std::string& usage_text);
82
83 private:
84 friend class Flags;
85
86 bool Parse(const std::string& arg, bool* value_parsing_ok) const;
87
88 std::string name_;
89 enum {
90 TYPE_INT32,
91 TYPE_INT64,
92 TYPE_BOOL,
93 TYPE_STRING,
94 TYPE_FLOAT,
95 } type_;
96
97 std::string GetTypeName() const;
98
99 std::function<bool(const std::string&)> value_hook_;
100 std::string default_for_display_;
101
102 std::string usage_text_;
103};
104
105class Flags {
106 public:

Callers 14

ParseFlagAndInitFunction · 0.70
CreateFlagMethod · 0.70
mainFunction · 0.50
mainFunction · 0.50
mainFunction · 0.50
mainFunction · 0.50
mainFunction · 0.50
CreateFlagFunction · 0.50
mainFunction · 0.50
ParseTfliteDiffFlagsFunction · 0.50
mainFunction · 0.50

Calls

no outgoing calls

Tested by 6

mainFunction · 0.40
mainFunction · 0.40
mainFunction · 0.40
mainFunction · 0.40
mainFunction · 0.40
mainFunction · 0.40