1#ifndef LIBPRESSIO_PRINTERS_H
2#define LIBPRESSIO_PRINTERS_H
22template <
class CharT =
char,
class Traits = std::
char_traits<CharT>>
23std::basic_ostream<CharT, Traits>&
29 default:
throw std::logic_error(
"invalid thread safety");
37template <
class CharT =
char,
class Traits = std::
char_traits<CharT>>
38std::basic_ostream<CharT, Traits>&
44 default:
throw std::logic_error(
"invalid key status");
52template <
class CharT =
char,
class Traits = std::
char_traits<CharT>>
60 std::copy( begin, end, std::ostream_iterator<T>(
out,
", "));
65 std::basic_ostream<CharT, Traits>&
out;
73template <
class CharT =
char,
class Traits = std::
char_traits<CharT>>
83template <
class CharT =
char,
class Traits = std::
char_traits<CharT>>
84std::basic_ostream<CharT, Traits>&
87 out <<
"data{ type=" << data.
dtype();
92 out <<
"} has_data=" ;
97 out << std::boolalpha << data.
has_data() <<
"}";
108template <
class CharT =
char,
class Traits = std::
char_traits<CharT>>
109std::basic_ostream<CharT, Traits>&
114 return out <<
"int8";
116 return out <<
"uint8";
118 return out <<
"int16";
120 return out <<
"uint16";
122 return out <<
"int32";
124 return out <<
"uint32";
126 return out <<
"int64";
128 return out <<
"uint64";
130 return out <<
"float";
132 return out <<
"double";
134 return out <<
"bool";
136 return out <<
"char*";
138 return out <<
"threadsafety";
140 return out <<
"dtype";
142 return out <<
"void*";
144 return out <<
"char*[]";
146 return out <<
"data";
149 return out <<
"unset";
158template <
class CharT =
char,
class Traits = std::
char_traits<CharT>>
159std::basic_ostream<CharT, Traits>&
161 auto type = option.
type();
162 out <<
"<" << type <<
"> = ";
167 return out << int16_t{option.
get_value<int8_t>()};
169 return out << uint16_t{option.
get_value<uint8_t>()};
171 return out << std::boolalpha << option.
get_value<
bool>();
173 return out << option.
get_value<int16_t>();
175 return out << option.
get_value<uint16_t>();
177 return out << option.
get_value<int32_t>();
179 return out << option.
get_value<uint32_t>();
181 return out << option.
get_value<int64_t>();
183 return out << option.
get_value<uint64_t>();
187 return out << option.
get_value<
double>();
189 return out <<
"\"" << option.
get_value<std::string>() <<
"\"";
194 auto const& values = option.
get_value<std::vector<std::string>>();
196 for (
auto const& value : values) {
197 out << value <<
", ";
208 return out <<
"<empty>";
210 return out <<
"<unsupported>";
213 return out <<
"<empty>" ;
223template <
class CharT =
char,
class Traits = std::
char_traits<CharT>>
224std::basic_ostream<CharT, Traits>&
226 for (
auto const& option : options) {
227 out << option.first <<
" " << option.second <<
"\n" ;
237template <
class CharT =
char,
class Traits = std::
char_traits<CharT>>
238std::basic_ostream<CharT, Traits>&
243 return out <<
"double";
245 return out <<
"float";
247 return out <<
"uint8_t";
249 return out <<
"uint16_t";
251 return out <<
"uint32_t";
253 return out <<
"uint64_t";
255 return out <<
"int8_t";
257 return out <<
"int16_t";
259 return out <<
"int32_t";
261 return out <<
"int64_t";
263 return out <<
"bool";
266 return out <<
"byte";
275template <
class CharT =
char,
class Traits = std::
char_traits<CharT>>
276std::basic_ostream<CharT, Traits>&
278 return out << comp.
prefix();
Definition: compressor.h:22
virtual const char * prefix() const =0
an extension header for adding compressor plugins to libpressio
C++ pressio_data interface.
C++ pressio_options and pressio_option interfaces.
Compress, decompress, and configure pressio and lossless compressors.
pressio_thread_safety
Definition: pressio_compressor.h:268
@ pressio_thread_safety_multiple
Definition: pressio_compressor.h:274
@ pressio_thread_safety_serialized
Definition: pressio_compressor.h:272
@ pressio_thread_safety_single
Definition: pressio_compressor.h:270
Information on types used by libpressio.
pressio_dtype
Definition: pressio_dtype.h:16
@ pressio_byte_dtype
Definition: pressio_dtype.h:27
@ pressio_bool_dtype
Definition: pressio_dtype.h:28
@ pressio_double_dtype
Definition: pressio_dtype.h:17
@ pressio_int16_dtype
Definition: pressio_dtype.h:24
@ pressio_uint64_dtype
Definition: pressio_dtype.h:22
@ pressio_float_dtype
Definition: pressio_dtype.h:18
@ pressio_uint16_dtype
Definition: pressio_dtype.h:20
@ pressio_int64_dtype
Definition: pressio_dtype.h:26
@ pressio_int8_dtype
Definition: pressio_dtype.h:23
@ pressio_uint8_dtype
Definition: pressio_dtype.h:19
@ pressio_uint32_dtype
Definition: pressio_dtype.h:21
@ pressio_int32_dtype
Definition: pressio_dtype.h:25
pressio_option_type
Definition: pressio_options.h:57
@ pressio_option_uint8_type
Definition: pressio_options.h:67
@ pressio_option_charptr_array_type
Definition: pressio_options.h:65
@ pressio_option_charptr_type
Definition: pressio_options.h:62
@ pressio_option_data_type
Definition: pressio_options.h:66
@ pressio_option_int64_type
Definition: pressio_options.h:72
@ pressio_option_uint64_type
Definition: pressio_options.h:71
@ pressio_option_unset_type
Definition: pressio_options.h:64
@ pressio_option_float_type
Definition: pressio_options.h:60
@ pressio_option_bool_type
Definition: pressio_options.h:73
@ pressio_option_double_type
Definition: pressio_options.h:61
@ pressio_option_uint32_type
Definition: pressio_options.h:58
@ pressio_option_int32_type
Definition: pressio_options.h:59
@ pressio_option_int16_type
Definition: pressio_options.h:70
@ pressio_option_userptr_type
Definition: pressio_options.h:63
@ pressio_option_int8_type
Definition: pressio_options.h:68
@ pressio_option_uint16_type
Definition: pressio_options.h:69
@ pressio_option_threadsafety_type
Definition: pressio_options.h:75
@ pressio_option_dtype_type
Definition: pressio_options.h:74
pressio_options_key_status
Definition: pressio_options.h:27
@ pressio_options_key_does_not_exist
Definition: pressio_options.h:35
@ pressio_options_key_set
Definition: pressio_options.h:29
@ pressio_options_key_exists
Definition: pressio_options.h:32
std::basic_ostream< CharT, Traits > & operator<<(std::basic_ostream< CharT, Traits > &out, pressio_thread_safety const &safety)
Definition: printers.h:24
print_elements_helper< CharT, Traits > print_elements(std::basic_ostream< CharT, Traits > &out)
Definition: printers.h:74
bool has_data() const
Definition: data.h:334
pressio_dtype dtype() const
Definition: data.h:341
size_t num_elements() const
Definition: data.h:432
std::vector< size_t > const & dimensions() const
Definition: data.h:367
enum pressio_option_type type() const
void * get_value() const
Definition: options.h:187
bool has_value() const
Definition: options.h:199
Definition: options.h:352
Definition: printers.h:53
int operator()(T const *begin, T const *end)
Definition: printers.h:58
std::basic_ostream< CharT, Traits > & out
Definition: printers.h:65