/* ----------------------------------------------------------------------- *//** * * @file shapeToExtents.hpp * * @brief Integration classes for multi_array classes * *//* ----------------------------------------------------------------------- */ #ifndef MADLIB_SHAPETOEXTENTS_HPP #define MADLIB_SHAPETOEXTENTS_HPP namespace madlib { namespace utils { /** * @internal * @brief Helper struct for converting a size_type (an array of sizes) to Boost * extents * * There is no need to use this struct directly. User code should call * shapeToExtents(const boost::multi_array_types::size_type *inSizeList) * for conversion. */ template struct internal_shapeToExtents { typedef boost::detail::multi_array::extent_gen type; typedef boost::multi_array_types::size_type size_type; static inline type get(const size_type *inSizeList) { return internal_shapeToExtents::get(inSizeList).operator[]( inSizeList[Dim] ); } }; template struct internal_shapeToExtents { typedef boost::detail::multi_array::extent_gen<1> type; typedef boost::multi_array_types::size_type size_type; static inline type get(const size_type *inSizeList) { return boost::extents[ inSizeList[0] ]; } }; /** * @brief convert a size_type (an array of sizes) to Boost extents */ template boost::detail::multi_array::extent_gen shapeToExtents(const boost::multi_array_types::size_type *inSizeList) { return internal_shapeToExtents::get(inSizeList); } } // namespace modules } // namespace regress #endif