join Namespace Reference

join Namespace Reference#

Rocprofiler SDK Developer API: rocprofiler::sdk::join Namespace Reference
Rocprofiler SDK Developer API 0.4.0
ROCm Profiling API and tools
rocprofiler::sdk::join Namespace Reference

Namespaces

namespace  impl
 

Data Structures

struct  config
 
struct  triplet_config
 

Typedefs

using generic_config = triplet_config< 0 >
 
using array_config = triplet_config< 1 >
 
using pair_config = triplet_config< 2 >
 

Enumerations

enum  {
  NoQuoteStrings = 0x0 ,
  QuoteStrings = 0x1
}
 

Functions

template<typename... ArgsT>
void consume_args (ArgsT &&...)
 
template<int TraitT = NoQuoteStrings, typename... Args>
auto join (config _cfg, Args &&... _args)
 
template<int TraitT = NoQuoteStrings, typename... Args>
auto join (std::array< std::string_view, 3 > &&_delims, Args &&... _args)
 
template<int TraitT = NoQuoteStrings, typename DelimT , typename... Args, std::enable_if_t<!mpl::is_basic_same< config, DelimT >::value, int > = 0>
auto join (DelimT &&_delim, Args &&... _args)
 
template<typename ArgT >
auto quoted (ArgT &&_arg)
 

Typedef Documentation

◆ array_config

Definition at line 64 of file join.hpp.

◆ generic_config

Definition at line 63 of file join.hpp.

◆ pair_config

Definition at line 65 of file join.hpp.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
NoQuoteStrings 
QuoteStrings 

Definition at line 48 of file join.hpp.

49{
50 NoQuoteStrings = 0x0,
51 QuoteStrings = 0x1
52};

Function Documentation

◆ consume_args()

template<typename... ArgsT>
void rocprofiler::sdk::join::consume_args ( ArgsT &&  ...)
inline

Definition at line 45 of file join.hpp.

46{}

Referenced by rocprofiler::sdk::join::impl::join_arg().

+ Here is the caller graph for this function:

◆ join() [1/3]

template<int TraitT = NoQuoteStrings, typename... Args>
auto rocprofiler::sdk::join::join ( config  _cfg,
Args &&...  _args 
)

Definition at line 211 of file join.hpp.

212{
213 static_assert(std::is_trivially_copyable<config>::value,
214 "Error! config is not trivially copyable");
215
216 std::stringstream _ss{};
217 _ss.setf(_cfg.flags);
218 ((_ss << ((mpl::is_empty(_args)) ? std::string_view{} : std::string_view{_cfg.delimiter})
219 << impl::join_arg<TraitT>(_cfg, _args)),
220 ...);
221 auto _ret = _ss.str();
222 auto&& _len = _cfg.delimiter.length();
223 auto _cmp =
224 strncmp(std::string_view{_ret}.data(), std::string_view{_cfg.delimiter}.data(), _len) == 0;
225 return (_ret.length() > _len) ? (std::string{_cfg.prefix} +
226 ((_cmp) ? _ret.substr(_len) : _ret) + std::string{_cfg.suffix})
227 : std::string{};
228}
STL namespace.

References rocprofiler::sdk::join::triplet_config< Idx >::delimiter, rocprofiler::sdk::join::config::flags, rocprofiler::sdk::mpl::is_empty(), join(), rocprofiler::sdk::join::triplet_config< Idx >::prefix, and rocprofiler::sdk::join::triplet_config< Idx >::suffix.

Referenced by join(), join(), join(), and quoted().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ join() [2/3]

template<int TraitT = NoQuoteStrings, typename DelimT , typename... Args, std::enable_if_t<!mpl::is_basic_same< config, DelimT >::value, int > = 0>
auto rocprofiler::sdk::join::join ( DelimT &&  _delim,
Args &&...  _args 
)

Definition at line 246 of file join.hpp.

247{
248 using delim_type = mpl::basic_identity_t<DelimT>;
249
250 if constexpr(std::is_constructible<config, delim_type>::value)
251 {
252 auto _cfg = config{std::forward<DelimT>(_delim)};
253 return join<TraitT>(_cfg, std::forward<Args>(_args)...);
254 }
255 else if constexpr(std::is_same<delim_type, char>::value)
256 {
257 auto _cfg = config{};
258 const char _delim_c[2] = {_delim, '\0'};
259 _cfg.delimiter = _delim_c;
260 return join<TraitT>(_cfg, std::forward<Args>(_args)...);
261 }
262 else
263 {
264 auto _cfg = config{};
265 _cfg.delimiter = std::string_view{_delim};
266 return join<TraitT>(_cfg, std::forward<Args>(_args)...);
267 }
268}

References rocprofiler::sdk::join::triplet_config< Idx >::delimiter, and join().

+ Here is the call graph for this function:

◆ join() [3/3]

template<int TraitT = NoQuoteStrings, typename... Args>
auto rocprofiler::sdk::join::join ( std::array< std::string_view, 3 > &&  _delims,
Args &&...  _args 
)

Definition at line 232 of file join.hpp.

233{
234 auto _cfg = config{};
235 _cfg.delimiter = _delims.at(0);
236 _cfg.prefix = _delims.at(1);
237 _cfg.suffix = _delims.at(2);
238 return join(_cfg, std::forward<Args>(_args)...);
239}

References rocprofiler::sdk::join::triplet_config< Idx >::delimiter, and join().

+ Here is the call graph for this function:

◆ quoted()

template<typename ArgT >
auto rocprofiler::sdk::join::quoted ( ArgT &&  _arg)

Definition at line 272 of file join.hpp.

273{
274 auto _cfg = config{};
275 _cfg.prefix = "\"";
276 _cfg.suffix = "\"";
277 return join(_cfg, std::forward<ArgT>(_arg));
278}

References join(), and rocprofiler::sdk::join::triplet_config< Idx >::prefix.

+ Here is the call graph for this function: