5
DEFINE_string(
    calculator_graph_config_file, "",
    "Name of file containing text format CalculatorGraphConfig proto.");

This is part of a code offered by Google's mediapipe for image recognition can someone tell me what this (DEFINE_string) does?

ΦXocę 웃 Пepeúpa ツ
  • 47,427
  • 17
  • 69
  • 97
  • DEFINE_string is either the name of a function or of a preprocessor macro. If it is the same code, https://gflags.github.io/gflags/ implies that it is a macro. It looks like this is the source: https://github.com/gflags/gflags/blob/master/src/gflags.h.in – Jerry Jeremiah Aug 23 '20 at 07:43

1 Answers1

3

That is just a function to define flags... a macro function more specifically and is described in the doc here:

Defining a flag is easy: just use the appropriate macro for the type you want the flag to be, as defined at the bottom of gflags/gflags.h. Here's an example file, foo.cc:

so you can not just define string flags, you could also

DEFINE_bool: boolean
DEFINE_int32: 32-bit integer
DEFINE_int64: 64-bit integer
DEFINE_uint64: unsigned 64-bit integer
DEFINE_double: double
ΦXocę 웃 Пepeúpa ツ
  • 47,427
  • 17
  • 69
  • 97