Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-01 08:58:10

0001 #pragma once
0002 #include "JANA/Components/JDatabundle.h"
0003 #include <JANA/Components/JHasDatabundleOutputs.h>
0004 #include <JANA/Components/JLightweightDatabundle.h>
0005 #include <JANA/Utils/JTypeInfo.h>
0006 
0007 namespace jana::components {
0008 
0009 template <typename T>
0010 class Output : public JHasDatabundleOutputs::OutputBase {
0011     std::vector<T*> m_data;
0012     JLightweightDatabundleT<T>* m_databundle; // Just so that we have a typed reference
0013 
0014 public:
0015     Output(JHasDatabundleOutputs* owner, std::string short_name="") {
0016         owner->RegisterOutput(this);
0017         this->type_name = JTypeInfo::demangle<T>();
0018         m_databundle = new JLightweightDatabundleT<T>();
0019         m_databundle->SetTypeName(this->type_name);
0020         std::string unique_name = short_name.empty() ? this->type_name : this->type_name + ":" + short_name;
0021         this->databundle_names.push_back(unique_name);
0022         m_databundle->SetShortName(short_name);
0023         this->databundles.push_back(m_databundle);
0024         // Factory will be set by JFactorySet, not here
0025     }
0026 
0027     void SetShortName(std::string short_name) {
0028         this->databundle_names.clear();
0029         auto unique_name = type_name + ":" + short_name;
0030         this->databundle_names.push_back(unique_name);
0031         m_databundle->SetShortName(short_name);
0032     }
0033 
0034     void SetUniqueName(std::string unique_name) {
0035         this->databundle_names.clear();
0036         this->databundle_names.push_back(unique_name);
0037         m_databundle->SetUniqueName(unique_name);
0038     }
0039 
0040     std::vector<T*>& operator()() { return m_data; }
0041 
0042     JLightweightDatabundleT<T>& GetDatabundle() { return *m_databundle; }
0043 
0044 
0045     void StoreData(const JFactorySet&) override {
0046     //    event.Insert(m_data, this->collection_names[0]);
0047     }
0048 
0049     void Reset() override { }
0050 };
0051 
0052 } // jana::components