| The Gaudi Framework v29r1 (5cd95fa2)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

FileReadTool.cpp
Go to the documentation of this file.
1 #include "FileReadTool.h"
2 #include <fstream>
3
4 DECLARE_COMPONENT( FileReadTool )
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
12 std::unique_ptr<std::istream> FileReadTool::open( const std::string& url )
13 {
14 // remove the optional "file://" from the beginning of the url
15 std::string path;
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
24 const std::vector<std::string>& FileReadTool::protocols() const
25 {
27 static const std::vector<std::string> s_protocols = {{"file"}};
28 return s_protocols;
29 }
GaudiPython.HistoUtils.path
path
Definition: HistoUtils.py:895
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:32
FileReadTool
Basic implementation of the IFileAccess interface.
Definition: FileReadTool.h:16
std
STL namespace.
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition: PluginService.h:33
std::string
STL class.
IInterface
Definition of the basic interface.
Definition: IInterface.h:277
gaudirun.type
type
Definition: gaudirun.py:133
FileReadTool.h
std::vector< std::string >
std::unique_ptr
STL class.
FileReadTool::protocols
const std::vector< std::string > & protocols() const override
Protocols supported by the instance.
Definition: FileReadTool.cpp:24
CommonMessaging
Definition: CommonMessaging.h:62
std::string::substr
T substr(T...args)
FileReadTool::open
std::unique_ptr< std::istream > open(const std::string &url) override
Definition: FileReadTool.cpp:12
std::ifstream
STL class.
std::string::compare
T compare(T...args)