12# include <machine/stdarg.h>
36 : _errh(
errh), _arg_keyword(0), _read_status(false) {
47 : _context(
context), _errh(
errh), _arg_keyword(0), _read_status(false) {
67 void error(
const char *fmt, ...)
const;
70 void warning(
const char *fmt, ...)
const;
73 void message(
const char *fmt, ...)
const;
75 void xmessage(
const String &anno,
const String &str)
const;
76 void xmessage(
const String &anno,
const char *fmt, va_list val)
const;
84 const char *_arg_keyword;
85 mutable bool _read_status;
91template <
typename T>
struct Args_has_enable_direct_parse {
93 template <
typename X>
static char test(
typename X::enable_direct_parse *);
94 template <
typename>
static int test(...);
96 enum { value = (
sizeof(test<T>(0)) == 1) };
98template <typename P, bool direct = Args_has_enable_direct_parse<P>::value>
99struct Args_parse_helper;
100template <
typename P>
struct Args_parse_helper<P, false> {
101 template <
typename T,
typename A>
102 static inline T *slot(T &variable, A &args) {
103 return args.slot(variable);
105 template <
typename T,
typename A>
106 static inline T *initialized_slot(T &variable, A &args) {
107 return args.initialized_slot(variable);
109 template <
typename T,
typename A>
110 static inline bool parse(P parser,
const String &str, T &s, A &args) {
111 return parser.parse(str, s, args);
113 template <
typename T1,
typename T2,
typename A>
114 static inline bool parse(P parser,
const String &str, T1 &s1, T2 &s2, A &args) {
115 return parser.parse(str, s1, s2, args);
118template <
typename P>
struct Args_parse_helper<P, true> {
119 template <
typename T,
typename A>
120 static inline T *slot(T &variable, A &) {
123 template <
typename T,
typename A>
124 static inline T *initialized_slot(T &variable, A &) {
127 template <
typename T,
typename A>
128 static inline bool parse(P parser,
const String &str, T &s, A &args) {
129 return parser.direct_parse(str, s, args);
131 template <
typename T1,
typename T2,
typename A>
132 static inline bool parse(P parser,
const String &str, T1 &s1, T2 &s2, A &args) {
133 return parser.direct_parse(str, s1, s2, args);
292 return (!_conf || !_conf->
size()) && !_slots && _simple_slotbuf[0] == 0;
297 return !_slots && _simple_slotbuf[0] == 0;
324 while (begin != end) {
370 template <
typename T>
372 return read(keyword, 0, x);
374 template <
typename T>
375 Args &read_m(
const char *keyword, T &x) {
378 template <
typename T>
379 Args &read_p(
const char *keyword, T &x) {
382 template <
typename T>
383 Args &read_mp(
const char *keyword, T &x) {
386 template <
typename T>
387 Args &
read(
const char *keyword,
int flags, T &x) {
388 args_base_read(
this, keyword, flags, x);
402 template <
typename T,
typename V>
406 template <
typename T,
typename V>
407 Args &read_or_set_p(
const char *keyword, T &x,
const V &default_value) {
410 template <
typename T,
typename V>
411 Args &
read_or_set(
const char *keyword,
int flags, T &x,
const V &default_value) {
412 args_base_read_or_set(
this, keyword, flags, x, default_value);
421 String str = find(keyword, 0, slot_status);
422 if (str && !present) {
423 printf(
"A value was given for %s, but it was not given at time of devirtualization.\n", keyword);
429 template <
typename T>
430 Args &
validate(
const char *keyword, T &x,
const char *static_value) {
431 DefaultArg<T> p = DefaultArg<T>();
433 p.parse(static_value, v);
437 template <
typename T,
typename V>
438 Args &
validate(
const char *keyword, T &x,
const V &static_value) {
440 String str = find(keyword, 0, slot_status);
445 T *s = Args_parse_helper<DefaultArg<T> >
::slot(x, *
this);
446 postparse(s && (str ? Args_parse_helper<DefaultArg<T> >::parse(DefaultArg<T>(), str, *s, *
this) : (*s = static_value, true)), slot_status);
447 if (*s != static_value) {
448 click_chatter(
"%s is not the expected value", keyword);
449 if (std::is_convertible<T,char *>::value) {
450 click_chatter(
"Given %s", x);
452 if (std::is_convertible<V,char *>::value) {
453 click_chatter(
"Given %s", static_value);
455 assert(*s == static_value);
462 template <
typename T,
typename V>
463 Args &validate_f(
const char *keyword, T &x,
int flags,
const V &static_value) {
466 String str = find(keyword, flags, slot_status);
470 T *s = Args_parse_helper<DefaultArg<T> >
::slot(x, *
this);
471 postparse(s && (str ? Args_parse_helper<DefaultArg<T> >::parse(DefaultArg<T>(), str, *s, *
this) : (*s = static_value, true)), slot_status);
472 assert(*s == static_value);
477 template <
typename T,
typename V>
478 Args &validate_p(
const char *keyword, T &x,
const V &static_value) {
479 return validate_f(keyword, x,
positional, static_value);
482 template <
typename T,
typename V>
483 Args &validate_mp(
const char *keyword, T &x,
const V &static_value) {
487 template <
typename T>
488 Args &validate_p(
const char *keyword, T &x,
const char *static_value) {
489 DefaultArg<T> p = DefaultArg<T>();
491 p.parse(static_value, v);
495 template <
typename T>
496 Args &validate_mp(
const char *keyword, T &x,
const char *static_value) {
497 DefaultArg<T> p = DefaultArg<T>();
499 p.parse(static_value, v);
512 template <
typename P,
typename T>
514 return read(keyword, 0, parser, x);
516 template <
typename P,
typename T>
517 Args &read_m(
const char *keyword, P parser, T &x) {
520 template <
typename P,
typename T>
521 Args &read_p(
const char *keyword, P parser, T &x) {
524 template <
typename P,
typename T>
525 Args &read_mp(
const char *keyword, P parser, T &x) {
528 template <
typename P,
typename T>
529 Args &
read(
const char *keyword,
int flags, P parser, T &x) {
530 args_base_read(
this, keyword, flags, parser, x);
545 template <
typename P,
typename T,
typename V>
547 return read_or_set(keyword, 0, parser, x, default_value);
549 template <
typename P,
typename T,
typename V>
550 Args &read_or_set_p(
const char *keyword, P parser, T &x,
const V &default_value) {
553 template <
typename P,
typename T,
typename V>
554 Args &
read_or_set(
const char *keyword,
int flags, P parser, T &x,
const V &default_value) {
555 args_base_read_or_set(
this, keyword, flags, parser, x, default_value);
568 template<
typename P,
typename T1,
typename T2>
569 Args &
read(
const char *keyword, P parser, T1 &x1, T2 &x2) {
570 return read(keyword, 0, parser, x1, x2);
572 template<
typename P,
typename T1,
typename T2>
573 Args &read_m(
const char *keyword, P parser, T1 &x1, T2 &x2) {
576 template<
typename P,
typename T1,
typename T2>
577 Args &read_p(
const char *keyword, P parser, T1 &x1, T2 &x2) {
580 template<
typename P,
typename T1,
typename T2>
581 Args &read_mp(
const char *keyword, P parser, T1 &x1, T2 &x2) {
584 template<
typename P,
typename T1,
typename T2>
585 Args &
read(
const char *keyword,
int flags, P parser, T1 &x1, T2 &x2) {
586 args_base_read(
this, keyword, flags, parser, x1, x2);
596 template <
typename P>
600 template <
typename P>
601 Args &read_m_with(
const char *keyword, P parser) {
604 template <
typename P>
605 Args &read_p_with(
const char *keyword, P parser) {
608 template <
typename P>
609 Args &read_mp_with(
const char *keyword, P parser) {
612 template <
typename P>
614 args_base_read_with(
this, keyword, flags, parser);
628 template <
typename P,
typename T>
630 return read(keyword, parser, x);
632 template <
typename P,
typename T>
633 Args &read_m_with(
const char *keyword, P parser, T &x) {
634 return read_m(keyword, parser, x);
636 template <
typename P,
typename T>
637 Args &read_p_with(
const char *keyword, P parser, T &x) {
638 return read_p(keyword, parser, x);
640 template <
typename P,
typename T>
641 Args &read_mp_with(
const char *keyword, P parser, T &x) {
642 return read_mp(keyword, parser, x);
644 template <
typename P,
typename T>
645 Args &
read_with(
const char *keyword,
int flags, P parser, T &x) {
646 return read(keyword, flags, parser, x);
658 template <
typename P>
662 template <
typename P>
664 args_base_read_all_with(
this, keyword, flags |
firstmatch, parser);
679 template <
typename P,
typename T>
683 template <
typename P,
typename T>
685 args_base_read_all_with(
this, keyword, flags |
firstmatch, parser, x);
701 template <
typename P,
typename T>
703 return read_all(keyword, 0, parser, x);
705 template <
typename T>
707 return read_all(keyword, 0, DefaultArg<T>(), x);
709 template <
typename P,
typename T>
711 args_base_read_all(
this, keyword, flags |
firstmatch, parser, x);
714 template <
typename P,
typename T>
716 return read_all(keyword, flags, DefaultArg<T>(), x);
790 template <
typename T>
793 return reinterpret_cast<T *
>(simple_slot(&x,
sizeof(T)));
795 return complex_slot(x);
801 template <
typename T>
811 template <
typename T,
typename V>
821 void base_read(
const char *keyword,
int flags, T &variable) {
823 if (
String str = find(keyword, flags, slot_status)) {
824 T *s = Args_parse_helper<DefaultArg<T> >
::slot(variable, *
this);
825 postparse(s && Args_parse_helper<DefaultArg<T> >::parse(DefaultArg<T>(), str, *s, *
this), slot_status);
829 template<
typename T,
typename V>
830 void base_read_or_set(
const char *keyword,
int flags, T &variable,
const V &value) {
832 String str = find(keyword, flags, slot_status);
833 T *s = Args_parse_helper<DefaultArg<T> >
::slot(variable, *
this);
834 postparse(s && (str ? Args_parse_helper<DefaultArg<T> >::parse(DefaultArg<T>(), str, *s, *
this) : (*s = value, true)), slot_status);
837 template<
typename P,
typename T>
838 void base_read(
const char *keyword,
int flags, P parser, T &variable) {
840 if (
String str = find(keyword, flags, slot_status)) {
841 T *s = Args_parse_helper<P>::slot(variable, *
this);
842 postparse(s && Args_parse_helper<P>::parse(parser, str, *s, *
this), slot_status);
846 template<
typename T,
typename P,
typename V>
847 void base_read_or_set(
const char *keyword,
int flags, P parser, T &variable,
const V &value) {
849 String str = find(keyword, flags, slot_status);
850 T *s = Args_parse_helper<P>::slot(variable, *
this);
851 postparse(s && (str ? Args_parse_helper<P>::parse(parser, str, *s, *
this) : (*s = value, true)), slot_status);
854 template<
typename P,
typename T1,
typename T2>
855 void base_read(
const char *keyword,
int flags,
856 P parser, T1 &variable1, T2 &variable2) {
858 if (
String str = find(keyword, flags, slot_status)) {
859 T1 *s1 = Args_parse_helper<P>::slot(variable1, *
this);
860 T2 *s2 = Args_parse_helper<P>::slot(variable2, *
this);
861 postparse(s1 && s2 && Args_parse_helper<P>::parse(parser, str, *s1, *s2, *
this), slot_status);
866 void base_read_with(
const char *keyword,
int flags, P parser) {
868 if (
String str = find(keyword, flags, slot_status))
869 postparse(parser.parse(str, *
this), slot_status);
873 void base_read_all_with(
const char *keyword,
int flags, P parser) {
876 while (
String str = find(keyword, flags, slot_status)) {
877 postparse(parser.parse(str, *
this), slot_status);
884 template<
typename P,
typename T>
885 void base_read_all_with(
const char *keyword,
int flags, P parser, T &variable) {
888 T *s = Args_parse_helper<P>::initialized_slot(variable, *
this);
889 while (
String str = find(keyword, flags, slot_status)) {
890 postparse(s && Args_parse_helper<P>::parse(parser, str, *s, *
this), slot_status);
897 template<
typename P,
typename T>
898 void base_read_all(
const char *keyword,
int flags, P parser,
Vector<T> &variable) {
902 while (
String str = find(keyword, flags, slot_status)) {
904 postparse(parser.parse(str, sx, *
this), slot_status);
921 virtual void store() = 0;
925 struct BytesSlot :
public Slot {
926 BytesSlot(
void *ptr,
size_t size)
927 : _ptr(ptr), _slot(new char[size]), _size(size) {
933 memcpy(_ptr, _slot, _size);
941 struct SlotT :
public Slot {
946 assign_consume(*_ptr, _slot);
953#if SIZEOF_VOID_P == 4
954 simple_slotbuf_size = 24
956 simple_slotbuf_size = 48
960#if !CLICK_DEBUG_ARGS_USAGE
967 uint8_t _simple_slotpos;
973 uint8_t _simple_slotbuf[simple_slotbuf_size];
976 void reset_from(
int i);
978 String find(
const char *keyword,
int flags, Slot *&slot_status);
979 void postparse(
bool ok, Slot *slot_status);
980 void check_complete();
982 static inline int simple_slot_size(
int size);
983 inline void simple_slot_info(
int offset,
int size,
984 void *&
slot,
void **&pointer);
985 void *simple_slot(
void *data,
size_t size);
986 template<
typename T> T *complex_slot(T &variable);
998T *Args::complex_slot(T &variable)
1000 if (SlotT<T> *s =
new SlotT<T>(&variable)) {
1005 error(
"out of memory");
1015void args_base_read(
Args *args,
const char *keyword,
int flags, T &variable)
1018void args_base_read(
Args *args,
const char *keyword,
int flags, T &variable)
1020 args->base_read(keyword, flags, variable);
1023template<
typename T,
typename V>
1024void args_base_read_or_set(
Args *args,
const char *keyword,
int flags,
1025 T &variable,
const V &value) CLICK_NOINLINE;
1026template<
typename T,
typename V>
1027void args_base_read_or_set(
Args *args,
const char *keyword,
int flags,
1028 T &variable,
const V &value)
1030 args->base_read_or_set(keyword, flags, variable, value);
1033template<
typename P,
typename T>
1034void args_base_read(
Args *args,
const char *keyword,
int flags,
1035 P parser, T &variable) CLICK_NOINLINE;
1036template<
typename P,
typename T>
1037void args_base_read(
Args *args,
const char *keyword,
int flags,
1038 P parser, T &variable)
1040 args->base_read(keyword, flags, parser, variable);
1043template<
typename P,
typename T,
typename V>
1044void args_base_read_or_set(
Args *args,
const char *keyword,
int flags,
1045 P parser, T &variable,
const V &value) CLICK_NOINLINE;
1046template<
typename P,
typename T,
typename V>
1047void args_base_read_or_set(
Args *args,
const char *keyword,
int flags,
1048 P parser, T &variable,
const V &value)
1050 args->base_read_or_set(keyword, flags, parser, variable, value);
1053template<
typename P,
typename T1,
typename T2>
1054void args_base_read(
Args *args,
const char *keyword,
int flags,
1055 P parser, T1 &variable1, T2 &variable2) CLICK_NOINLINE;
1056template<
typename P,
typename T1,
typename T2>
1057void args_base_read(
Args *args,
const char *keyword,
int flags,
1058 P parser, T1 &variable1, T2 &variable2)
1060 args->base_read(keyword, flags, parser, variable1, variable2);
1064void args_base_read_with(
Args *args,
const char *keyword,
int flags, P parser)
1067void args_base_read_with(
Args *args,
const char *keyword,
int flags, P parser)
1069 args->base_read_with(keyword, flags, parser);
1073void args_base_read_all_with(
Args *args,
const char *keyword,
int flags, P parser)
1076void args_base_read_all_with(
Args *args,
const char *keyword,
int flags, P parser)
1078 args->base_read_all_with(keyword, flags, parser);
1081template<
typename P,
typename T>
1082void args_base_read_all_with(
Args *args,
const char *keyword,
int flags,
1083 P parser, T &variable) CLICK_NOINLINE;
1084template<
typename P,
typename T>
1085void args_base_read_all_with(
Args *args,
const char *keyword,
int flags,
1086 P parser, T &variable)
1088 args->base_read_all_with(keyword, flags, parser, variable);
1091template <
typename P,
typename T>
1092void args_base_read_all(
Args *args,
const char *keyword,
int flags,
1093 P parser,
Vector<T> &variable) CLICK_NOINLINE;
1094template <
typename P,
typename T>
1095void args_base_read_all(
Args *args,
const char *keyword,
int flags,
1098 args->base_read_all(keyword, flags, parser, variable);
1106 status_inval = EINVAL,
1107 status_range = ERANGE,
1109 status_notsup = ENOTSUP,
1110#elif defined(ENOTSUPP)
1111 status_notsup = ENOTSUPP,
1132 typedef uint32_t limb_type;
1138 const char *parse(
const char *begin,
const char *end,
1139 bool is_signed,
int size,
1140 limb_type *value,
int nlimb);
1142 template<
typename V>
1143 bool parse_saturating(
const String &str, V &result,
const ArgContext &args = blank_args) {
1145 constexpr int nlimb = int((
sizeof(V) +
sizeof(limb_type) - 1) /
sizeof(limb_type));
1147 if (parse(str.
begin(), str.
end(), is_signed,
int(
sizeof(V)), x, nlimb)
1149 status = status_inval;
1150 if (status && status != status_range) {
1151 args.
error(
"invalid number");
1154 typedef typename make_unsigned<V>::type unsigned_v_type;
1159 template<
typename V>
1160 String unparse(
const V &v) {
1163 template<
typename V>
1164 bool parse(
const String &str, V &result,
const ArgContext &args = blank_args) {
1166 if (!parse_saturating(str, x, args)
1167 || (status && status != status_range))
1169 else if (status == status_range) {
1171 click_int_large_t(x));
1184 static const char *span(
const char *begin,
const char *end,
1185 bool is_signed,
int &b);
1186 void range_error(
const ArgContext &args,
bool is_signed,
1187 click_int_large_t value);
1203 template<
typename V>
1204 bool parse(
const String &str, V &result,
const ArgContext &args = blank_args) {
1205 return parse_saturating(str, result, args);
1217 template <
typename T>
1219 :
IntArg(b), min_value(min_value), max_value(max_value) {
1224 template <
typename V>
1225 bool parse(
const String &str, V &result,
const ArgContext &args = blank_args) {
1227 if (!IntArg::parse(str, x, args))
1230 range_error(args, is_signed, min_value);
1233 range_error(args, is_signed, max_value);
1241 inline bool check_min(click_int_large_t x)
const {
1243 return x >= min_value;
1245 return x >= 0 && click_uint_large_t(x) >= click_uint_large_t(min_value);
1247 inline bool check_min(click_uint_large_t x)
const {
1249 return min_value < 0 || x >= click_uint_large_t(min_value);
1251 return click_uint_large_t(x) >= click_uint_large_t(min_value);
1253 inline bool check_max(click_int_large_t x)
const {
1255 return x <= max_value;
1257 return x >= 0 && click_uint_large_t(x) <= click_uint_large_t(max_value);
1259 inline bool check_max(click_uint_large_t x)
const {
1261 return max_value >= 0 && x <= click_uint_large_t(max_value);
1263 return click_uint_large_t(x) <= click_uint_large_t(max_value);
1266 click_intmax_t min_value;
1267 click_intmax_t max_value;
1271template<>
struct DefaultArg<unsigned char> :
public IntArg {};
1272template<>
struct DefaultArg<signed char> :
public IntArg {};
1273template<>
struct DefaultArg<char> :
public IntArg {};
1274template<>
struct DefaultArg<unsigned short> :
public IntArg {};
1275template<>
struct DefaultArg<short> :
public IntArg {};
1276template<>
struct DefaultArg<unsigned int> :
public IntArg {};
1277template<>
struct DefaultArg<int> :
public IntArg {};
1278template<>
struct DefaultArg<unsigned long> :
public IntArg {};
1279template<>
struct DefaultArg<long> :
public IntArg {};
1281template<>
struct DefaultArg<unsigned long long> :
public IntArg {};
1282template<>
struct DefaultArg<long long> :
public IntArg {};
1290 : fraction_bits(b), exponent_delta(exponent) {
1292 inline bool parse_saturating(
const String &str, uint32_t &result,
const ArgContext &args = blank_args);
1293 bool parse(
const String &str, uint32_t &result,
const ArgContext &args = blank_args);
1294 bool parse_saturating(
const String &str, int32_t &result,
const ArgContext &args = blank_args);
1295 bool parse(
const String &str, int32_t &result,
const ArgContext &args = blank_args);
1300 bool underparse(
const String &str,
bool is_signed, uint32_t &result);
1304FixedPointArg::parse_saturating(
const String &str, uint32_t &result,
const ArgContext &)
1306 return underparse(str,
false, result);
1313 : fraction_digits(d), exponent_delta(exponent) {
1315 inline bool parse_saturating(
const String &str, uint32_t &result,
const ArgContext &args = blank_args);
1316 bool parse(
const String &str, uint32_t &result,
const ArgContext &args = blank_args);
1317 bool parse_saturating(
const String &str, int32_t &result,
const ArgContext &args = blank_args);
1318 bool parse(
const String &str, int32_t &result,
const ArgContext &args = blank_args);
1319 bool parse_saturating(
const String &str, uint32_t &iresult, uint32_t &fresult,
const ArgContext &args = blank_args);
1320 bool parse(
const String &str, uint32_t &iresult, uint32_t &fresult,
const ArgContext &args = blank_args);
1321 int fraction_digits;
1325 bool underparse(
const String &str,
bool is_signed, uint32_t &result);
1329DecimalFixedPointArg::parse_saturating(
const String &str, uint32_t &result,
const ArgContext &)
1331 return underparse(str,
false, result);
1341 bool parse(
const String &str,
double &result,
const ArgContext &args = blank_args);
1345template<>
struct DefaultArg<double> :
public DoubleArg {};
1352 static bool parse(
const String &str,
bool &result,
const ArgContext &args = blank_args);
1353 static String unparse(
bool x) {
1358template<>
struct DefaultArg<bool> :
public BoolArg {};
1361class UnitArg {
public:
1362 explicit UnitArg(
const char *unit_def,
const char *prefix_chars_def)
1363 : units_(reinterpret_cast<const unsigned char *>(unit_def)),
1364 prefix_chars_(reinterpret_cast<const unsigned char *>(prefix_chars_def)) {
1366 const char *parse(
const char *begin,
const char *end,
int &power,
int &factor)
const;
1368 const unsigned char *units_;
1369 const unsigned char *prefix_chars_;
1379 bool parse(
const String &str, uint64_t &result,
const ArgContext & = blank_args);
1380 static String unparse(uint32_t x);
1386class BitvectorArg {
public:
1388 if (!result.parse(str, 0, 64)) {
1389 blank_args.
error(
"%s is not a bitvecotr",str.
c_str());
1396template<>
struct DefaultArg<
Bitvector> :
public BitvectorArg {};
1407 bool parse(
const String &str,
int &result,
const ArgContext &args = blank_args);
1421 : fraction_digits(d) {
1423 bool parse_saturating(
const String &str, uint32_t &result,
const ArgContext &args = blank_args);
1424 bool parse(
const String &str, uint32_t &result,
const ArgContext &args = blank_args);
1426 bool parse(
const String &str,
double &result,
const ArgContext &args = blank_args);
1428 int fraction_digits;
1444 result.push_back(str);
1456 return cp_string(str, &result, 0);
1469 return cp_keyword(str, &result, 0);
1478class WordArg {
public:
1480 return cp_word(str, &result, 0);
1485#if CLICK_USERLEVEL || CLICK_TOOL
1510 template<
typename T>
bool parse(
const String &str, T *&result,
const ArgContext &args) {
1511 return parse(str,
reinterpret_cast<Element *&
>(result), args);
Parser class for annotation specifications.
Definition args.hh:1403
Parser class that accepts any argument.
Definition args.hh:1435
Argument context class.
Definition args.hh:31
void message(const char *fmt,...) const
Report a message for the current argument.
Definition args.cc:321
const Element * context() const
Return the element context.
Definition args.hh:51
ArgContext(const Element *context, ErrorHandler *errh=0)
Construct an argument context.
Definition args.hh:46
ArgContext(ErrorHandler *errh=0)
Construct an argument context.
Definition args.hh:35
void error(const char *fmt,...) const
Report a parse error for the current argument.
Definition args.cc:303
String error_prefix() const
Return a prefix string associated with the current argument.
Definition args.cc:297
ErrorHandler * errh() const
Return the associated error handler.
Definition args.hh:57
void warning(const char *fmt,...) const
Report a parse warning for the current argument.
Definition args.cc:312
Argument parser class.
Definition args.hh:249
Args & status(bool &x)
Set x to the current parse status.
Definition args.hh:726
static constexpr int firstmatch
read flag to take first matching argument
Definition args.hh:361
Args & strip()
Remove all arguments matched so far.
Definition args.cc:446
Args & read_or_set(const char *keyword, T &x, const V &default_value)
Read an argument using the default parser, or set it to a default value if the argument is was not su...
Definition args.hh:403
Args & read(const char *keyword, P parser, T &x)
Read an argument using a specified parser.
Definition args.hh:513
bool status() const
Return the current parse status.
Definition args.hh:721
Args & read(const char *keyword, T &x)
Read an argument using its type's default parser.
Definition args.hh:371
Args & push_back_args(const String &str)
Append the comma-separated arguments in str to this parser.
Definition args.cc:199
Args & read_all_with(const char *keyword, P parser)
Pass all matching arguments to a specified parser.
Definition args.hh:659
bool read_status() const
Return true iff the last read request succeeded.
Definition args.hh:739
T * initialized_slot(T &x)
Create and return a result slot for x.
Definition args.hh:802
const Args & read_status(bool &x) const
Definition args.hh:750
Args & read(const char *keyword, P parser, T1 &x1, T2 &x2)
Read an argument using a specified parser with two results.
Definition args.hh:569
static constexpr int deprecated
read flag for deprecated arguments
Definition args.hh:360
static constexpr int positional
read flag for positional arguments
Definition args.hh:359
Args & read_with(const char *keyword, P parser, T &x)
Pass an argument to a specified parser.
Definition args.hh:629
Args & push_back(Iter begin, Iter end)
Append arguments in the range [begin, end) to this parser.
Definition args.hh:323
Args & read_all_with(const char *keyword, P parser, T &x)
Pass all matching arguments to a specified parser.
Definition args.hh:680
Args & read_status(bool &x)
Set x to the success status of the last read request.
Definition args.hh:745
bool results_empty() const
Return true iff this parser has no results.
Definition args.hh:296
int consume()
Assign results and remove matched arguments.
Definition args.cc:500
T * slot(T &x)
Create and return a result slot for x.
Definition args.hh:791
Args & operator=(const Args &x)
Assign to a copy of x.
Definition args.cc:109
int complete()
Assign results if all arguments matched.
Definition args.cc:510
Args & bind(Vector< String > &conf)
Bind this parser's arguments to conf.
Definition args.cc:171
Args & read_or_set(const char *keyword, P parser, T &x, const V &default_value)
Read an argument using a specified parser, or set it to a default value if the argument is was not su...
Definition args.hh:546
Args & push_back(const String &arg)
Append argument arg to this parser.
Definition args.cc:184
Args & push_back_words(const String &str)
Append the space-separated words in str to this parser.
Definition args.cc:214
static constexpr int mandatory
read flag for mandatory arguments
Definition args.hh:358
Args & reset()
Reset the parse status for every argument.
Definition args.hh:352
int execute()
Assign results.
Definition args.cc:480
Args & read_with(const char *keyword, P parser)
Pass an argument to a specified parser.
Definition args.hh:597
bool empty() const
Return true iff this parser has no arguments or results.
Definition args.hh:291
Args & validate(const char *keyword, bool present=false)
Definition args.hh:419
const Args & status(bool &x) const
Definition args.hh:731
Args & read_all(const char *keyword, P parser, Vector< T > &x)
Pass all matching arguments to a specified parser.
Definition args.hh:702
Args & clear()
Remove all arguments.
Definition args.hh:303
Args & set(T &x, const V &value)
Add a result that assigns x to value.
Definition args.hh:812
Parser class for bandwidth specifications.
Definition args.hh:1378
Vector of bits.
Definition bitvector.hh:21
Parser class for booleans.
Definition args.hh:1351
Parser class for integers with explicit bounds.
Definition args.hh:1216
Parser class for fixed-point numbers with d decimal digits of fraction.
Definition args.hh:1311
Parser class for double-precision floating point numbers.
Definition args.hh:1338
Parser class for elements.
Definition args.hh:1497
Parser class for elements of type t.
Definition args.hh:1505
Base class for Click elements.
Definition element.hh:42
Error reporting class.
Definition error.hh:90
Parser class for filenames.
Definition args.hh:1488
Parser class for fixed-point numbers with b bits of fraction.
Definition args.hh:1288
Parser class for integers.
Definition args.hh:1130
Parser class for keywords.
Definition args.hh:1467
Parser class for integers with saturating overflow.
Definition args.hh:1198
Parser class for seconds and powers thereof.
Definition args.hh:1419
Parser class for possibly-quoted strings.
Definition args.hh:1454
A string of characters.
Definition string.hh:22
const char * c_str() const
Null-terminate the string.
Definition string.hh:519
const_iterator end() const
Return an iterator for the end of the string.
Definition string.hh:584
const_iterator begin() const
Return an iterator for the first character in the string.
Definition string.hh:576
Vector template.
Definition vector.hh:111
void clear()
Remove all elements.
Definition vector.hh:476
size_type size() const
Return the number of elements.
Definition vector.hh:231
void push_back(value_argument_type v)
Append element v.
Definition vector.hh:399
Support for parsing configuration strings.
Template determining whether T may be copied by memcpy.
Definition type_traits.hh:66
Numeric traits template.
Definition type_traits.hh:244
The Timestamp class represents a moment or interval in time.
void extract_integer(const Limb *x, V &value)
Extract an integral type from a multi-limb integer.
Definition type_traits.hh:517
Click's vector container template.