Commit 2ca8bfa8 authored by David Flynn's avatar David Flynn
Browse files

cli: support for PCCVector3<T> types

Define po-lite option traits to handle PCCVector3<T> as a container
to permit using PCCVector3<T> types as command / config parameters.
parent 6c14cb8b
......@@ -51,6 +51,12 @@ namespace pcc {
template<typename T>
class PCCVector3 {
public:
T* begin() { return &data[0]; }
const T* begin() const { return &data[0]; }
T* end() { return &data[3]; }
const T* end() const { return &data[3]; }
T& operator[](size_t i)
{
assert(i < 3);
......
......@@ -154,6 +154,23 @@ operator<<(std::ostream& out, const AttributeEncoding& val)
}
} // namespace pcc
namespace df {
namespace program_options_lite {
template<typename T>
struct option_detail<pcc::PCCVector3<T>> {
static constexpr bool is_container = true;
static constexpr bool is_fixed_size = true;
typedef T* output_iterator;
static void clear(pcc::PCCVector3<T>& container){};
static output_iterator make_output_iterator(pcc::PCCVector3<T>& container)
{
return &container[0];
}
};
} // namespace program_options_lite
} // namespace df
//---------------------------------------------------------------------------
// :: Command line / config parsing
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment