/
githubmirror
/
cmssw
Обзор
Документация
Войти
/
githubmirror
/
cmssw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
FWCore/Framework/interface/CacheHandle.h
35 строк
753 B
W. David Dagenhart
Implement persistence for ProcessBlock products
09 июл 2021, 19:14
09 июл 2021, 19:14
b0972e1
Код
Авторство
О чём код?
#ifndef FWCore_Framework_CacheHandle_h #define FWCore_Framework_CacheHandle_h /** \class edm::CacheHandle \author W. David Dagenhart, created 25 March, 2021 */ #include "FWCore/Utilities/interface/Exception.h" namespace edm { template <typename T> class CacheHandle { public: CacheHandle() : data_(nullptr) {} CacheHandle(T const* data) : data_(data) {} T const* get() const { if (!isValid()) { throw cms::Exception("InvalidCache") << "CacheHandle is invalid"; } return data_; } T const* operator->() const { return get(); } T const& operator*() const { return *get(); } bool isValid() const { return data_ != nullptr; } private: T const* data_; }; } // namespace edm #endif