Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:01:41

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     public:
0025 
0026         friend JComponentManager;
0027 
0028         JEventSourceGenerator(JApplication *app=nullptr):mApplication(app){}
0029         virtual ~JEventSourceGenerator(){}
0030 
0031         // Default versions of these are defined in JEventSourceGeneratorT.h
0032         virtual std::string GetType(void) const { return "Unknown";} ///< Return name of the source type this will generate
0033         virtual std::string GetDescription(void) const { return ""; } ///< Return description of the source type this will generate
0034         virtual JEventSource* MakeJEventSource( std::string source ) = 0; ///< Create an instance of the source type this generates
0035         virtual double CheckOpenable( std::string source ) = 0; ///< See JEventSourceGeneratorT for description
0036 
0037 
0038     protected:
0039 
0040         /// This is called by JEventSourceManager::AddJEventSourceGenerator which
0041         /// itself is called by JApplication::Add(JEventSourceGenerator*). There
0042         /// should be no need to call it from anywhere else.
0043         void SetJApplication(JApplication *app){ mApplication = app; }
0044 
0045         /// SetPluginName is called by JANA itself and should not be exposed to the user.
0046         void SetPluginName(std::string plugin_name) { mPluginName = plugin_name; };
0047 
0048         /// GetPluginName is called by JANA itself and should not be exposed to the user.
0049         std::string GetPluginName() const { return mPluginName; }
0050 
0051         JEventLevel GetLevel() { return mLevel; }
0052         void SetLevel(JEventLevel level) { mLevel = level; }
0053 
0054         JApplication* mApplication{nullptr};
0055         std::string mPluginName;
0056         JEventLevel mLevel = JEventLevel::None;
0057 };
0058 
0059