Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-31 09:15:13

0001 
0002 // Copyright 2020, Jefferson Science Associates, LLC.
0003 // Subject to the terms in the LICENSE file found in the top-level directory.
0004 
0005 #pragma once
0006 #include <string>
0007 
0008 #include <JANA/JEventSource.h>
0009 
0010 /// This is a base class for all event source generators. JANA implements
0011 /// event sources in a modular way so that new types of sources can be
0012 /// easily added. Typically, this just means different file formats, but
0013 /// can also be networked or shared memory sources.
0014 ///
0015 /// One may subclass the JEventSource class directly, but it is recommended
0016 /// to use the template class JEventSourceGeneratorT instead. That defines
0017 /// defaults for the required methods based on the JEventSource class
0018 /// the generator is for while still allowing to customization where
0019 /// needed. See the JEventSourceGeneratorT documentation for details.
0020 
0021 class JComponentManager;
0022 
0023 class JEventSourceGenerator {
0024     protected:
0025         friend JComponentManager;
0026         JApplication* mApplication{nullptr};
0027         std::string mPluginName;
0028         JEventLevel mLevel = JEventLevel::None;
0029 
0030     public:
0031         JEventSourceGenerator(JApplication* app=nullptr) : mApplication(app){}
0032         virtual ~JEventSourceGenerator(){}
0033 
0034         // Default versions of these are defined in JEventSourceGeneratorT.h
0035         virtual std::string GetType(void) const { return "Unknown";} ///< Return name of the source type this will generate
0036         virtual std::string GetDescription(void) const { return ""; } ///< Return description of the source type this will generate
0037         virtual JEventSource* MakeJEventSource(std::string source) = 0; ///< Create an instance of the source type this generates
0038         virtual double CheckOpenable(std::string source) = 0; ///< See JEventSourceGeneratorT for description
0039 
0040         JEventLevel GetLevel() { return mLevel; }
0041         void SetLevel(JEventLevel level) { mLevel = level; }
0042 
0043     protected:
0044 
0045         /// This is called by JEventSourceManager::AddJEventSourceGenerator which
0046         /// itself is called by JApplication::Add(JEventSourceGenerator*). There
0047         /// should be no need to call it from anywhere else.
0048         void SetJApplication(JApplication* app){ mApplication = app; }
0049 
0050         /// SetPluginName is called by JANA itself and should not be exposed to the user.
0051         void SetPluginName(std::string plugin_name) { mPluginName = plugin_name; };
0052 
0053         /// GetPluginName is called by JANA itself and should not be exposed to the user.
0054         std::string GetPluginName() const { return mPluginName; }
0055 };
0056 
0057