μHAL (v2.7.9)
Part of the IPbus software repository
Public Member Functions | Private Attributes | List of all members
uhal::Parser< R > Class Template Reference

Forward declaration of the Parser so we can declare it friend. More...

#include <uhal/XmlParser.hpp>

Inheritance diagram for uhal::Parser< R >:
[legend]

Public Member Functions

 Parser ()
 Default constructor. More...
 
 ~Parser ()
 Destructor. More...
 
template<typename T >
void addRule (const Rule< R > &aRule, T aCallbackHandler)
 Method to add the rules to the parser. More...
 
operator() (const pugi::xml_node &aNode)
 Functor which converts an XML node to an object of template type R. More...
 

Private Attributes

uint64_t mNextHash
 One-hot encoded hash for rules. More...
 
boost::unordered_map< std::string, uint64_t > mHashes
 Map of the tags to the one-hot encoded hash. More...
 
std::deque< Rule< R > > mRules
 Container for storing rule objects. More...
 
uint32_t mRuleCounter
 Member to track rule numbers for giving each rule a unique ID. More...
 

Detailed Description

template<typename R>
class uhal::Parser< R >

Forward declaration of the Parser so we can declare it friend.

Parser class which converts an XML node to an object of type R.

Definition at line 71 of file XmlParser.hpp.

Constructor & Destructor Documentation

◆ Parser()

template<typename R >
uhal::Parser< R >::Parser

Default constructor.

Definition at line 239 of file XmlParser.hxx.

References uhal::Parser< R >::mHashes.

◆ ~Parser()

template<typename R >
uhal::Parser< R >::~Parser

Destructor.

Definition at line 248 of file XmlParser.hxx.

Member Function Documentation

◆ addRule()

template<typename R >
template<typename T >
void uhal::Parser< R >::addRule ( const Rule< R > &  aRule,
aCallbackHandler 
)

Method to add the rules to the parser.

Parameters
aRulea rule object specifying what to match
aCallbackHandlera function callback to be performed when the rule conditions are met

Definition at line 255 of file XmlParser.hxx.

References uhal::log(), uhal::Rule< R >::mForbidden, uhal::Rule< R >::mForbiddenHash, uhal::Rule< R >::mFuncPtr, uhal::Rule< R >::mOptional, uhal::Rule< R >::mRequired, uhal::Rule< R >::mRequiredHash, and uhal::Rule< R >::mRuleId.

◆ operator()()

template<typename R >
R uhal::Parser< R >::operator() ( const pugi::xml_node aNode)

Functor which converts an XML node to an object of template type R.

Parameters
aNodean XML node for converting to an object
Returns
an object of template type R

Definition at line 330 of file XmlParser.hxx.

References uhal::Rule< R >::description(), pugi::xml_node::first_attribute(), uhal::Integer(), uhal::log(), uhal::Rule< R >::mRequired, pugi::xml_attribute::next_attribute(), uhal::Quote(), and uhal::Warning.

Member Data Documentation

◆ mHashes

template<typename R >
boost::unordered_map< std::string , uint64_t > uhal::Parser< R >::mHashes
private

Map of the tags to the one-hot encoded hash.

Definition at line 241 of file XmlParser.hpp.

Referenced by uhal::Parser< R >::Parser().

◆ mNextHash

template<typename R >
uint64_t uhal::Parser< R >::mNextHash
private

One-hot encoded hash for rules.

Definition at line 239 of file XmlParser.hpp.

◆ mRuleCounter

template<typename R >
uint32_t uhal::Parser< R >::mRuleCounter
private

Member to track rule numbers for giving each rule a unique ID.

Definition at line 245 of file XmlParser.hpp.

◆ mRules

template<typename R >
std::deque< Rule<R> > uhal::Parser< R >::mRules
private

Container for storing rule objects.

Definition at line 243 of file XmlParser.hpp.


The documentation for this class was generated from the following files: