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

Rule for matching XML attributes. More...

#include <uhal/XmlParser.hpp>

Public Member Functions

 Rule ()
 Default constructor. More...
 
virtual ~Rule ()
 Destructor. More...
 
Rule< R > & require (const std::string &aStr)
 Add a required attribute to the rule. More...
 
Rule< R > & forbid (const std::string &aStr)
 Add an forbidden attribute to the rule. More...
 
Rule< R > & optional (const std::string &aStr)
 Add an optional attribute to the rule. More...
 
std::string description () const
 A function to return a string description of the rule. More...
 

Private Member Functions

operator() (const pugi::xml_node &aNode)
 Functor which converts an XML node to an object of template type R (Calls the function pointer, if it is not NULL) More...
 

Private Attributes

std::set< std::string > mRequired
 The required attributes for this rule. More...
 
std::set< std::string > mForbidden
 The forbidden attributes for this rule. More...
 
std::set< std::string > mOptional
 The optional attributes for this rule. More...
 
uint32_t mRuleId
 The ID of the rule. More...
 
uint64_t mRequiredHash
 The hash for required attributes. More...
 
uint64_t mForbiddenHash
 The hash for forbidden attributes. More...
 
BaseFunctionObject< R > * mFuncPtr
 An object wrapping the function pointer for the function to be called when the rule conditions are met. More...
 

Friends

class Parser< R >
 Make the Parser a friend of the Rule. More...
 

Detailed Description

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

Rule for matching XML attributes.

Definition at line 144 of file XmlParser.hpp.

Constructor & Destructor Documentation

◆ Rule()

template<typename R >
uhal::Rule< R >::Rule

Default constructor.

Definition at line 89 of file XmlParser.hxx.

◆ ~Rule()

template<typename R >
uhal::Rule< R >::~Rule
virtual

Destructor.

Definition at line 99 of file XmlParser.hxx.

Member Function Documentation

◆ description()

template<typename R >
std::string uhal::Rule< R >::description

A function to return a string description of the rule.

Returns
a string description of the rule

Definition at line 148 of file XmlParser.hxx.

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

◆ forbid()

template<typename R >
Rule< R > & uhal::Rule< R >::forbid ( const std::string &  aStr)

Add an forbidden attribute to the rule.

Parameters
aStran forbidden attribute to the rule
Returns
this rule object for chaining instruction calls

Definition at line 125 of file XmlParser.hxx.

References uhal::log(), and uhal::Quote().

◆ operator()()

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

Functor which converts an XML node to an object of template type R (Calls the function pointer, if it is not NULL)

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

Definition at line 221 of file XmlParser.hxx.

◆ optional()

template<typename R >
Rule< R > & uhal::Rule< R >::optional ( const std::string &  aStr)

Add an optional attribute to the rule.

Parameters
aStran optional attribute to the rule
Returns
this rule object for chaining instruction calls

Definition at line 140 of file XmlParser.hxx.

Referenced by uhal::NodeTreeBuilder::NodeTreeBuilder().

◆ require()

template<typename R >
Rule< R > & uhal::Rule< R >::require ( const std::string &  aStr)

Add a required attribute to the rule.

Parameters
aStra required attribute to the rule
Returns
this rule object for chaining instruction calls

Definition at line 110 of file XmlParser.hxx.

References uhal::log(), and uhal::Quote().

Referenced by uhal::NodeTreeBuilder::NodeTreeBuilder().

Friends And Related Function Documentation

◆ Parser< R >

template<typename R >
friend class Parser< R >
friend

Make the Parser a friend of the Rule.

Definition at line 137 of file XmlParser.hpp.

Member Data Documentation

◆ mForbidden

template<typename R >
std::set<std::string> uhal::Rule< R >::mForbidden
private

The forbidden attributes for this rule.

Definition at line 196 of file XmlParser.hpp.

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

◆ mForbiddenHash

template<typename R >
uint64_t uhal::Rule< R >::mForbiddenHash
private

The hash for forbidden attributes.

Definition at line 205 of file XmlParser.hpp.

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

◆ mFuncPtr

template<typename R >
BaseFunctionObject<R>* uhal::Rule< R >::mFuncPtr
private

An object wrapping the function pointer for the function to be called when the rule conditions are met.

Definition at line 208 of file XmlParser.hpp.

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

◆ mOptional

template<typename R >
std::set<std::string> uhal::Rule< R >::mOptional
private

The optional attributes for this rule.

Definition at line 198 of file XmlParser.hpp.

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

◆ mRequired

template<typename R >
std::set<std::string> uhal::Rule< R >::mRequired
private

The required attributes for this rule.

Definition at line 194 of file XmlParser.hpp.

Referenced by uhal::Parser< R >::addRule(), and uhal::Parser< R >::operator()().

◆ mRequiredHash

template<typename R >
uint64_t uhal::Rule< R >::mRequiredHash
private

The hash for required attributes.

Definition at line 203 of file XmlParser.hpp.

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

◆ mRuleId

template<typename R >
uint32_t uhal::Rule< R >::mRuleId
private

The ID of the rule.

Definition at line 201 of file XmlParser.hpp.

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


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