LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
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:

  • static T x(Point const& point): return x coordinate of point
  • static T y(Point const& point): return y coordinate of point
  • static T z(Point const& point): return z coordinate of point

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

struct SpaceTime_t {
double x, y, z;
double t;
};
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: