| The Gaudi Framework v28r2p1 (f1a77ff4)

- 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,
7 const std::string& name,
8 const IInterface* parent):
9 base_class(type, name, parent)
10 {
11 //declareInterface<IFileAccess>(this);
12 }
13
14 std::unique_ptr<std::istream> FileReadTool::open(const std::string &url) {
15 // remove the optional "file://" from the beginning of the url
16 std::string path;
17 if ( url.compare(0,7,"file://") == 0 ) {
18 path = url.substr(7);
19 } else {
20 path = url;
21 }
22 return std::unique_ptr<std::istream>(new std::ifstream{path});
23 }
24
25 const std::vector<std::string> &FileReadTool::protocols() const
26 {
28 static const std::vector<std::string> s_protocols = {{"file"}};
29 return s_protocols;
30 }
GaudiPython.HistoUtils.path
path
Definition: HistoUtils.py:772
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
FileReadTool
Basic implementation of the IFileAccess interface.
Definition: FileReadTool.h:16
std
STL namespace.
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition: PluginService.h:36
std::string
STL class.
IInterface
Definition of the basic interface.
Definition: IInterface.h:234
gaudirun.type
type
Definition: gaudirun.py:125
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:25
CommonMessaging
Definition: CommonMessaging.h:55
std::string::substr
T substr(T...args)
FileReadTool::open
std::unique_ptr< std::istream > open(const std::string &url) override
Definition: FileReadTool.cpp:14
std::ifstream
STL class.
std::string::compare
T compare(T...args)