Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:17:56

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 // Author     : M.Frank
0011 //
0012 //==========================================================================
0013 //
0014 // DDDB is a detector description convention developed by the LHCb experiment.
0015 // For further information concerning the DTD, please see:
0016 // http://lhcb-comp.web.cern.ch/lhcb-comp/Frameworks/DetDesc/Documents/lhcbDtd.pdf
0017 //
0018 //==========================================================================
0019 #ifndef DDDB_DDDBREADER_H
0020 #define DDDB_DDDBREADER_H
0021 
0022 // Framework includes
0023 #include "XML/UriReader.h"
0024 #include "DDDB/DDDBReaderContext.h"
0025 #include "DD4hep/ComponentProperties.h"
0026 
0027 /// C++ include files
0028 #include <set>
0029 
0030 /// Namespace for the AIDA detector description toolkit
0031 namespace dd4hep {
0032 
0033   /// Namespace of the DDDB conversion stuff
0034   namespace DDDB  {
0035 
0036     /// Class supporting the interface of the LHCb conditions database to dd4hep
0037     /**
0038      *
0039      *  \author   M.Frank
0040      *  \version  1.0
0041      *  \ingroup  DD4HEP_DDDB
0042      */
0043     class DDDBReader : public dd4hep::xml::UriReader,
0044                        public PropertyConfigurable
0045     {
0046     public:
0047       /// Standard constructor
0048       DDDBReader(const std::string& dir="");
0049       /// Default destructor
0050       virtual ~DDDBReader()  {}
0051       /// Set data directory
0052       void setDirectory(const std::string& dir)  { m_directory = dir;   }
0053       /// Access data directory
0054       const std::string& directory() const       { return m_directory;  }
0055       /// Set data match
0056       void setMatch(const std::string& dir)      { m_match = dir;       }
0057       /// Access data match
0058       const std::string& match() const           { return m_match;      }
0059       /// Access to local context
0060       virtual UserContext* context()   override;
0061 
0062       /// Process load request. Calls getObject at the end.            */
0063       /// Resolve a given URI to a string containing the data
0064       virtual bool load(const std::string& system_id, std::string& buffer)  override;
0065       /// Resolve a given URI to a string containing the data
0066       virtual bool load(const std::string& system_id, UserContext* ctxt, std::string& buffer)  override;
0067       /** If you have to modify intervals of validity, do it in here.
0068        *  Only this routine is called by EVERY parsing request
0069        */
0070       /// Inform reader about a locally (e.g. by XercesC) handled source load
0071       virtual void parserLoaded(const std::string& system_id)  override;
0072       /// Inform reader about a locally (e.g. by XercesC) handled source load
0073       virtual void parserLoaded(const std::string& system_id, UserContext* ctxt)  override;
0074 
0075       /** Main object reader routine                                   */
0076       /// Read raw XML object from the database / file
0077       virtual int getObject(const std::string& system_id, UserContext* ctxt, std::string& data) = 0;
0078 
0079 
0080       /** Helpers for selective parsing  */
0081       /// Add a blocked path entry
0082       virtual void blockPath(const std::string& path)  override;
0083       /// Check if a URI path is blocked
0084       virtual bool isBlocked(const std::string& path)  const  override;
0085       
0086     protected:
0087       /// File directory
0088       std::string       m_directory;
0089       /// URI match string to invoke entity resolution
0090       std::string       m_match;
0091       /// Blocked URI pathes
0092       std::set<std::string> m_blockedPathes;
0093       /// Reader context
0094       DDDBReaderContext m_context;
0095     };
0096     }    /* End namespace DDDB            */
0097   }      /* End namespace dd4hep          */
0098 #endif // DDDB_DDDBREADER_H