LArSoft  v06_85_00
Liquid Argon Software toolkit - http://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 29 of file FileNameComponents.h.

Member Function Documentation

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

Definition at line 12 of file FileNameComponents.cc.

References components_.

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

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

Definition at line 46 of file FileNameComponents.cc.

References components_, and suffix_.

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

Definition at line 25 of file FileNameComponents.cc.

References components_.

26  {
27  if (components_.size() < fnc.components_.size()) {
28  return true;
29  }
30  if (components_.size() > fnc.components_.size()) {
31  return false;
32  }
33 
34  assert(components_.size() == fnc.components_.size());
35  auto b1 = cbegin(components_), e1 = cend(components_);
36  auto b2 = cbegin(fnc.components_);
37  for (; b1 != e1; ++b1, ++b2) {
38  if (b1->first < b2->first)
39  return true;
40  }
41  assert(b2 == cend(fnc.components_));
42  return false;
43  }
std::vector< std::pair< std::string, std::string > > components_
void art::detail::FileNameComponents::setSuffix ( std::string  suffix)

Definition at line 19 of file FileNameComponents.cc.

References suffix_.

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

20  {
21  suffix_ = move(suffix);
22  }

Member Data Documentation

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

Definition at line 40 of file FileNameComponents.h.

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

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

Definition at line 41 of file FileNameComponents.h.

Referenced by fileNameWithIndex(), and setSuffix().


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