@@ -98,9 +98,9 @@ class CCDBManagerInstance
9898 // / query timestamp
9999 long getTimestamp () const { return mTimestamp ; }
100100
101- // / retrieve an object of type T from CCDB as stored under path and timestamp
101+ // / retrieve an object of type T from CCDB as stored under path and timestamp. Optional to get the headers
102102 template <typename T>
103- T* getForTimeStamp (std::string const & path, long timestamp);
103+ T* getForTimeStamp (std::string const & path, long timestamp, std::map<std::string, std::string>* headers = nullptr );
104104
105105 // / retrieve an object of type T from CCDB as stored under path and using the timestamp in the middle of the run
106106 template <typename T>
@@ -235,7 +235,7 @@ class CCDBManagerInstance
235235};
236236
237237template <typename T>
238- T* CCDBManagerInstance::getForTimeStamp (std::string const & path, long timestamp)
238+ T* CCDBManagerInstance::getForTimeStamp (std::string const & path, long timestamp, std::map<std::string, std::string>* headers )
239239{
240240 mHeaders .clear (); // we clear at the beginning; to allow to retrieve the header information in a subsequent call
241241 T* ptr = nullptr ;
@@ -262,6 +262,9 @@ T* CCDBManagerInstance::getForTimeStamp(std::string const& path, long timestamp)
262262 auto & cached = mCache [path];
263263 cached.queries ++;
264264 if ((!isOnline () && cached.isCacheValid (timestamp)) || (mCheckObjValidityEnabled && cached.isValid (timestamp))) {
265+ if (headers) {
266+ *headers = mHeaders ;
267+ }
265268 return reinterpret_cast <T*>(cached.noCleanupPtr ? cached.noCleanupPtr : cached.objPtr .get ());
266269 }
267270 ptr = mCCDBAccessor .retrieveFromTFileAny <T>(path, mMetaData , timestamp, &mHeaders , cached.uuid ,
@@ -321,6 +324,9 @@ T* CCDBManagerInstance::getForTimeStamp(std::string const& path, long timestamp)
321324 mFailures ++;
322325 }
323326 }
327+ if (headers) {
328+ *headers = mHeaders ; // Do a deep copy of the headers
329+ }
324330 auto end = std::chrono::system_clock::now ();
325331 mTimerMS += std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count ();
326332 return ptr;
0 commit comments