| 1 | /* |
| 2 | * convert.hpp |
| 3 | * |
| 4 | * Created on: Aug 26, 2015 |
| 5 | * Author: i-bird |
| 6 | */ |
| 7 | |
| 8 | #ifndef SRC_UTIL_CONVERT_HPP_ |
| 9 | #define SRC_UTIL_CONVERT_HPP_ |
| 10 | |
| 11 | /*! Set of utility functions to convert to a point from other data types |
| 12 | * |
| 13 | * \tparam dimensionality of the Point |
| 14 | * \tparam St type of point |
| 15 | * |
| 16 | */ |
| 17 | |
| 18 | template<unsigned int dim, typename St> |
| 19 | class toPoint |
| 20 | { |
| 21 | public: |
| 22 | /*! \brief Return the combination converted to point |
| 23 | * |
| 24 | */ |
| 25 | static inline Point<dim,St> convert(const comb<dim> & c) |
| 26 | { |
| 27 | // Point |
| 28 | Point<dim,St> ret; |
| 29 | |
| 30 | // set the point |
| 31 | for (size_t i = 0; i < dim ; i++) |
| 32 | ret.get(i) = c.c[i]; |
| 33 | |
| 34 | return ret; |
| 35 | } |
| 36 | }; |
| 37 | |
| 38 | |
| 39 | |
| 40 | #endif /* SRC_UTIL_CONVERT_HPP_ */ |
| 41 | |