Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Copyright 2024, Jefferson Science Associates, LLC.
0002 // Subject to the terms in the LICENSE file found in the top-level directory.
0003 
0004 #pragma once
0005 
0006 #include <JANA/Components/JDatabundle.h>
0007 #include <podio/CollectionBase.h>
0008 #include <podio/podioVersion.h>
0009 
0010 
0011 class JPodioDatabundle : public JDatabundle {
0012 
0013 private:
0014     const podio::CollectionBase* m_collection = nullptr;
0015 
0016 public:
0017     size_t GetSize() const override {
0018         if (m_collection == nullptr) {
0019             return 0;
0020         }
0021         return m_collection->size();
0022     }
0023 
0024     virtual void ClearData() override {
0025         m_collection = nullptr;
0026         SetStatus(JDatabundle::Status::Empty);
0027         // Podio clears the data itself when the frame is destroyed.
0028         // Until then, the collection is immutable.
0029         //
0030         // Consider: Instead of putting the frame in its own JFactory, maybe we 
0031         // want to maintain a shared_ptr to the frame here, and delete the
0032         // the reference on ClearData(). Thus, the final call to ClearData()
0033         // for each event deletes the frame and actually frees the data.
0034         // This would let us support multiple frames within one event, though
0035         // it might also prevent the user from accessing frames directly.
0036     }
0037 
0038     const podio::CollectionBase* GetCollection() const { return m_collection; }
0039     void SetCollection(const podio::CollectionBase* collection) { m_collection = collection; }
0040 };
0041 
0042