Belle II Software  release-05-02-19
InputHandler.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010-2011 Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Martin Ritter *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <string>
14 
15 namespace Belle2 {
20  namespace gearbox {
27  class InputContext {
28  public:
37  virtual int readXmlData(char* buffer, int buffsize) = 0;
39  virtual ~InputContext() {}
40  protected:
41  };
42 
49  class InputHandler {
50  public:
55  typedef InputHandler* Factory(const std::string& uri);
56 
65  explicit InputHandler(const std::string& uri): m_uri(uri) {};
66 
68  virtual ~InputHandler() {}
69 
78  virtual InputContext* open(const std::string& path) = 0;
79  protected:
81  std::string m_uri;
82  };
83  }
85 }
Belle2::gearbox::InputHandler::m_uri
std::string m_uri
URI for the InputHandler.
Definition: InputHandler.h:89
Belle2::gearbox::InputHandler::~InputHandler
virtual ~InputHandler()
empty, virtual destructor
Definition: InputHandler.h:76
Belle2::gearbox::InputHandler::Factory
InputHandler * Factory(const std::string &uri)
Factory function which takes a backend uri and returns an InputHandler instance.
Definition: InputHandler.h:63
Belle2::gearbox::InputContext::readXmlData
virtual int readXmlData(char *buffer, int buffsize)=0
Read a block of XML data into buffer, at most buffsize bytes and return the number of bytes read.
Belle2::gearbox::InputHandler::InputHandler
InputHandler(const std::string &uri)
Constructor accepting the uri for the InputHandler.
Definition: InputHandler.h:73
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::gearbox::InputContext::~InputContext
virtual ~InputContext()
Close the context.
Definition: InputHandler.h:47
Belle2::gearbox::InputHandler::open
virtual InputContext * open(const std::string &path)=0
Open an XML resource.