LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
art::detail::FileNameComponents Class Reference

#include "FileNameComponents.h"

Public Member Functions

void add (std::string const &prefix, std::string const &digitFormat)
 
void setSuffix (std::string suffix)
 
std::string fileNameWithIndex (std::size_t index) const
 
bool operator< (FileNameComponents const &fnc) const
 

Private Attributes

std::vector< std::pair< std::string, std::string > > components_
 
std::string suffix_ {}
 

Detailed Description

Definition at line 28 of file FileNameComponents.h.

Member Function Documentation

void art::detail::FileNameComponents::add ( std::string const &  prefix,
std::string const &  digitFormat 
)

Definition at line 11 of file FileNameComponents.cc.

References components_.

Referenced by art::detail::componentsFromPattern().

13  {
14  components_.emplace_back(prefix, digitFormat);
15  }
std::vector< std::pair< std::string, std::string > > components_
std::string art::detail::FileNameComponents::fileNameWithIndex ( std::size_t  index) const

Definition at line 45 of file FileNameComponents.cc.

References components_, and suffix_.

46  {
47  std::ostringstream num_str;
48  for (auto const& pr : components_) {
49  auto const& prefix = pr.first;
50  auto const& specifier = pr.second;
51  num_str << prefix;
52  if (!specifier.empty()) { // Zero-filling.
53  num_str << std::setfill('0') << std::setw(std::stoul(specifier));
54  }
55  num_str << index;
56  }
57  num_str << suffix_;
58  return num_str.str();
59  }
std::vector< std::pair< std::string, std::string > > components_
bool art::detail::FileNameComponents::operator< ( FileNameComponents const &  fnc) const

Definition at line 24 of file FileNameComponents.cc.

References util::cbegin(), util::cend(), and components_.

25  {
26  if (components_.size() < fnc.components_.size()) {
27  return true;
28  }
29  if (components_.size() > fnc.components_.size()) {
30  return false;
31  }
32 
33  assert(components_.size() == fnc.components_.size());
34  auto b1 = cbegin(components_), e1 = cend(components_);
35  auto b2 = cbegin(fnc.components_);
36  for (; b1 != e1; ++b1, ++b2) {
37  if (b1->first < b2->first)
38  return true;
39  }
40  assert(b2 == cend(fnc.components_));
41  return false;
42  }
decltype(auto) constexpr cend(T &&obj)
ADL-aware version of std::cend.
Definition: StdUtils.h:93
decltype(auto) constexpr cbegin(T &&obj)
ADL-aware version of std::cbegin.
Definition: StdUtils.h:85
std::vector< std::pair< std::string, std::string > > components_
void art::detail::FileNameComponents::setSuffix ( std::string  suffix)

Definition at line 18 of file FileNameComponents.cc.

References suffix_.

Referenced by art::detail::componentsFromPattern().

19  {
20  suffix_ = std::move(suffix);
21  }

Member Data Documentation

std::vector<std::pair<std::string, std::string> > art::detail::FileNameComponents::components_
private

Definition at line 39 of file FileNameComponents.h.

Referenced by add(), fileNameWithIndex(), and operator<().

std::string art::detail::FileNameComponents::suffix_ {}
private

Definition at line 40 of file FileNameComponents.h.

Referenced by fileNameWithIndex(), and setSuffix().


The documentation for this class was generated from the following files: