Belle II Software  release-08-01-10
InputHandler.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 <string>
12 
13 namespace Belle2 {
18  namespace gearbox {
25  class InputContext {
26  public:
35  virtual int readXmlData(char* buffer, int buffsize) = 0;
37  virtual ~InputContext() {}
38  protected:
39  };
40 
47  class InputHandler {
48  public:
53  typedef InputHandler* Factory(const std::string& uri);
54 
63  explicit InputHandler(const std::string& uri): m_uri(uri) {};
64 
66  virtual ~InputHandler() {}
67 
76  virtual InputContext* open(const std::string& path) = 0;
77  protected:
79  std::string m_uri;
80  };
81  }
83 }
Class representing a resource context for gearbox.
Definition: InputHandler.h:25
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.
virtual ~InputContext()
Close the context.
Definition: InputHandler.h:37
Class to provide an InputContext for a given XML resource name.
Definition: InputHandler.h:47
InputHandler(const std::string &uri)
Constructor accepting the uri for the InputHandler.
Definition: InputHandler.h:63
std::string m_uri
URI for the InputHandler.
Definition: InputHandler.h:79
InputHandler * Factory(const std::string &uri)
Factory function which takes a backend uri and returns an InputHandler instance.
Definition: InputHandler.h:53
virtual InputContext * open(const std::string &path)=0
Open an XML resource.
virtual ~InputHandler()
empty, virtual destructor
Definition: InputHandler.h:66
Abstract base class for different kinds of events.