Belle II Software
development
StringHandler.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 <sstream>
13
14
namespace
Belle2
{
19
namespace
gearbox {
21
class
StringContext
:
public
InputContext
{
22
public
:
24
explicit
StringContext
(
const
std::string& data):
m_stream
(data) {};
26
virtual
int
readXmlData
(
char
* buffer,
int
buffsize)
override
27
{
28
m_stream
.read(buffer, buffsize);
29
return
m_stream
.gcount();
30
}
31
protected
:
33
std::istringstream
m_stream
;
34
};
35
42
class
StringHandler
:
public
InputHandler
{
43
public
:
45
explicit
StringHandler
(
const
std::string& uri):
InputHandler
(uri) {}
47
virtual
~StringHandler
() {}
49
virtual
InputContext
*
open
(
const
std::string& path)
override
;
50
};
51
}
53
}
Belle2::gearbox::InputContext
Class representing a resource context for gearbox.
Definition
InputHandler.h:25
Belle2::gearbox::InputHandler::InputHandler
InputHandler(const std::string &uri)
Constructor accepting the uri for the InputHandler.
Definition
InputHandler.h:63
Belle2::gearbox::StringContext::readXmlData
virtual int readXmlData(char *buffer, int buffsize) override
Return a block of the data.
Definition
StringHandler.h:26
Belle2::gearbox::StringContext::StringContext
StringContext(const std::string &data)
Take an XML fragment as parameter and create a context for it.
Definition
StringHandler.h:24
Belle2::gearbox::StringContext::m_stream
std::istringstream m_stream
Assigned data string.
Definition
StringHandler.h:33
Belle2::gearbox::StringHandler::open
virtual InputContext * open(const std::string &path) override
Create a new context, path will be ignored.
Definition
StringHandler.cc:17
Belle2::gearbox::StringHandler::StringHandler
StringHandler(const std::string &uri)
Create a new InputHandler which always returns uri as XML content.
Definition
StringHandler.h:45
Belle2::gearbox::StringHandler::~StringHandler
virtual ~StringHandler()
empty, virtual destructor
Definition
StringHandler.h:47
Belle2
Abstract base class for different kinds of events.
Definition
MillepedeAlgorithm.h:17
framework
gearbox
include
StringHandler.h
Generated on Mon Sep 1 2025 02:51:24 for Belle II Software by
1.13.2