make FindMany and FindOne return art::Ptr for the found products
It would be useful for FindMany and FindOne to return the art::Ptr for the found objects so that associations can be built up from previous stored associations. For example, Clusters are associated with Hits and Tracks can be associated with Clusters. It would be great to then make the association of Tracks to the Hits using the Cluster to Hit association as an intermediary.
#3 Updated by Christopher Green over 8 years ago
- Status changed from Assigned to Feedback
After preliminary analysis, some decisions are required.
With the current implementation of the
FindMany query objects, there is information loss: what is stored are the pointers to the elements of the
B collections corresponding to the
A objects specified. If one wants to have
Ptr returned rather than
const pointer, we are constrained to save
Ptr in the query objects, an increase in in-memory footprint for the query objects by a factor 3.5 (1 pointer -> 2 pointers + 2 shorts + an unsigned long). In addition, if we do not cache the pointers for fast access then access to the pointers only will involve dereferencing a
Ptr (a litle slower) plus on-demand product resolution.
So, there several ways forward, each with its own tradeoffs:
- Query objects to store
Ptrsinternally and return bare pointers by dereferencing when requested, with on-demand resolution.
- As 1, but with forced
Ptrresolution at query object construction time.
- As 1 or 2, but with caching of bare pointers (x4.5 over current solution, vs x3.5 without caching).
- Retain the current, "lightweight" query objects and inaugurate two new classes conforming to 1, 2 or 3 above.