![]() |
ATLAS Offline Software
|
Base class for Trigger configuration data and wrapper around underlying representation. More...
#include <DataStructure.h>
Inherited by TrigConf::Chain, TrigConf::HLTMenu, TrigConf::HLTMonitoring, TrigConf::HLTPrescalesSet, TrigConf::L1Board, TrigConf::L1BunchGroup, TrigConf::L1BunchGroupSet, TrigConf::L1CTP, TrigConf::L1Connector, TrigConf::L1Item, TrigConf::L1Menu, TrigConf::L1PrescalesSet, TrigConf::L1ThrExtraInfoBase, TrigConf::L1Threshold, TrigConf::L1TopoAlgorithm, and TrigConf::L1TopoOutput.
Public Types | |
| using | ptree = boost::property_tree::ptree |
Public Member Functions | |
| DataStructure () | |
| Default constructor, leading to an uninitialized configuration object. | |
| DataStructure (const DataStructure &)=default | |
| DataStructure (DataStructure &&)=default | |
| DataStructure & | operator= (const DataStructure &)=default |
| DataStructure & | operator= (DataStructure &&)=default |
| DataStructure (const ptree &data) | |
| Constructor initialized with configuration data. | |
| DataStructure (const std::string &name, const ptree &data) | |
| DataStructure (ptree &&data) | |
| DataStructure (const std::string &name, ptree &&data) | |
| virtual | ~DataStructure ()=default |
| Destructor. | |
| void | setData (const ptree &data) |
| Setting the configuration data. | |
| void | setData (ptree &&data) |
| void | setName (const std::string &n) |
| Setting the configuration element name. | |
| virtual std::string | className () const |
| A string that is the name of the class. | |
| virtual const std::string & | name () const final |
| virtual void | clear () |
| Clearing the configuration data. | |
| const ptree & | data () const |
| Access to the underlying data, if needed. | |
| bool | isValue () const |
| Check for attribute. | |
| std::string | getValue () const |
| Access to simple content. | |
| template<class T> | |
| T | getValue () const |
| template<class T> | |
| std::optional< T > | getValue_optional () const |
access to content of the note Will return false if the value could not be converted into T | |
| bool | hasAttribute (const std::string &key) const |
| Check for attribute. | |
| bool | isNull (const std::string &key) const |
| Check if an attribute is null. | |
| bool | hasChild (const std::string &path) const |
| Check if child exists. | |
| std::string | operator[] (const std::string &key) const |
| Access to simple attribute. | |
| template<class T> | |
| T | getAttribute (const std::string &key, bool ignoreIfMissing=false, const T &def=T()) const |
| Access to simple attribute. | |
| template<class T> | |
| std::optional< T > | getAttribute_optional (const std::string &key) const |
| const std::string & | getAttribute (const std::string &key, bool ignoreIfMissing=false, const std::string &def="") const |
| std::vector< DataStructure > | getList (const std::string &pathToChild, bool ignoreIfMissing=false) const |
| Access to array structure. | |
| std::optional< std::vector< DataStructure > > | getList_optional (const std::string &pathToChild) const |
| DataStructure | getObject (const std::string &pathToChild, bool ignoreIfMissing=false) const |
| Access to configuration object. | |
| std::optional< TrigConf::DataStructure > | getObject_optional (const std::string &pathToChild) const |
| std::vector< std::string > | getKeys () const |
| Access to the keys of an DataStructure which presents a dictionary. | |
| operator bool () const | |
| Access to initialized state. | |
| bool | isValid () const |
| bool | isInitialized () const |
| bool | empty () const |
| Check if children exist. | |
| void | printRaw (std::ostream &os=std::cout) const |
| virtual void | print (std::ostream &os=std::cout) const |
| bool | ownsData () const |
Static Public Member Functions | |
| static void | printElement (const std::string &key, const ptree &data, uint level=0, std::ostream &os=std::cout) |
Static function to print a ptree object. | |
Protected Member Functions | |
| virtual void | update () |
| Update the internal data after modification of the data object. | |
Protected Attributes | |
| bool | m_initialized { false } |
| if initialized, the underlying ptree is has been assigned to (can be empty) | |
| std::shared_ptr< ptree > | m_dataSPtr { nullptr } |
| const ptree * | m_dataPtr { nullptr } |
| std::string | m_name {""} |
Base class for Trigger configuration data and wrapper around underlying representation.
Triggger configuration description data uses json format which can be represented as boost::ptree (or other formats if ATLAS decides to support those)
The class acts as layer to shield the clients of the trigger configuration from the concrete representation of the transient configuration data
Configuration data is typically recursive, meaning that sub-configurations can also be expressed as DataStructure objects. Therefore this class also is base class to all other classes describing parts of the trigger configuration in this package
Detailed information can be found under https://twiki.cern.ch/twiki/bin/view/Atlas/TriggerConfigurationAccess
Definition at line 37 of file DataStructure.h.
| using TrigConf::DataStructure::ptree = boost::property_tree::ptree |
Definition at line 40 of file DataStructure.h.
| TrigConf::DataStructure::DataStructure | ( | ) |
Default constructor, leading to an uninitialized configuration object.
Definition at line 11 of file DataStructure.cxx.
|
default |
|
default |
Constructor initialized with configuration data.
| data | Reference to the data container |
Definition at line 15 of file DataStructure.cxx.
Definition at line 19 of file DataStructure.cxx.
| TrigConf::DataStructure::DataStructure | ( | ptree && | data | ) |
Definition at line 26 of file DataStructure.cxx.
Definition at line 31 of file DataStructure.cxx.
|
virtualdefault |
Destructor.
|
virtual |
A string that is the name of the class.
Reimplemented in L1BunchGroupSet, TrigConf::Chain, TrigConf::HLTMenu, TrigConf::HLTMonitoring, TrigConf::HLTPrescalesSet, TrigConf::L1Board, TrigConf::L1BunchGroup, TrigConf::L1BunchGroupSet, TrigConf::L1Connector, TrigConf::L1Item, TrigConf::L1Menu, TrigConf::L1PrescalesSet, TrigConf::L1Threshold, TrigConf::L1Threshold_cTAU, TrigConf::L1Threshold_eEM, TrigConf::L1Threshold_EM, TrigConf::L1Threshold_eTAU, TrigConf::L1Threshold_gJ, TrigConf::L1Threshold_gLJ, TrigConf::L1Threshold_gTE, TrigConf::L1Threshold_gXE, TrigConf::L1Threshold_internal, TrigConf::L1Threshold_jEM, TrigConf::L1Threshold_JET, TrigConf::L1Threshold_jJ, TrigConf::L1Threshold_jLJ, TrigConf::L1Threshold_jTAU, TrigConf::L1Threshold_jTE, TrigConf::L1Threshold_jXE, TrigConf::L1Threshold_MU, TrigConf::L1Threshold_NIM, TrigConf::L1Threshold_TAU, TrigConf::L1Threshold_TE, TrigConf::L1Threshold_XE, TrigConf::L1Threshold_XS, TrigConf::L1Threshold_ZB, TrigConf::L1Threshold_ZBTopo, TrigConf::L1ThrExtraInfo_cTAU, TrigConf::L1ThrExtraInfo_cXE, TrigConf::L1ThrExtraInfo_eEM, TrigConf::L1ThrExtraInfo_EMTAULegacy, TrigConf::L1ThrExtraInfo_eTAU, TrigConf::L1ThrExtraInfo_gJ, TrigConf::L1ThrExtraInfo_gLJ, TrigConf::L1ThrExtraInfo_gTE, TrigConf::L1ThrExtraInfo_gXE, TrigConf::L1ThrExtraInfo_jEM, TrigConf::L1ThrExtraInfo_JETLegacy, TrigConf::L1ThrExtraInfo_jJ, TrigConf::L1ThrExtraInfo_jLJ, TrigConf::L1ThrExtraInfo_jTAU, TrigConf::L1ThrExtraInfo_jTE, TrigConf::L1ThrExtraInfo_jXE, TrigConf::L1ThrExtraInfo_MU, TrigConf::L1ThrExtraInfo_XSLegacy, TrigConf::L1ThrExtraInfoBase, TrigConf::L1TopoAlgorithm, and TrigConf::L1TopoOutput.
Definition at line 103 of file DataStructure.cxx.
|
virtual |
Clearing the configuration data.
should be overloaded by derived object that have to clear data
leads to an uninitialized object
Reimplemented in L1BunchGroupSet, TrigConf::HLTMenu, TrigConf::HLTMonitoring, TrigConf::HLTPrescalesSet, TrigConf::L1BunchGroupSet, TrigConf::L1CTP, TrigConf::L1Menu, and TrigConf::L1PrescalesSet.
Definition at line 65 of file DataStructure.cxx.
Access to the underlying data, if needed.
Definition at line 83 of file DataStructure.h.
|
inline |
| const std::string & TrigConf::DataStructure::getAttribute | ( | const std::string & | key, |
| bool | ignoreIfMissing = false, | ||
| const std::string & | def = "" ) const |
Definition at line 135 of file DataStructure.cxx.
|
inline |
Access to simple attribute.
| key | The path to the attribute name, relative to the current one in form "path.to.child" |
| ignoreIfMissing | Controls the behavior in case of missing configuration child |
Definition at line 152 of file DataStructure.h.
|
inline |
Definition at line 165 of file DataStructure.h.
| std::vector< std::string > TrigConf::DataStructure::getKeys | ( | ) | const |
Access to the keys of an DataStructure which presents a dictionary.
In case the DataStructure is a list or a simple attribute, an empty vector is returned
Definition at line 249 of file DataStructure.cxx.
| std::vector< TrigConf::DataStructure > TrigConf::DataStructure::getList | ( | const std::string & | pathToChild, |
| bool | ignoreIfMissing = false ) const |
Access to array structure.
| pathToChild | The path to the configuration child, relative to the current one in form "path.to.child" |
| ignoreIfMissing | Controls the behavior in case of missing configuration child |
In case the child is missing and ignoreIfMissing is set to true, and empty vector will be returned. Otherwise a runtime exception will be thrown.
Definition at line 157 of file DataStructure.cxx.
| std::optional< std::vector< TrigConf::DataStructure > > TrigConf::DataStructure::getList_optional | ( | const std::string & | pathToChild | ) | const |
Definition at line 196 of file DataStructure.cxx.
| TrigConf::DataStructure TrigConf::DataStructure::getObject | ( | const std::string & | pathToChild, |
| bool | ignoreIfMissing = false ) const |
Access to configuration object.
| pathToChild | The path to the configuration child, relative to the current one |
| ignoreIfMissing | Controls the behavior in case of missing configuration child |
In case the child is missing and ignoreIfMissing is set to true, an uninitialized DataStructure will be returned. Otherwise a runtime exception will be thrown.
Definition at line 206 of file DataStructure.cxx.
| std::optional< TrigConf::DataStructure > TrigConf::DataStructure::getObject_optional | ( | const std::string & | pathToChild | ) | const |
Definition at line 229 of file DataStructure.cxx.
|
inline |
Definition at line 108 of file DataStructure.h.
| std::string TrigConf::DataStructure::getValue | ( | ) | const |
Access to simple content.
For instance when the json structure contains an array of values (ptree only works with strings) which one retrieved via getList, then the values in the vector<DataStructure> can be accessed using getValue
Definition at line 80 of file DataStructure.cxx.
|
inline |
| bool TrigConf::DataStructure::hasAttribute | ( | const std::string & | key | ) | const |
Check for attribute.
| key | The path to the attribute name, relative to the current one in form "path.to.child" |
key exists and is an attribute Definition at line 85 of file DataStructure.cxx.
| bool TrigConf::DataStructure::hasChild | ( | const std::string & | path | ) | const |
Check if child exists.
| path | The path to the child, relative to the current one in form "path.to.child" |
Definition at line 113 of file DataStructure.cxx.
|
inline |
Definition at line 216 of file DataStructure.h.
| bool TrigConf::DataStructure::isNull | ( | const std::string & | key | ) | const |
Check if an attribute is null.
| key | The path to the attribute name, relative to the current one in form "path.to.child" |
key exists and is nullIf the attribute doesn't exist, the function returns false. To check if an attribute exists and is null, use it together with hasAttribute.
Definition at line 93 of file DataStructure.cxx.
|
inline |
Definition at line 215 of file DataStructure.h.
| bool TrigConf::DataStructure::isValue | ( | ) | const |
Check for attribute.
Definition at line 74 of file DataStructure.cxx.
|
finalvirtual |
Definition at line 108 of file DataStructure.cxx.
|
inlineexplicit |
|
default |
|
default |
| std::string TrigConf::DataStructure::operator[] | ( | const std::string & | key | ) | const |
Access to simple attribute.
| key | The path to the attribute name, relative to the current one in form "path.to.child" |
Definition at line 120 of file DataStructure.cxx.
|
inline |
Definition at line 242 of file DataStructure.h.
|
virtual |
Reimplemented in TrigConf::L1Threshold_EM, and TrigConf::L1TopoAlgorithm.
Definition at line 271 of file DataStructure.cxx.
|
static |
Static function to print a ptree object.
| key | The key of this data as found in the parent structure |
| data | The ptree to print |
| level | The substruture level used to indent the output |
| os | The output stream |
Definition at line 278 of file DataStructure.cxx.
| void TrigConf::DataStructure::printRaw | ( | std::ostream & | os = std::cout | ) | const |
Definition at line 264 of file DataStructure.cxx.
Setting the configuration data.
Definition at line 39 of file DataStructure.cxx.
| void TrigConf::DataStructure::setData | ( | ptree && | data | ) |
Definition at line 50 of file DataStructure.cxx.
| void TrigConf::DataStructure::setName | ( | const std::string & | n | ) |
Setting the configuration element name.
Definition at line 59 of file DataStructure.cxx.
|
inlineprotectedvirtual |
Update the internal data after modification of the data object.
to be implemented by the derived class
Reimplemented in L1BunchGroupSet, TrigConf::Chain, TrigConf::HLTMenu, TrigConf::HLTMonitoring, TrigConf::HLTPrescalesSet, TrigConf::L1Board, TrigConf::L1BunchGroup, TrigConf::L1BunchGroupSet, TrigConf::L1Connector, TrigConf::L1CTP, TrigConf::L1Item, TrigConf::L1Menu, TrigConf::L1PrescalesSet, TrigConf::L1Threshold, TrigConf::L1Threshold_Calo, TrigConf::L1Threshold_cTAU, TrigConf::L1Threshold_eEM, TrigConf::L1Threshold_EM, TrigConf::L1Threshold_eTAU, TrigConf::L1Threshold_gJ, TrigConf::L1Threshold_gLJ, TrigConf::L1Threshold_gTE, TrigConf::L1Threshold_gXE, TrigConf::L1Threshold_jEM, TrigConf::L1Threshold_JET, TrigConf::L1Threshold_jJ, TrigConf::L1Threshold_jLJ, TrigConf::L1Threshold_jTAU, TrigConf::L1Threshold_jTE, TrigConf::L1Threshold_jXE, TrigConf::L1Threshold_MU, TrigConf::L1Threshold_TAU, TrigConf::L1Threshold_ZB, TrigConf::L1Threshold_ZBTopo, TrigConf::L1ThrExtraInfoBase, and TrigConf::L1TopoAlgorithm.
Definition at line 252 of file DataStructure.h.
Definition at line 257 of file DataStructure.h.
|
protected |
Definition at line 256 of file DataStructure.h.
|
protected |
if initialized, the underlying ptree is has been assigned to (can be empty)
Definition at line 254 of file DataStructure.h.
|
protected |
Definition at line 259 of file DataStructure.h.