|
MarlinMT
0.1.0
|
BookStoreManager class. More...
#include <BookStoreManager.h>
Inherits marlinmt::Component.
Classes | |
| struct | ObjectNotFound |
| thrown when try to access not existing object. More... | |
Public Member Functions | |
| BookStoreManager () | |
| Constructor. More... | |
| BookStoreManager (const BookStoreManager &)=delete | |
| BookStoreManager & | operator= (const BookStoreManager &)=delete |
| BookStoreManager (BookStoreManager &&)=delete | |
| BookStoreManager & | operator= (BookStoreManager &&)=delete |
| void | writeToDisk () const |
| reads output File from global StoreOutputFile. More... | |
| void | initialize () override |
| Initialize the book store manager. More... | |
| template<typename HistT > | |
| book::Handle< book::Entry< HistT > > | bookHist (const std::filesystem::path &path, const std::string_view &name, const std::string_view &title, const std::array< const AxisConfig< typename HistT::Precision_t > *, HistT::Dimension > &axesconfig, const BookFlag_t &flags) |
| Book a histogram 1D, float type. More... | |
| void | addToWrite (const book::EntryKey &key) |
| add entry key to write list. More... | |
| void | removeFromWrite (const book::EntryKey &key) |
| remove entry key from write list. More... | |
| const book::EntryKey & | getKey (const std::filesystem::path &path, const std::string_view &name) const |
| receive key from Entry with given path and name. More... | |
| template<typename T > | |
| book::Handle< book::Entry< T > > | getObject (const book::EntryKey &key) const |
| access object managed by this store. More... | |
Public Member Functions inherited from marlinmt::Component | |
| Component ()=delete | |
| No default constructor. More... | |
| Component (const Component &)=delete | |
| No copy or assignement. More... | |
| Component & | operator= (const Component &)=delete |
| virtual | ~Component ()=default |
| Default destructor. More... | |
| Component (const std::string &type) | |
| Constructor with component type. More... | |
| const std::string & | type () const |
| Get the component name. More... | |
| const std::string & | name () const |
| Get the component name. More... | |
| void | setName (const std::string &n) |
| Set the component name. More... | |
| const std::string & | description () const |
| Get the component description. More... | |
| void | setDescription (const std::string &desc) |
| Set the component description. More... | |
| const Application & | application () const |
| Get the application in which the component is registered. More... | |
| Application & | application () |
| Get the application in which the component is registered. More... | |
| template<class T > | |
| Logging::StreamType | log () const |
| Log a message with specific log level. More... | |
| Logging::StreamType | debug () const |
| Shortcut for log<DEBUG>() More... | |
| Logging::StreamType | message () const |
| Shortcut for log<MESSAGE>() More... | |
| Logging::StreamType | warning () const |
| Shortcut for log<WARNING>() More... | |
| Logging::StreamType | error () const |
| Shortcut for log<ERROR>() More... | |
| void | setVerbosity (const std::string &level) |
| Set the verbosity level. More... | |
| const std::string & | verbosity () const |
| Get the verbosity level. More... | |
| bool | isInitialized () const |
| Whether the component has been initialized. More... | |
| void | setup (Application *app) |
| Setup the component. More... | |
| void | printParameters () const |
| Print the component parameters. More... | |
| template<class T > | |
| void | printParameters () const |
| Print the component parameters at specific verbosity. More... | |
| void | setParameters (const ConfigSection §ion, bool throwIfNotFound=false) |
| Set the parameters from the configuration section. More... | |
| void | getParameters (ConfigSection §ion, const std::set< std::string > &exclude={}) const |
| Get the parameters from configurable object and populate the config section with. More... | |
Public Member Functions inherited from marlinmt::Configurable | |
| Configurable ()=default | |
| virtual | ~Configurable ()=default |
| template<typename T > | |
| std::shared_ptr< ParameterImpl > | addParameter (EParameterType paramType, const std::string &name, const std::string &desc, std::shared_ptr< T > value) |
| Add a parameter. More... | |
| template<typename T > | |
| std::shared_ptr< ParameterImpl > | addParameter (EParameterType paramType, const std::string &name, const std::string &desc, std::shared_ptr< T > value, T defVal) |
| Add a parameter. More... | |
| template<typename T > | |
| T | parameter (const std::string &name) const |
| Get a parameter value. More... | |
| template<typename T > | |
| T | parameter (const std::string &name, const T &fallback) const |
| Get a parameter value. More... | |
| void | checkParameter (const std::string &name) const |
| Check if the parameter has been registered. More... | |
| bool | exists (const std::string &name) const |
| Return true if the parameter has been registered. More... | |
| bool | isSet (const std::string &name) const |
| Returns true if the parameter exists and is set, false otherwise. More... | |
| void | clear () |
| Remove all parameters. More... | |
| void | unset () |
| Unset all registered parameters. More... | |
| iterator | begin () |
| const_iterator | begin () const |
| iterator | end () |
| const_iterator | end () const |
Private Attributes | |
| book::BookStore | _bookStore {true} |
| The book store. More... | |
| std::set< book::EntryKey > | _entriesToWrite {} |
| List of entry keys for Entries which should be stored at end of lifetime. More... | |
| StringParameter | _outputFile {*this, "OutputFile", "The output file name for storage", "MarlinMT_"+details::convert<int>::to_string(::getpid())+".root"} |
| Output file name to store objects. More... | |
| StringParameter | _defaultMemLayout {*this, "DefaultMemoryLayout", "The memory layout for objects", "Default"} |
| Output file name to store objects. More... | |
| BookFlag_t | _defaultFlag { 0 } |
| default flag, used if flag == BookFlags::Default. More... | |
Additional Inherited Members | |
Public Types inherited from marlinmt::Component | |
| using | LoggerPtr = Logging::Logger |
Public Types inherited from marlinmt::Configurable | |
| using | ParameterMap = std::map< std::string, std::shared_ptr< ParameterImpl > > |
| using | iterator = ParameterMap::iterator |
| using | const_iterator = ParameterMap::const_iterator |
Protected Attributes inherited from marlinmt::Component | |
| std::string | _type {} |
| The component type. More... | |
| std::string | _name {} |
| The component name. More... | |
| std::string | _description {"No description"} |
| The component description. More... | |
| Application * | _application {nullptr} |
| The application in which the component has been registered. More... | |
| LoggerPtr | _logger {nullptr} |
| The logger instance. More... | |
| StringParameter | _verbosity { *this, "Verbosity", "The component verbosity level", "MESSAGE" } |
| The verbosity level of the logger (parameter) More... | |
Protected Attributes inherited from marlinmt::Configurable | |
| ParameterMap | _parameters {} |
| The parameter map. More... | |
BookStoreManager class.
Definition at line 21 of file BookStoreManager.h.
| marlinmt::BookStoreManager::BookStoreManager | ( | ) |
Constructor.
Definition at line 45 of file BookStoreManager.cc.
References marlinmt::Component::setName().
|
delete |
|
delete |
| void marlinmt::BookStoreManager::addToWrite | ( | const book::EntryKey & | key | ) |
add entry key to write list.
Definition at line 167 of file BookStoreManager.cc.
References _entriesToWrite.
Referenced by bookHist(), and marlinmt::ProcessorApi::Book::write().
| book::Handle< book::Entry< HistT > > marlinmt::BookStoreManager::bookHist | ( | const std::filesystem::path & | path, |
| const std::string_view & | name, | ||
| const std::string_view & | title, | ||
| const std::array< const AxisConfig< typename HistT::Precision_t > *, HistT::Dimension > & | axesconfig, | ||
| const BookFlag_t & | flags | ||
| ) |
Book a histogram 1D, float type.
| proc | the processor booking the histogram |
| path | the histogram entry path |
| name | the histogram name |
| title | the histogram title |
| axisconfig | the histogram X axis config |
| flags | the book flag policy. If equal BookFlags::Default select defaults depending on steering file. |
Definition at line 91 of file BookStoreManager.cc.
References _bookStore, _defaultFlag, marlinmt::Component::_logger, marlinmt::CmdLineParser::ParseResult::_nthreads, addToWrite(), marlinmt::Component::application(), marlinmt::book::BookStore::book(), marlinmt::Application::cmdLineParseResult(), marlinmt::book::Flag_t::contains(), marlinmt::book::Flags::Book::Default(), getKey(), MARLINMT_THROW, marlinmt::book::Masks::Book::MemoryLayout(), marlinmt::book::Flags::Book::MultiCopy(), marlinmt::book::Flags::Book::MultiShared(), marlinmt::details::nthreads(), marlinmt::book::Flags::Book::Single(), and marlinmt::book::Flags::Book::Store().
Referenced by marlinmt::ProcessorApi::Book::bookHist1D(), marlinmt::ProcessorApi::Book::bookHist1F(), marlinmt::ProcessorApi::Book::bookHist1I(), marlinmt::ProcessorApi::Book::bookHist2D(), marlinmt::ProcessorApi::Book::bookHist2F(), marlinmt::ProcessorApi::Book::bookHist2I(), marlinmt::ProcessorApi::Book::bookHist3D(), marlinmt::ProcessorApi::Book::bookHist3F(), and marlinmt::ProcessorApi::Book::bookHist3I().
| const book::EntryKey & marlinmt::BookStoreManager::getKey | ( | const std::filesystem::path & | path, |
| const std::string_view & | name | ||
| ) | const |
receive key from Entry with given path and name.
| path | absolute path of Object |
| name | of Object |
| ObjectNotFound | if path don't lead to Object. |
Definition at line 179 of file BookStoreManager.cc.
References _bookStore, marlinmt::book::BookStore::findFirst(), marlinmt::book::WeakEntry::key(), marlinmt::Component::setName(), and marlinmt::book::WeakEntry::valid().
Referenced by bookHist(), and marlinmt::getObject().
| book::Handle< book::Entry< T > > marlinmt::BookStoreManager::getObject | ( | const book::EntryKey & | key | ) | const |
access object managed by this store.
For internal usage.
| key | key for Entry to Object |
Definition at line 157 of file BookStoreManager.cc.
References _bookStore, marlinmt::book::BookStore::entry(), and marlinmt::book::EntryKey::type.
Referenced by marlinmt::getObject().
|
overridevirtual |
Initialize the book store manager.
Reimplemented from marlinmt::Component.
Definition at line 59 of file BookStoreManager.cc.
References _defaultFlag, _defaultMemLayout, marlinmt::Component::application(), marlinmt::Application::configuration(), marlinmt::ParameterBase< T >::get(), MARLINMT_THROW, marlinmt::book::Flags::Book::MultiCopy(), marlinmt::book::Flags::Book::MultiShared(), marlinmt::Configuration::section(), marlinmt::Component::setParameters(), marlinmt::book::Flags::Book::Single(), marlinmt::book::Flags::Book::Store(), and marlinmt::details::to_lower().
|
delete |
|
delete |
| void marlinmt::BookStoreManager::removeFromWrite | ( | const book::EntryKey & | key | ) |
remove entry key from write list.
Definition at line 173 of file BookStoreManager.cc.
References _entriesToWrite.
Referenced by marlinmt::ProcessorApi::Book::dontWrite().
| void marlinmt::BookStoreManager::writeToDisk | ( | ) | const |
reads output File from global StoreOutputFile.
if set to "" (empty) no output file will be generated.
Definition at line 52 of file BookStoreManager.cc.
References _bookStore, _entriesToWrite, _outputFile, marlinmt::ParameterBase< T >::get(), and marlinmt::book::BookStore::storeList().
|
private |
The book store.
Definition at line 106 of file BookStoreManager.h.
Referenced by bookHist(), getKey(), getObject(), and writeToDisk().
|
private |
default flag, used if flag == BookFlags::Default.
Default is shared, store. Change is steering file with: store::DefaultMemoryLayout and store::StoreByDefault.
Definition at line 115 of file BookStoreManager.h.
Referenced by bookHist(), and initialize().
|
private |
Output file name to store objects.
Definition at line 112 of file BookStoreManager.h.
Referenced by initialize().
|
private |
List of entry keys for Entries which should be stored at end of lifetime.
Definition at line 108 of file BookStoreManager.h.
Referenced by addToWrite(), removeFromWrite(), and writeToDisk().
|
private |
Output file name to store objects.
Definition at line 110 of file BookStoreManager.h.
Referenced by writeToDisk().