![]() |
ATLAS Offline Software
|
A class that manages a list of Sample objects. More...
#include <SampleHandler.h>
Classes | |
| struct | SamplePtrToRawSample |
| functor mapping a shared_ptr<Sample> to the raw Sample* it points to. More... | |
Public Types | |
| typedef boost::transform_iterator< SamplePtrToRawSample, std::vector< std::shared_ptr< Sample > >::const_iterator > | iterator |
| the iterator to use | |
Public Member Functions | |
| void | testInvariant () const |
| test the invariant of this object | |
| SampleHandler () | |
| standard constructor | |
| SampleHandler (const SampleHandler &that) | |
| standard copy constructor | |
| ~SampleHandler () | |
| standard destructor | |
| SampleHandler & | operator= (const SampleHandler &that) |
| standard assignment operator | |
| void | add (const Sample &sample) |
| add a copy of the sample to the handler | |
| void | add (std::shared_ptr< Sample > sample) |
| add a sample to the handler | |
| void | add (const SampleHandler &sh) |
| add all samples from the given SampleHandler to this one | |
| void | addWithPrefix (const SampleHandler &sh, const std::string &prefix) |
| add all samples from the given SampleHandler to this one, with prefix prepended to their name | |
| void | remove (const std::string &name) |
| remove the given sample | |
| void | remove (const Sample *sample) |
| remove the given sample | |
| Sample * | get (const std::string &name) |
| get the sample with the given name | |
| const Sample * | get (const std::string &name) const |
| get the sample with the given name | |
| SampleHandler | find (const TagList &tags) const |
| find all samples which have at least one of the given tags. | |
| SampleHandler | find (const std::string &tags) const |
| find all samples which have at least one of the given tags. | |
| Sample * | findBySource (const std::string &name) const |
| find a sample by the name in the source sample handler | |
| SampleHandler | findByName (const std::string &pattern) const |
| find samples by pattern on the name | |
| void | print () const |
| print the debugging output to the screen | |
| void | printContent () const |
| print the debugging output to the screen | |
| void | save (const std::string &directory) const |
| save the list of samples to the given directory | |
| void | load (const std::string &directory) |
| load all the samples from the given directory | |
| void | updateLocation (const std::string &from, const std::string &to) |
| update all file references starting with from to to | |
| void | fetch (const SampleHandler &source) |
| fetch the meta-data for all samples that are also in the source sample handler. | |
| void | fetchDefaults (const SampleHandler &source) |
| fetch the meta-data for all that samples that don't have it in this sample. | |
| bool | check_complete (const SampleHandler &source) const |
| whether we have all samples from the source SampleHandler. | |
| void | setMetaDouble (const std::string &name, double value) |
| set the meta-data double with the given name for all samples. | |
| void | setMetaString (const std::string &name, const std::string &value) |
| set the meta-data string with the given name for all samples. | |
| void | setMetaDouble (const std::string &pattern, const std::string &name, double value) |
| set the meta-data double with the given name for samples matching a pattern. | |
| void | setMetaString (const std::string &pattern, const std::string &name, const std::string &value) |
| set the meta-data double with the given name for samples matching a pattern. | |
| iterator | begin () const |
| the begin iterator to use | |
| iterator | end () const |
| the end iterator to use | |
| std::size_t | size () const |
| the number of samples contained | |
| Sample * | operator[] (std::size_t index) const |
| the sample with the given index | |
| Sample * | at (std::size_t index) const |
| the sample with the given index | |
| std::span< std::shared_ptr< Sample > > | samples () |
| the samples accessed via smart pointer | |
Private Attributes | |
| std::vector< std::shared_ptr< Sample > > | m_samples |
| the list of samples managed | |
| std::map< std::string, std::shared_ptr< Sample > > | m_named |
| the list of samples by name | |
Friends | |
| void | swap (SampleHandler &a, SampleHandler &b) |
Related Symbols | |
(Note that these are not member symbols.) | |
| std::string | dbg (const SampleHandler &obj, unsigned verbosity=0) |
| the debugging info of this object | |
| void | swap (SampleHandler &a, SampleHandler &b) |
| standard swap | |
A class that manages a list of Sample objects.
This class is typically used either to hold a list of all samples known to the analyzer or to hold a list of samples produced by a search operation on another SampleHandler. It is also extensively used to manage the inputs and outputs of EventLoop.
Definition at line 52 of file SampleHandler.h.
| typedef boost::transform_iterator< SamplePtrToRawSample, std::vector<std::shared_ptr<Sample> >::const_iterator> SH::SampleHandler::iterator |
the iterator to use
Definition at line 457 of file SampleHandler.h.
| SH::SampleHandler::SampleHandler | ( | ) |
standard constructor
| SH::SampleHandler::SampleHandler | ( | const SampleHandler & | that | ) |
standard copy constructor
| SH::SampleHandler::~SampleHandler | ( | ) |
standard destructor
add a copy of the sample to the handler
| void SH::SampleHandler::add | ( | const SampleHandler & | sh | ) |
add all samples from the given SampleHandler to this one
| void SH::SampleHandler::add | ( | std::shared_ptr< Sample > | sample | ) |
add a sample to the handler
| void SH::SampleHandler::addWithPrefix | ( | const SampleHandler & | sh, |
| const std::string & | prefix ) |
add all samples from the given SampleHandler to this one, with prefix prepended to their name
| Sample * SH::SampleHandler::at | ( | std::size_t | index | ) | const |
| iterator SH::SampleHandler::begin | ( | ) | const |
the begin iterator to use
| bool SH::SampleHandler::check_complete | ( | const SampleHandler & | source | ) | const |
whether we have all samples from the source SampleHandler.
samples are identified by name in the source. the name is either taken from the meta-data field "nc_source" or (if not available) by the name of the sample.
| source | the source SampleHandler |
| iterator SH::SampleHandler::end | ( | ) | const |
the end iterator to use
| void SH::SampleHandler::fetch | ( | const SampleHandler & | source | ) |
fetch the meta-data for all samples that are also in the source sample handler.
samples are identified by name in the source. the name is either taken from the meta-data field "nc_source" or (if not available) by the name of the sample. fields that have a name that starts with "nc_" are not copied.
| void SH::SampleHandler::fetchDefaults | ( | const SampleHandler & | source | ) |
fetch the meta-data for all that samples that don't have it in this sample.
this ignores any meta-data without name and any samples not present in source.
| SampleHandler SH::SampleHandler::find | ( | const std::string & | tags | ) | const |
find all samples which have at least one of the given tags.
this version uses a comma separated tag list instead of a TagList object.
| SampleHandler SH::SampleHandler::find | ( | const TagList & | tags | ) | const |
find all samples which have at least one of the given tags.
| SampleHandler SH::SampleHandler::findByName | ( | const std::string & | pattern | ) | const |
find samples by pattern on the name
| pattern | the regular expression that's matched against the name |
find a sample by the name in the source sample handler
this means it needs to match the content of the meta-data field "nc_source" or if that is not present by its own name.
get the sample with the given name
get the sample with the given name
| void SH::SampleHandler::load | ( | const std::string & | directory | ) |
load all the samples from the given directory
| SampleHandler & SH::SampleHandler::operator= | ( | const SampleHandler & | that | ) |
standard assignment operator
| Sample * SH::SampleHandler::operator[] | ( | std::size_t | index | ) | const |
| void SH::SampleHandler::print | ( | ) | const |
print the debugging output to the screen
| void SH::SampleHandler::printContent | ( | ) | const |
print the debugging output to the screen
remove the given sample
| void SH::SampleHandler::remove | ( | const std::string & | name | ) |
| std::span< std::shared_ptr< Sample > > SH::SampleHandler::samples | ( | ) |
the samples accessed via smart pointer
| void SH::SampleHandler::save | ( | const std::string & | directory | ) | const |
save the list of samples to the given directory
| void SH::SampleHandler::setMetaDouble | ( | const std::string & | name, |
| double | value ) |
set the meta-data double with the given name for all samples.
| name | the name of the meta-data |
| value | the value to which it is set |
| void SH::SampleHandler::setMetaDouble | ( | const std::string & | pattern, |
| const std::string & | name, | ||
| double | value ) |
set the meta-data double with the given name for samples matching a pattern.
| pattern | the regular expression against which the sample name is matched |
| name | the name of the meta-data |
| value | the value to which it is set |
set the meta-data string with the given name for all samples.
| name | the name of the meta-data |
| value | the value to which it is set |
| void SH::SampleHandler::setMetaString | ( | const std::string & | pattern, |
| const std::string & | name, | ||
| const std::string & | value ) |
set the meta-data double with the given name for samples matching a pattern.
| pattern | the regular expression against which the sample name is matched |
| name | the name of the meta-data |
| value | the value to which it is set |
| std::size_t SH::SampleHandler::size | ( | ) | const |
the number of samples contained
| void SH::SampleHandler::testInvariant | ( | ) | const |
test the invariant of this object
update all file references starting with from to to
| from | the original path to the data area |
| to | the new path to the data area |
|
the debugging info of this object
| obj | the object to be presented |
| verbosity | the level of verbosity (higher number -> more information) |
|
friend |
|
standard swap
|
private |
the list of samples by name
Definition at line 520 of file SampleHandler.h.
|
private |
the list of samples managed
Definition at line 516 of file SampleHandler.h.