Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-17 09:11:15

0001 // Copyright 2025, Jefferson Science Associates, LLC.
0002 // Subject to the terms in the LICENSE file found in the top-level directory.
0003 // Created by Nathan Brei
0004 
0005 #pragma once
0006 
0007 #include <JANA/Services/JParameterManager.h>
0008 #include <JANA/JFactorySet.h>
0009 #include <JANA/JFactoryGenerator.h>
0010 #include <JANA/Services/JWiringService.h>
0011 
0012 
0013 namespace jana::components {
0014 
0015 template<class FactoryT>
0016 class JWiredFactoryGeneratorT : public JFactoryGenerator {
0017 
0018 public:
0019     explicit JWiredFactoryGeneratorT() = default;
0020 
0021     void GenerateFactories(JFactorySet *factory_set) override {
0022 
0023         auto wiring_svc = GetApplication()->template GetService<jana::services::JWiringService>();
0024         const auto& type_name = JTypeInfo::demangle<FactoryT>();
0025 
0026         for (const auto& prefix : wiring_svc->GetPrefixesForAddedInstances(GetPluginName(), type_name)) {
0027 
0028             FactoryT *factory = new FactoryT;
0029             factory->SetPluginName(GetPluginName());
0030             factory->SetTypeName(type_name);
0031             factory->SetPrefix(prefix);
0032             factory->Wire(GetApplication());
0033             factory_set->Add(factory);
0034         }
0035     }
0036 };
0037 
0038 } // namespace jana::components
0039 using jana::components::JWiredFactoryGeneratorT;