All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
util::details::ArtHandleTracker< T, Event > Class Template Reference

Tracks art handle objects. More...

#include <ArtHandleTrackerManager.h>

Inheritance diagram for util::details::ArtHandleTracker< T, Event >:
util::ArtHandleTrackerInterface< Event >

Public Member Functions

 ArtHandleTracker (Event const &event, Handle handle)
 Constructor: records all the needed information. More...
 
Handle const & handle () const
 Returns the tracked handle. More...
 
art::Provenance const * provenance () const
 Returns the provenance information of the handle. More...
 
- Public Member Functions inherited from util::ArtHandleTrackerInterface< Event >
virtual ~ArtHandleTrackerInterface ()=default
 Virtual destructor (does nothing). More...
 
bool removeCachedProduct ()
 
std::any handlePtr () const
 Returns a container for a pointer to the managed handle. Caveat emptor. More...
 
std::string productClass () const
 Returns the name of the class of handled data product. More...
 
std::type_info const * productType () const
 Returns the name of the class of handled data product. More...
 
art::InputTag inputTag () const
 Returns the tag of handled data product. More...
 
bool hasSameDataProduct (util::ArtHandleTrackerInterface< Event > const &other) const
 Returns whether this and the other objects handle the same data product. More...
 

Private Member Functions

Virtual method implementation
virtual bool doRemoveCachedProduct () override
 Actually removes the cache. More...
 
virtual std::any doHandlePtr () const override
 Returns a pointer to the managed handle, wrapped in std::any. More...
 
virtual std::string doProductClass () const override
 Returns the name of the class pointed by the handle. More...
 
virtual std::type_info const * doProductType () const override
 Returns the C++ type of the handled data product. More...
 
virtual art::InputTag doInputTag () const override
 

Private Attributes

Event const * fEvent = nullptr
 
Handle fHandle
 

Additional Inherited Members

Detailed Description

template<typename T, typename Event>
class util::details::ArtHandleTracker< T, Event >

Tracks art handle objects.

Template Parameters
Handletype of handle being tracked
Note
Due to my limited expertise with metaprogramming (and/or for C++ limitations?) I need one tracker per data type. The util::ArtHandleTrackerManager class should mitigate the hassle deriving from this limitation.

Definition at line 650 of file ArtHandleTrackerManager.h.

Constructor & Destructor Documentation

template<typename T , typename Event >
util::details::ArtHandleTracker< T, Event >::ArtHandleTracker ( Event const &  event,
Handle  handle 
)
inline

Constructor: records all the needed information.

Definition at line 766 of file ArtHandleTrackerManager.h.

767  : fEvent(&event), fHandle(std::move(handle)) {}
Handle const & handle() const
Returns the tracked handle.

Member Function Documentation

template<typename T , typename Event >
virtual std::any util::details::ArtHandleTracker< T, Event >::doHandlePtr ( ) const
inlineoverrideprivatevirtual

Returns a pointer to the managed handle, wrapped in std::any.

Implements util::ArtHandleTrackerInterface< Event >.

Definition at line 744 of file ArtHandleTrackerManager.h.

745  { return { &handle() }; }
Handle const & handle() const
Returns the tracked handle.
template<typename T , typename Event >
virtual art::InputTag util::details::ArtHandleTracker< T, Event >::doInputTag ( ) const
inlineoverrideprivatevirtual

Returns the input tag of the handled data product. Deferred implementation of inputTag().

Implements util::ArtHandleTrackerInterface< Event >.

Definition at line 757 of file ArtHandleTrackerManager.h.

758  { return inputTagOf(fHandle); }
art::InputTag inputTagOf(Handle const &handle)
template<typename T , typename Event >
virtual std::string util::details::ArtHandleTracker< T, Event >::doProductClass ( ) const
inlineoverrideprivatevirtual

Returns the name of the class pointed by the handle.

Implements util::ArtHandleTrackerInterface< Event >.

Definition at line 748 of file ArtHandleTrackerManager.h.

749  { return productClassOf(fHandle); }
std::string productClassOf(Handle const &handle)
use candy
template<typename T , typename Event >
virtual std::type_info const* util::details::ArtHandleTracker< T, Event >::doProductType ( ) const
inlineoverrideprivatevirtual

Returns the C++ type of the handled data product.

Implements util::ArtHandleTrackerInterface< Event >.

Definition at line 752 of file ArtHandleTrackerManager.h.

static std::type_info const * productType()
Returns the C++ type of the handled data product.
template<typename T , typename Event >
virtual bool util::details::ArtHandleTracker< T, Event >::doRemoveCachedProduct ( )
inlineoverrideprivatevirtual

Actually removes the cache.

Implements util::ArtHandleTrackerInterface< Event >.

Definition at line 735 of file ArtHandleTrackerManager.h.

736  {
737  mf::LogDebug{ "ArtHandleTracker" } << "Removing cache for handle<"
738  << fHandle.provenance()->producedClassName()
739  << ">(" << fHandle.provenance()->inputTag().encode() << ").";
740  return fEvent->removeCachedProduct(fHandle);
741  }
template<typename T , typename Event >
Handle const& util::details::ArtHandleTracker< T, Event >::handle ( ) const
inline

Returns the tracked handle.

Definition at line 770 of file ArtHandleTrackerManager.h.

template<typename T , typename Event >
art::Provenance const* util::details::ArtHandleTracker< T, Event >::provenance ( ) const
inline

Returns the provenance information of the handle.

Definition at line 773 of file ArtHandleTrackerManager.h.

773 { return fHandle.provenance(); }

Member Data Documentation

template<typename T , typename Event >
Event const* util::details::ArtHandleTracker< T, Event >::fEvent = nullptr
private

Definition at line 726 of file ArtHandleTrackerManager.h.

template<typename T , typename Event >
Handle util::details::ArtHandleTracker< T, Event >::fHandle
private

Definition at line 728 of file ArtHandleTrackerManager.h.


The documentation for this class was generated from the following file: