The Gaudi Framework  v29r0 (ff2e7097)
FileReadTool.cpp
Go to the documentation of this file.
1 #include "FileReadTool.h"
2 #include <fstream>
3 
5 
6 FileReadTool::FileReadTool( const std::string& type, const std::string& name, const IInterface* parent )
7  : base_class( type, name, parent )
8 {
9  // declareInterface<IFileAccess>(this);
10 }
11 
13 {
14  // remove the optional "file://" from the beginning of the url
16  if ( url.compare( 0, 7, "file://" ) == 0 ) {
17  path = url.substr( 7 );
18  } else {
19  path = url;
20  }
21  return std::unique_ptr<std::istream>( new std::ifstream{path} );
22 }
23 
25 {
27  static const std::vector<std::string> s_protocols = {{"file"}};
28  return s_protocols;
29 }
Basic implementation of the IFileAccess interface.
Definition: FileReadTool.h:16
STL namespace.
#define DECLARE_COMPONENT(type)
Definition: PluginService.h:33
STL class.
Definition of the basic interface.
Definition: IInterface.h:277
STL class.
const std::vector< std::string > & protocols() const override
Protocols supported by the instance.
T substr(T...args)
std::unique_ptr< std::istream > open(const std::string &url) override
STL class.
T compare(T...args)