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

Classes

struct  Config
 

Public Types

using Parameters = ServiceTable< Config >
 

Public Member Functions

 ~TrivialFileTransfer ()
 
 TrivialFileTransfer (Parameters const &pset)
 
 TrivialFileTransfer (TrivialFileTransfer const &)
 
 TrivialFileTransfer (TrivialFileTransfer &&)
 
TrivialFileTransferoperator= (TrivialFileTransfer const &)
 
TrivialFileTransferoperator= (TrivialFileTransfer &&)
 
- Public Member Functions inherited from art::FileTransfer
virtual ~FileTransfer () noexcept=default
 
int translateToLocalFilename (std::string const &uri, std::string &fileFQname)
 

Private Member Functions

int doTranslateToLocalFilename (std::string const &uri, std::string &fileFQname) override
 

Detailed Description

Definition at line 23 of file TrivialFileTransfer_service.cc.

Member Typedef Documentation

Definition at line 27 of file TrivialFileTransfer_service.cc.

Constructor & Destructor Documentation

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

Definition at line 44 of file TrivialFileTransfer_service.cc.

46  {}
art::TrivialFileTransfer::TrivialFileTransfer ( TrivialFileTransfer const &  )
default
art::TrivialFileTransfer::TrivialFileTransfer ( TrivialFileTransfer &&  )
default

Member Function Documentation

int art::TrivialFileTransfer::doTranslateToLocalFilename ( std::string const &  uri,
std::string fileFQname 
)
overrideprivatevirtual

Implements art::FileTransfer.

Definition at line 60 of file TrivialFileTransfer_service.cc.

62  {
63  if (uri.substr(0, 7) != fileURI) {
64  // Unexpected protocol: pass through.
65  fileFQname = uri;
67  }
69  fileFQname = "";
70  if (uri.substr(0, 7) != fileURI) {
72  return stat;
73  }
74  string inFileName{uri.substr(7)};
75  ifstream infile{inFileName};
76  if (!infile) {
78  return stat;
79  }
80  fileFQname = inFileName;
82  return stat;
83  // Implementation plan details -- alternatives not chosen:
84  // x We could merely return the file name (the URI with file:// stripped
85  // off).
86  // Since the SAM developers may look at this file as a template for their
87  // real GeneralFileTransfer service, it is perhaps better to do the work
88  // of making a copy into a designated area.
89  // x We merely strip the file:// from the URI; this adhoc class is not
90  // beefed
91  // up to deal with genuine web access.
92  // x An alternative would be to embed the last part of the file FQname into
93  // the
94  // scratch file name, to try to maintain traceability in case things
95  // break.
96  }
string infile
TrivialFileTransfer & art::TrivialFileTransfer::operator= ( TrivialFileTransfer const &  )
default
TrivialFileTransfer & art::TrivialFileTransfer::operator= ( TrivialFileTransfer &&  )
default

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