impl Namespace Reference#
Rocprofiler SDK Developer API 0.5.0
ROCm Profiling API and tools
|
rocprofiler::sdk::join::impl Namespace Reference
Functions | |
template<int TraitT, typename ArgT > | |
decltype(auto) | join_arg (config _cfg, ArgT &&_v) |
Function Documentation
◆ join_arg()
template<int TraitT, typename ArgT >
|
inline |
Definition at line 126 of file join.hpp.
127{
128 using arg_type = mpl::basic_identity_t<ArgT>;
129
132 constexpr bool _has_traits_type = mpl::has_traits<arg_type>(0);
133 constexpr bool _has_key_type = mpl::has_key_type<arg_type>(0);
134 constexpr bool _has_value_type = mpl::has_value_type<arg_type>(0);
135 constexpr bool _has_mapped_type = mpl::has_mapped_type<arg_type>(0);
136
137 if constexpr(_is_string_type)
138 {
140 {
141 return std::string{"\""} + std::string{std::forward<ArgT>(_v)} + std::string{"\""};
142 }
143 else
144 {
145 return std::forward<ArgT>(_v);
146 }
147 }
148 else if constexpr(_is_iterable && !_has_traits_type &&
149 (_has_value_type || (_has_key_type && _has_mapped_type)))
150 {
151 if constexpr(_has_key_type && _has_mapped_type)
152 {
153 std::stringstream _ss{};
154 _ss.setf(_cfg.flags);
156 _ss << _cfg.array.delimiter << _cfg.pair.prefix << join_arg<TraitT>(_cfg, itr.first)
157 << _cfg.pair.delimiter << join_arg<TraitT>(_cfg, itr.second)
158 << _cfg.pair.suffix;
159 auto _ret = _ss.str();
163 : std::string{};
164 }
165 else if constexpr(_has_value_type)
166 {
167 std::stringstream _ss{};
168 _ss.setf(_cfg.flags);
170 _ss << _cfg.array.delimiter << join_arg<TraitT>(_cfg, itr);
171 auto _ret = _ss.str();
175 : std::string{};
176 }
177 }
178 else if constexpr(mpl::supports_ostream<ArgT>(0))
179 {
180 return std::forward<ArgT>(_v);
181 }
182 else
183 {
184 static_assert(_is_iterable, "Type is not iterable");
185 static_assert(!_has_traits_type, "Type has a traits type");
186 if constexpr(!_has_value_type)
187 {
188 static_assert(_has_key_type && _has_mapped_type,
189 "Type must have a key_type and mapped_type if there is no value_type");
190 }
191 else
192 {
193 static_assert(_has_value_type,
194 "Type must have a value_type if there is no key_type and mapped_type");
195 }
196 static_assert(std::is_empty<ArgT>::value,
197 "Error! argument type cannot be written to output stream");
198 }
199 // suppress any unused but set variable warnings
200 consume_args(_is_string_type,
201 _is_iterable,
202 _has_traits_type,
203 _has_key_type,
204 _has_value_type,
205 _has_mapped_type);
206}
decltype(auto) join_arg(config _cfg, ArgT &&_v)
Definition join.hpp:126
STL namespace.
References rocprofiler::sdk::join::config::array, rocprofiler::sdk::join::consume_args(), rocprofiler::sdk::join::triplet_config< Idx >::delimiter, rocprofiler::sdk::join::config::flags, rocprofiler::sdk::join::config::pair, rocprofiler::sdk::join::triplet_config< Idx >::prefix, rocprofiler::sdk::join::QuoteStrings, and rocprofiler::sdk::join::triplet_config< Idx >::suffix.
Here is the call graph for this function:
Generated by 1.9.8