LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
art::TrivialFileDelivery Class Reference

#include "TrivialFileDelivery.h"

Inheritance diagram for art::TrivialFileDelivery:
art::CatalogInterface

Classes

struct  Config
 

Public Types

using Parameters = ServiceTable< Config >
 

Public Member Functions

 TrivialFileDelivery (Parameters const &config)
 
void configure (std::vector< std::string > const &items)
 
int getNextFileURI (std::string &uri, double &waitTime)
 
void updateStatus (std::string const &uri, FileDisposition status)
 
void outputFileClosed (std::string const &module_label, std::string const &fileFQname)
 
void outputFileOpened (std::string const &module_label)
 
void outputModuleInitiated (std::string const &module_label, fhicl::ParameterSet const &pset)
 
void eventSelected (std::string const &module_label, EventID const &event_id, HLTGlobalStatus const &acceptance_info)
 
bool isSearchable ()
 
void rewind ()
 

Private Member Functions

void doConfigure (std::vector< std::string > const &items) override
 
int doGetNextFileURI (std::string &uri, double &waitTime) override
 
void doUpdateStatus (std::string const &uri, FileDisposition status) override
 
void doOutputFileOpened (std::string const &module_label) override
 
void doOutputModuleInitiated (std::string const &module_label, fhicl::ParameterSet const &pset) override
 
void doOutputFileClosed (std::string const &module_label, std::string const &file) override
 
void doEventSelected (std::string const &module_label, EventID const &event_id, HLTGlobalStatus const &acceptance_info) override
 
bool doIsSearchable () override
 
void doRewind () override
 
std::vector< std::string > extractFileListFromPset (fhicl::ParameterSet const &pset)
 
std::string prependFileDesignation (std::string const &name) const
 

Private Attributes

std::vector< std::string > fileList {}
 
std::vector< std::string >::const_iterator nextFile {fileList.cbegin()}
 
std::vector< std::string >::const_iterator endOfFiles {fileList.cend()}
 

Detailed Description

Definition at line 31 of file TrivialFileDelivery.h.

Member Typedef Documentation

Constructor & Destructor Documentation

art::TrivialFileDelivery::TrivialFileDelivery ( TrivialFileDelivery::Parameters const &  config)

Definition at line 23 of file TrivialFileDelivery_service.cc.

25 {}

Member Function Documentation

void art::CatalogInterface::configure ( std::vector< std::string > const &  items)
inlineinherited

Definition at line 65 of file CatalogInterface.h.

References art::CatalogInterface::doConfigure().

66 {
67  CET_ASSERT_ONLY_ONE_THREAD();
68  doConfigure(items);
69 }
virtual void doConfigure(std::vector< std::string > const &item)=0
void art::TrivialFileDelivery::doConfigure ( std::vector< std::string > const &  items)
overrideprivatevirtual

Implements art::CatalogInterface.

Definition at line 28 of file TrivialFileDelivery_service.cc.

29 {
30  fileList = items;
31  nextFile = fileList.begin();
32  endOfFiles = fileList.end();
33 }
std::vector< std::string >::const_iterator nextFile
std::vector< std::string >::const_iterator endOfFiles
std::vector< std::string > fileList
void art::TrivialFileDelivery::doEventSelected ( std::string const &  module_label,
EventID const &  event_id,
HLTGlobalStatus const &  acceptance_info 
)
overrideprivatevirtual

Implements art::CatalogInterface.

Definition at line 76 of file TrivialFileDelivery_service.cc.

79 {}
int art::TrivialFileDelivery::doGetNextFileURI ( std::string &  uri,
double &  waitTime 
)
overrideprivatevirtual

Implements art::CatalogInterface.

Definition at line 36 of file TrivialFileDelivery_service.cc.

References art::NO_MORE_FILES, and art::SUCCESS.

37 {
38  FileDeliveryStatus stat;
39  if (nextFile == endOfFiles) {
41  return stat;
42  }
43  auto pos = nextFile->find("://"); // Look for protocol.
44  if (pos == std::string::npos) { // Bare filename.
45  throwIfFileNotExist(nextFile->c_str());
47  } else if (nextFile->substr(0, pos) == "file") { // file://
48  throwIfFileNotExist(nextFile->c_str() + pos + 3);
49  uri = *nextFile;
50  } else { // Unknown URI.
51  uri = *nextFile;
52  }
53  waitTime = 0.0;
55  ++nextFile;
56  return stat;
57 }
std::vector< std::string >::const_iterator nextFile
std::string prependFileDesignation(std::string const &name) const
std::vector< std::string >::const_iterator endOfFiles
bool art::TrivialFileDelivery::doIsSearchable ( )
overrideprivatevirtual

Implements art::CatalogInterface.

Definition at line 82 of file TrivialFileDelivery_service.cc.

83 {
84  return true;
85 }
void art::TrivialFileDelivery::doOutputFileClosed ( std::string const &  module_label,
std::string const &  file 
)
overrideprivatevirtual

Implements art::CatalogInterface.

Definition at line 72 of file TrivialFileDelivery_service.cc.

74 {}
void art::TrivialFileDelivery::doOutputFileOpened ( std::string const &  module_label)
overrideprivatevirtual

Implements art::CatalogInterface.

Definition at line 65 of file TrivialFileDelivery_service.cc.

66 {}
void art::TrivialFileDelivery::doOutputModuleInitiated ( std::string const &  module_label,
fhicl::ParameterSet const &  pset 
)
overrideprivatevirtual

Implements art::CatalogInterface.

Definition at line 68 of file TrivialFileDelivery_service.cc.

