Classes | Public Types | Public Member Functions | Private Member Functions | List of all members
art::TrivialFileTransfer Class Reference

#include "/cvmfs/nova.opensciencegrid.org/externals/art/v2_13_00/source/art/Framework/Services/Optional/TrivialFileTransfer.h"

Inheritance diagram for art::TrivialFileTransfer:
art::FileTransfer

Classes

struct  Config
 

Public Types

using Parameters = ServiceTable< Config >
 

Public Member Functions

 TrivialFileTransfer (Parameters const &pset)
 
int translateToLocalFilename (std::string const &uri, std::string &fileFQname)
 

Private Member Functions

int doTranslateToLocalFilename (std::string const &uri, std::string &fileFQname) override
 
int stripURI (std::string const &uri, std::string &inFileName) const
 
int copyFile (std::ifstream &in, std::ofstream &out) const
 

Detailed Description

Definition at line 26 of file TrivialFileTransfer.h.

Member Typedef Documentation

Definition at line 30 of file TrivialFileTransfer.h.

Constructor & Destructor Documentation

art::TrivialFileTransfer::TrivialFileTransfer ( TrivialFileTransfer::Parameters const &  pset)

Definition at line 18 of file TrivialFileTransfer_service.cc.

20 {}

Member Function Documentation

int art::TrivialFileTransfer::copyFile ( std::ifstream &  in,
std::ofstream &  out 
) const
private

Definition at line 72 of file TrivialFileTransfer_service.cc.

References DEFINE_ART_SERVICE_INTERFACE_IMPL.

73 {
74  std::copy(std::istream_iterator<char>{in},
75  std::istream_iterator<char>{},
76  std::ostream_iterator<char>{out});
77  return 0;
78 }
ifstream in
Definition: comparison.C:7
int art::TrivialFileTransfer::doTranslateToLocalFilename ( std::string const &  uri,
std::string fileFQname 
)
overrideprivatevirtual

Implements art::FileTransfer.

Definition at line 23 of file TrivialFileTransfer_service.cc.

References art::detail::FDS::BAD_REQUEST, infile, mkDefs::inFileName, art::detail::FDS::NOT_FOUND, art::PENDING, string, and art::SUCCESS.

25 {
26  if (uri.substr(0, 7) != fileURI) {
27  fileFQname = uri; // Unexpected protocol: pass through.
29  }
30 
32  fileFQname = "";
34  if (stripURI(uri, inFileName) != 0) {
36  return stat;
37  }
38 
39  ifstream infile{inFileName.c_str()};
40  if (!infile) {
42  return stat;
43  }
44  fileFQname = inFileName;
46  return stat;
47  // Implementation plan details -- alternatives not chosen:
48  // x We could merely return the file name (the URI with file:// stripped off).
49  // Since the SAM developers may look at this file as a template for their
50  // real GeneralFileTransfer service, it is perhaps better to do the work of
51  // making a copy into a designated area.
52  // x We merely strip the file:// from the URI; this adhoc class is not beefed
53  // up to deal with genuine web access.
54  // x An alternative would be to embed the last part of the file FQname into
55  // the
56  // scratch file name, to try to maintain traceability in case things break.
57 }
string infile
inFileName
if we get here, we&#39;re doing the base definitions:
Definition: mkDefs.py:168
int stripURI(std::string const &uri, std::string &inFileName) const
const XML_Char const XML_Char * uri
Definition: expat.h:380
enum BeamMode string
int art::TrivialFileTransfer::stripURI ( std::string const &  uri,
std::string inFileName 
) const
private

Definition at line 60 of file TrivialFileTransfer_service.cc.

62 {
63  if (uri.substr(0, 7) != fileURI) {
64  inFileName = "";
65  return 1;
66  }
67  inFileName = uri.substr(7);
68  return 0;
69 }
inFileName
if we get here, we&#39;re doing the base definitions:
Definition: mkDefs.py:168
const XML_Char const XML_Char * uri
Definition: expat.h:380
int art::FileTransfer::translateToLocalFilename ( std::string const &  uri,
std::string fileFQname 
)
inlineinherited

Definition at line 34 of file FileTransfer.h.

References CET_ASSERT_ONLY_ONE_THREAD, DECLARE_ART_SERVICE_INTERFACE(), art::FileTransfer::doTranslateToLocalFilename(), and art::LEGACY.

36 {
38  return doTranslateToLocalFilename(uri, fileFQname);
39 }
#define CET_ASSERT_ONLY_ONE_THREAD()
virtual int doTranslateToLocalFilename(std::string const &uri, std::string &fileFQname)=0
const XML_Char const XML_Char * uri
Definition: expat.h:380

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