8 #ifndef UTOPIA_DATAIO_HDFBUFFERFACTORY_HH
9 #define UTOPIA_DATAIO_HDFBUFFERFACTORY_HH
15 #include <boost/multi_array.hpp>
48 std::shared_ptr< spdlog::logger >
_log;
61 template <
typename T >
65 if constexpr (std::is_same_v< T, std::string >)
67 return source.c_str();
72 value.len = source.size();
73 value.p = &(source[0]);
94 template <
typename Iter,
typename Adaptor >
99 if constexpr (Utils::is_container_v< T >)
103 if constexpr (Utils::is_array_like_v< T >)
105 std::vector< T > data_buffer(std::distance(
begin,
end));
106 auto buffer_begin = data_buffer.begin();
109 *buffer_begin = adaptor(*
begin);
115 std::vector< hvl_t > data_buffer(std::distance(
begin,
end));
117 auto buffer_begin = data_buffer.begin();
126 else if constexpr (std::is_same_v< T, std::string >)
130 std::vector< const char* > data_buffer(std::distance(
begin,
end));
132 auto buffer_begin = data_buffer.begin();
133 for (
auto it =
begin; it !=
end; ++it, ++buffer_begin)
144 std::vector< T > data_buffer(std::distance(
begin,
end));
147 auto buffer_begin = data_buffer.begin();
150 *buffer_begin = adaptor(*
begin);
Class which turns non-vector or plain-array containers into vectors. If the value_types are container...
Definition: hdfbufferfactory.hh:41
static auto buffer(Iter begin, Iter end, Adaptor &&adaptor)
static function for turning an iterator range with arbitrarty datatypes into a vector of data as retu...
Definition: hdfbufferfactory.hh:96
std::shared_ptr< spdlog::logger > _log
For logging all kinds of stuff.
Definition: hdfbufferfactory.hh:48
static auto convert_source(T &source)
function for converting source data into variable length type
Definition: hdfbufferfactory.hh:63
This file provides a class which is responsible for the automatic conversion between C/C++ types and ...
This file provides metafunctions for automatically determining the nature of a C/C++ types at compile...
typename remove_qualifier< T >::type remove_qualifier_t
Shorthand for 'typename remove_qualifier::value'.
Definition: type_traits.hh:97