Belle II Software
light-2406-ragdoll
FileHandler.h
1
/**************************************************************************
2
* basf2 (Belle II Analysis Software Framework) *
3
* Author: The Belle II Collaboration *
4
* *
5
* See git log for contributors and copyright holders. *
6
* This file is licensed under LGPL-3.0, see LICENSE.md. *
7
**************************************************************************/
8
9
#pragma once
10
11
#include <framework/gearbox/InputHandler.h>
12
#include <boost/iostreams/filtering_stream.hpp>
13
#include <boost/format.hpp>
14
15
namespace
Belle2
{
20
namespace
gearbox {
21
23
class
FileContext
:
public
InputContext
{
24
public
:
29
FileContext
(
const
std::string& filename,
bool
compressed);
31
virtual
int
readXmlData
(
char
* buffer,
int
buffsize)
override
32
{
33
m_stream
.read(buffer, buffsize);
34
return
m_stream
.gcount();
35
}
37
virtual
~FileContext
() {}
38
protected
:
40
boost::iostreams::filtering_istream
m_stream
;
41
};
42
67
class
FileHandler
:
public
InputHandler
{
68
public
:
73
explicit
FileHandler
(
const
std::string& uri);
75
virtual
~FileHandler
() {}
80
virtual
InputContext
*
open
(
const
std::string& path)
override
;
81
protected
:
83
std::string
m_path
;
85
boost::format
m_pathformat
;
87
bool
m_rundependence
{
false
};
88
};
89
}
//namespace gearbox
91
}
//namespace Belle2
Belle2::gearbox::FileContext
InputContext which serves the content of a plain file.
Definition:
FileHandler.h:23
Belle2::gearbox::FileContext::readXmlData
virtual int readXmlData(char *buffer, int buffsize) override
Return a block of the data.
Definition:
FileHandler.h:31
Belle2::gearbox::FileContext::m_stream
boost::iostreams::filtering_istream m_stream
stream to read data from
Definition:
FileHandler.h:40
Belle2::gearbox::FileContext::~FileContext
virtual ~FileContext()
Close the file.
Definition:
FileHandler.h:37
Belle2::gearbox::FileHandler
InputHandler which will read XML from plain files, optionally gzip compressed.
Definition:
FileHandler.h:67
Belle2::gearbox::FileHandler::~FileHandler
virtual ~FileHandler()
empty, virtual destructor
Definition:
FileHandler.h:75
Belle2::gearbox::FileHandler::m_path
std::string m_path
Search path to look for files.
Definition:
FileHandler.h:83
Belle2::gearbox::FileHandler::open
virtual InputContext * open(const std::string &path) override
create a new FileContext by searching the file system for a file named like path.
Definition:
FileHandler.cc:64
Belle2::gearbox::FileHandler::m_pathformat
boost::format m_pathformat
format object in case of run-dependent data path
Definition:
FileHandler.h:85
Belle2::gearbox::FileHandler::m_rundependence
bool m_rundependence
bool indicating whether the data path is run-dependent
Definition:
FileHandler.h:87
Belle2::gearbox::InputContext
Class representing a resource context for gearbox.
Definition:
InputHandler.h:25
Belle2::gearbox::InputHandler
Class to provide an InputContext for a given XML resource name.
Definition:
InputHandler.h:47
Belle2
Abstract base class for different kinds of events.
Definition:
ClusterUtils.h:24
framework
gearbox
include
FileHandler.h
Generated on Tue Jul 9 2024 23:28:31 for Belle II Software by
1.9.6