| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

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

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
FileReadTool.cpp
Go to the documentation of this file.
1 #include "FileReadTool.h"
2 #include <fstream>
3
4 #include "GaudiKernel/ToolFactory.h"
5 DECLARE_COMPONENT( FileReadTool )
6
7 FileReadTool::FileReadTool( const std::string& type,
8 const std::string& name,
9 const IInterface* parent):
10 base_class(type, name, parent)
11 {
12 //declareInterface<IFileAccess>(this);
13 m_protocols.push_back("file");
14 }
15
16 FileReadTool::~FileReadTool(){}
17
18 std::auto_ptr<std::istream> FileReadTool::open(const std::string &url) {
19 // remove the optional "file://" from the beginning of the url
20 std::string path;
21 if ( url.substr(0,7) == "file://" ) {
22 path = url.substr(7);
23 } else {
24 path = url;
25 }
26 return std::auto_ptr<std::istream>(new std::ifstream(path.c_str()));
27 }
28
29 const std::vector<std::string> &FileReadTool::protocols() const
30 {
31 return m_protocols;
32 }