70 {}
void art::TrivialFileDelivery::doRewind ( )
overrideprivatevirtual

Implements art::CatalogInterface.

Definition at line 87 of file TrivialFileDelivery_service.cc.

88 {
89  nextFile = fileList.begin();
90 }
std::vector< std::string >::const_iterator nextFile
std::vector< std::string > fileList
void art::TrivialFileDelivery::doUpdateStatus ( std::string const &  uri,
FileDisposition  status 
)
overrideprivatevirtual

Implements art::CatalogInterface.

Definition at line 62 of file TrivialFileDelivery_service.cc.

63 {}
void art::CatalogInterface::eventSelected ( std::string const &  module_label,
EventID const &  event_id,
HLTGlobalStatus const &  acceptance_info 
)
inlineinherited

Definition at line 110 of file CatalogInterface.h.

References art::CatalogInterface::doEventSelected().

113 {
114  CET_ASSERT_ONLY_ONE_THREAD();
115  doEventSelected(module_label, event_id, acceptance_info);
116 }
virtual void doEventSelected(std::string const &module_label, EventID const &event_id, HLTGlobalStatus const &acceptance_info)=0
std::vector< std::string > art::TrivialFileDelivery::extractFileListFromPset ( fhicl::ParameterSet const &  pset)
private

Definition at line 94 of file TrivialFileDelivery_service.cc.

References fhicl::ParameterSet::get().

95 {
96  auto const& p = pset.get<ParameterSet>("source");
97  return p.get<std::vector<std::string>>("fileNames");
98  // TODO -- How do we properly throw if either source or fileNames is absent?
99  // get() does throw, but is it the right throw and should we be catching it?
100 }
T get(std::string const &key) const
Definition: ParameterSet.h:231
int art::CatalogInterface::getNextFileURI ( std::string &  uri,
double &  waitTime 
)
inlineinherited

Definition at line 72 of file CatalogInterface.h.

References art::CatalogInterface::doGetNextFileURI().

73 {
74  CET_ASSERT_ONLY_ONE_THREAD();
75  return doGetNextFileURI(uri, waitTime);
76 }
virtual int doGetNextFileURI(std::string &uri, double &waitTime)=0
bool art::CatalogInterface::isSearchable ( )
inlineinherited

Definition at line 119 of file CatalogInterface.h.

References art::CatalogInterface::doIsSearchable().

120 {
121  CET_ASSERT_ONLY_ONE_THREAD();
122  return doIsSearchable();
123 }
virtual bool doIsSearchable()=0
void art::CatalogInterface::outputFileClosed ( std::string const &  module_label,
std::string const &  fileFQname 
)
inlineinherited

Definition at line 87 of file CatalogInterface.h.

References art::CatalogInterface::doOutputFileClosed().

89 {
90  CET_ASSERT_ONLY_ONE_THREAD();
91  doOutputFileClosed(module_label, fileFQname);
92 }
virtual void doOutputFileClosed(std::string const &module_label, std::string const &fileFQname)=0
void art::CatalogInterface::outputFileOpened ( std::string const &  module_label)
inlineinherited

Definition at line 95 of file CatalogInterface.h.

References art::CatalogInterface::doOutputFileOpened().

96 {
97  CET_ASSERT_ONLY_ONE_THREAD();
98  doOutputFileOpened(module_label);
99 }
virtual void doOutputFileOpened(std::string const &module_label)=0
void art::CatalogInterface::outputModuleInitiated ( std::string const &  module_label,
fhicl::ParameterSet const &  pset 
)
inlineinherited

Definition at line 102 of file CatalogInterface.h.

References art::CatalogInterface::doOutputModuleInitiated().

104 {
105  CET_ASSERT_ONLY_ONE_THREAD();
106  doOutputModuleInitiated(module_label, pset);
107 }
virtual void doOutputModuleInitiated(std::string const &module_label, fhicl::ParameterSet const &pset)=0
std::string art::TrivialFileDelivery::prependFileDesignation ( std::string const &  name) const
private

Definition at line 103 of file TrivialFileDelivery_service.cc.

References DEFINE_ART_SERVICE_INTERFACE_IMPL, and s.

104 {
105  std::string const s{"file://"};
106  return s + name;
107 }
Float_t s
Definition: plot.C:23
void art::CatalogInterface::rewind ( )
inlineinherited

Definition at line 126 of file CatalogInterface.h.

References DECLARE_ART_SERVICE_INTERFACE, art::CatalogInterface::doRewind(), and art::LEGACY.

127 {
128  CET_ASSERT_ONLY_ONE_THREAD();
129  doRewind();
130 }
virtual void doRewind()=0
void art::CatalogInterface::updateStatus ( std::string const &  uri,
FileDisposition  status 
)
inlineinherited

Definition at line 79 of file CatalogInterface.h.

References art::CatalogInterface::doUpdateStatus().

81 {
82  CET_ASSERT_ONLY_ONE_THREAD();
83  doUpdateStatus(uri, status);
84 }
virtual void doUpdateStatus(std::string const &uri, FileDisposition status)=0

Member Data Documentation

std::vector<std::string>::const_iterator art::TrivialFileDelivery::endOfFiles {fileList.cend()}
private

Definition at line 66 of file TrivialFileDelivery.h.

std::vector<std::string> art::TrivialFileDelivery::fileList {}
private

Definition at line 64 of file TrivialFileDelivery.h.

std::vector<std::string>::const_iterator art::TrivialFileDelivery::nextFile {fileList.cbegin()}
private

Definition at line 65 of file TrivialFileDelivery.h.


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