lar::example::PositionExtractor< Point > Struct Template Reference

Helper extractor for point coordinates. More...

#include <SpacePartition.h>

Detailed Description

template<typename Point>
struct lar::example::PositionExtractor< Point >

Helper extractor for point coordinates.

Template Parameters
Pointtype of point structure

The mandatory interface is:

The type T must be convertible to a number (typically a real one). Examples of specialisation:

struct SpaceTime_t {
double x, y, z; ///< space coordinates
double t; ///< time coordinate
};
namespace lar {
namespace examples {
template <>
struct PositionExtractor<SpaceTime_t> {
static double x(SpaceTime_t const& st) { return st.x; }
static double y(SpaceTime_t const& st) { return st.y; }
static double z(SpaceTime_t const& st) { return st.z; }
};
template <>
struct PositionExtractor<SpaceTime_t const*> {
static double x(SpaceTime_t const* st) { return st->x; }
static double y(SpaceTime_t const* st) { return st->y; }
static double z(SpaceTime_t const* st) { return st->z; }
};
}
}

The argument of the function just needs to be something the template argument can be converted into: in the second example, the argument of X is not required to br exactly SpaceTime_t const* const&.

Definition at line 86 of file SpacePartition.h.


The documentation for this struct was generated from the following file: