The Gaudi Framework  v36r1 (3e2fb5a8)
FileReadTool.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #include "FileReadTool.h"
12 #include <fstream>
13 
15 
16 std::unique_ptr<std::istream> FileReadTool::open( const std::string& url ) {
17  // remove the optional "file://" from the beginning of the url
19  if ( url.compare( 0, 7, "file://" ) == 0 ) {
20  path = url.substr( 7 );
21  } else {
22  path = url;
23  }
24  return std::make_unique<std::ifstream>( path );
25 }
26 
29  static const std::vector<std::string> s_protocols = {{"file"}};
30  return s_protocols;
31 }
std::string
STL class.
FileReadTool
Definition: FileReadTool.h:26
std::vector< std::string >
GaudiPython.HistoUtils.path
path
Definition: HistoUtils.py:943
std
STL namespace.
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition: PluginServiceV1.h:46
FileReadTool.h
FileReadTool::protocols
const std::vector< std::string > & protocols() const override
Protocols supported by the instance.
Definition: FileReadTool.cpp:27