Skip to content

Commit

Permalink
Add templated AddArgument for enum types (like VendorID) (#10721)
Browse files Browse the repository at this point in the history
  • Loading branch information
holbrookt authored and pull[bot] committed Oct 21, 2021
1 parent c78dea0 commit 7c3e2a8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions examples/chip-tool/commands/common/Command.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@ class Command
return AddArgument(name, min, max, reinterpret_cast<void *>(out), Number_uint64);
}

template <typename T, typename = std::enable_if_t<std::is_enum<T>::value>>
size_t AddArgument(const char * name, int64_t min, uint64_t max, T * out)
{
return AddArgument(name, min, max, reinterpret_cast<std::underlying_type_t<T> *>(out));
}

virtual CHIP_ERROR Run() = 0;

private:
Expand Down

0 comments on commit 7c3e2a8

Please sign in to comment.