DD4hep
1.30.0
Detector Description Toolkit for High Energy Physics
|
Class to support the access to collections of JsonNodes (or JsonElements) More...
#include <Elements.h>
Public Member Functions | |
Collection_t (Handle_t node, const char *tag) | |
Constructor over JsonElements with a given tag name. More... | |
Collection_t (NodeList children) | |
Constructor over JsonElements in a node list. More... | |
Collection_t & | reset () |
Reset the collection object to restart the iteration. More... | |
size_t | size () const |
Access the collection size. Avoid this call – sloooow! More... | |
void | operator++ () const |
Operator to advance the collection (pre increment) More... | |
void | operator++ (int) const |
Operator to advance the collection (post increment) More... | |
void | operator-- () const |
Operator to advance the collection (pre decrement) More... | |
void | operator-- (int) const |
Operator to advance the collection (post decrement) More... | |
Elt_t | current () const |
Access to current element. More... | |
void | throw_loop_exception (const std::exception &e) const |
Helper function to throw an exception. More... | |
template<class T > | |
void | for_each (T oper) const |
Loop processor using function object. More... | |
template<class T > | |
void | for_each (const char *tag_name, T oper) const |
Loop processor using function object. More... | |
Public Member Functions inherited from dd4hep::json::Handle_t | |
Handle_t (Elt_t e=0) | |
Initializing constructor. More... | |
Elt_t | operator-> () const |
Direct access to the JsonElement using the operator-> More... | |
operator Elt_t () const | |
Direct access to the JsonElement by dereferencing. More... | |
Elt_t | ptr () const |
Direct access to the JsonElement by function. More... | |
const char * | rawTag () const |
Unicode text access to the element's tag. More... | |
const char * | rawText () const |
Unicode text access to the element's text. More... | |
const char * | rawValue () const |
Unicode text access to the element's value. More... | |
std::string | tag () const |
Text access to the element's tag. More... | |
std::string | text () const |
Text access to the element's text. More... | |
std::string | value () const |
Text access to the element's value. More... | |
const char * | attr_name (const Attribute attr) const |
Access attribute name (throws exception if not present) More... | |
const char * | attr_value (const Attribute attr) const |
Access attribute value by the attribute (throws exception if not present) More... | |
const char * | attr_value (const char *attr) const |
Access attribute value by the attribute's unicode name (throws exception if not present) More... | |
const char * | attr_value_nothrow (const char *attr) const |
Access attribute value by the attribute's unicode name (no exception thrown if not present) More... | |
Attribute | attr_ptr (const char *attr) const |
Access attribute pointer by the attribute's unicode name (throws exception if not present) More... | |
Attribute | attr_nothrow (const char *tag) const |
Access attribute pointer by the attribute's unicode name (no exception thrown if not present) More... | |
bool | hasAttr (const char *t) const |
Check for the existence of a named attribute. More... | |
std::vector< Attribute > | attributes () const |
Retrieve a collection of all attributes of this DOM element. More... | |
template<class T > | |
T | attr (const Attribute a) const |
Access typed attribute value by the JsonAttr. More... | |
template<class T > | |
T | attr (const char *name) const |
Access typed attribute value by its unicode name. More... | |
bool | hasChild (const char *tag) const |
Check the existence of a child with a given tag name. More... | |
Handle_t | child (const char *tag, bool throw_exception=true) const |
Access a single child by its tag name (unicode) More... | |
NodeList | children (const char *tag) const |
Access a group of children identified by the same tag name. More... | |
size_t | numChildren (const char *tag, bool throw_exception) const |
Access the number of children of this DOM element with a given tag name. More... | |
template<> | |
INLINE Attribute | attr (const char *tag_value) const |
template<> | |
INLINE const char * | attr (const char *tag_value) const |
template<> | |
INLINE bool | attr (const char *tag_value) const |
template<> | |
INLINE int | attr (const char *tag_value) const |
template<> | |
INLINE long | attr (const char *tag_value) const |
template<> | |
INLINE float | attr (const char *tag_value) const |
template<> | |
INLINE double | attr (const char *tag_value) const |
Public Attributes | |
NodeList | m_children |
Reference to the list of child nodes. More... | |
Public Attributes inherited from dd4hep::json::Handle_t | |
Elt_t | m_node |
The pointer to the JsonElement. More... | |
Additional Inherited Members | |
Public Types inherited from dd4hep::json::Handle_t | |
typedef JsonElement * | Elt_t |
Class to support the access to collections of JsonNodes (or JsonElements)
Definition at line 239 of file Elements.h.
Collection_t::Collection_t | ( | Handle_t | node, |
const char * | tag | ||
) |
Constructor over JsonElements with a given tag name.
Definition at line 382 of file Elements.cpp.
Collection_t::Collection_t | ( | NodeList | children | ) |
Constructor over JsonElements in a node list.
Constructor over XmlElements in a node list.
Definition at line 388 of file Elements.cpp.
|
inline |
Access to current element.
Definition at line 260 of file Elements.h.
|
inline |
Loop processor using function object.
Definition at line 276 of file Elements.h.
|
inline |
Loop processor using function object.
Definition at line 266 of file Elements.h.
void Collection_t::operator++ | ( | ) | const |
Operator to advance the collection (pre increment)
Definition at line 412 of file Elements.cpp.
void Collection_t::operator++ | ( | int | ) | const |
Operator to advance the collection (post increment)
Definition at line 428 of file Elements.cpp.
void Collection_t::operator-- | ( | ) | const |
Operator to advance the collection (pre decrement)
Definition at line 420 of file Elements.cpp.
void Collection_t::operator-- | ( | int | ) | const |
Operator to advance the collection (post decrement)
Definition at line 432 of file Elements.cpp.
Collection_t & Collection_t::reset | ( | ) |
Reset the collection object to restart the iteration.
Definition at line 394 of file Elements.cpp.
size_t Collection_t::size | ( | ) | const |
Access the collection size. Avoid this call – sloooow!
Definition at line 400 of file Elements.cpp.
void Collection_t::throw_loop_exception | ( | const std::exception & | e | ) | const |
Helper function to throw an exception.
Definition at line 405 of file Elements.cpp.
NodeList dd4hep::json::Collection_t::m_children |
Reference to the list of child nodes.
Definition at line 242 of file Elements.h.