DD4hep - The AIDA detector description toolkit for high energy physics experiments
DD4hep  Rev:Unversioneddirectory
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UriReader.h
Go to the documentation of this file.
1 // $Id$
2 //==========================================================================
3 // AIDA Detector description implementation for LCD
4 //--------------------------------------------------------------------------
5 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
6 // All rights reserved.
7 //
8 // For the licensing terms see $DD4hepINSTALL/LICENSE.
9 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
10 //
11 // Author : M.Frank
12 //
13 //==========================================================================
14 #ifndef DD4HEP_XML_URIREADER_H
15 #define DD4HEP_XML_URIREADER_H
16 
17 // C/C++ include files
18 #include <string>
19 
21 namespace DD4hep {
22 
24  namespace XML {
25 
27 
36  class UriReader {
37  public:
38  struct UserContext {
41  virtual ~UserContext() {}
42  };
43  public:
45  UriReader() {}
47  virtual ~UriReader();
49  virtual UserContext* context() { return 0; }
51  virtual bool load(const std::string& system_id, std::string& data);
53  virtual bool load(const std::string& system_id, UserContext* context, std::string& data) = 0;
55  virtual void parserLoaded(const std::string& system_id);
57  virtual void parserLoaded(const std::string& system_id, UserContext* ctxt) = 0;
58  };
59 
61 
71  class UriContextReader : public UriReader {
72  protected:
77  public:
83  virtual ~UriContextReader();
85  virtual UserContext* context() { return m_context; }
87  virtual bool load(const std::string& system_id, std::string& data);
89  virtual bool load(const std::string& system_id, UserContext* context, std::string& data);
91  virtual void parserLoaded(const std::string& system_id);
93  virtual void parserLoaded(const std::string& system_id, UserContext* ctxt);
94  };
95 
96  } /* End namespace XML */
97 } /* End namespace DD4hep */
98 #endif /* DD4HEP_XML_URIREADER_H */
virtual UserContext * context()
Access to local context.
Definition: UriReader.h:49
UriReader()
Default constructor.
Definition: UriReader.h:45
virtual bool load(const std::string &system_id, std::string &data)
Resolve a given URI to a string containing the data.
Definition: UriReader.cpp:23
void copy(Alignment from, Alignment to)
Copy alignment object from source object.
Class supporting to read data given a URI.
Definition: UriReader.h:36
virtual UserContext * context()
Access to local context.
Definition: UriReader.h:85
Class supporting to read data given a URI.
Definition: UriReader.h:71
UriReader * m_reader
Pointer to true reader object.
Definition: UriReader.h:74
virtual void parserLoaded(const std::string &system_id)
Inform reader about a locally (e.g. by XercesC) handled source load.
Definition: UriReader.cpp:28
UserContext(const UserContext &)
Definition: UriReader.h:40
virtual ~UriReader()
Default destructor.
Definition: UriReader.cpp:19
UriReader::UserContext * m_context
Pointer to user context.
Definition: UriReader.h:76
virtual bool load(const std::string &system_id, std::string &data)
Resolve a given URI to a string containing the data.
Definition: UriReader.cpp:49
UriContextReader(UriReader *reader, UriReader::UserContext *ctxt)
Default initializing constructor.
Definition: UriReader.cpp:33
virtual void parserLoaded(const std::string &system_id)
Inform reader about a locally (e.g. by XercesC) handled source load.
Definition: UriReader.cpp:59
virtual ~UriContextReader()
Default destructor.
Definition: UriReader.cpp:45