| # Gaudi Framework, version v22r4 |

Home |  | Generated: Fri Sep 2 2011

Public Member Functions | Private Attributes

# FileReadTool Class Reference

Basic implementation of the IFileAccess interface. More...

`#include <FileReadTool.h>`

Inheritance diagram for FileReadTool:
[legend]
Collaboration diagram for FileReadTool:
[legend]

List of all members.

## Public Member Functions
| FileReadTool (const std::string &type, const std::string &name, const IInterface *parent)
| Standard constructor.
virtual | ~FileReadTool ()
virtual std::auto_ptr < std::istream > | open (const std::string &url)
| Find the URL and returns an auto_ptr to an input stream interface of an object that can be used to read from the file the URL is pointing to.
virtual const std::vector < std::string > & | protocols () const
| Protocols supported by the instance.
## Private Attributes
std::vector< std::string > | m_protocols
| Vector of supported protocols.

## Detailed Description

Basic implementation of the IFileAccess interface.

This tool simply takes a path to a file as url and return the std::istream interface of std::ifstream.

Author:
  Marco Clemencic

Date:
  2008-01-18

Definition at line 17 of file FileReadTool.h.

## Constructor & Destructor Documentation

FileReadTool::FileReadTool | ( | const std::string & | type,
|  | const std::string & | name,
|  | const IInterface * | parent
| ) |  |

Standard constructor.

Definition at line 7 of file FileReadTool.cpp.

                                                         :
      base_class(type, name, parent)
    {
      //declareInterface<IFileAccess>(this);
      m_protocols.push_back("file");
    }

FileReadTool::~FileReadTool | ( | ) | `[virtual]`

Definition at line 16 of file FileReadTool.cpp.

    {}

## Member Function Documentation

std::auto_ptr< std::istream > FileReadTool::open | ( | const std::string & | url ) | `[virtual]`

Find the URL and returns an auto_ptr to an input stream interface of an object that can be used to read from the file the URL is pointing to.

Returns an empty pointer if the URL cannot be resolved.

Implements IFileAccess.

Definition at line 18 of file FileReadTool.cpp.

                                                                   {
      // remove the optional "file://" from the beginning of the url
      std::string path;
      if ( url.substr(0,7) == "file://" ) {
        path = url.substr(7);
      } else {
        path = url;
      }
      return std::auto_ptr<std::istream>(new std::ifstream(path.c_str()));
    }

const std::vector< std::string > & FileReadTool::protocols | ( | ) | const`[virtual]`

Protocols supported by the instance.

Implements IFileAccess.

Definition at line 29 of file FileReadTool.cpp.

    {
      return m_protocols;
    }

## Member Data Documentation

std::vector<std::string> FileReadTool::m_protocols`[private]`

Vector of supported protocols.

Definition at line 39 of file FileReadTool.h.

The documentation for this class was generated from the following files:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v22r4/GaudiSvc/src/VFSSvc/FileReadTool.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v22r4/GaudiSvc/src/VFSSvc/FileReadTool.cpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines