μHAL (v2.6.5)
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 146 of file XmlParser.hpp.

Constructor & Destructor Documentation

◆ Rule()

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

Default constructor.

Definition at line 81 of file XmlParser.hxx.

◆ ~Rule()

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

Destructor.

Definition at line 90 of file XmlParser.hxx.

References uhal::Rule< R >::mFuncPtr.

Member Function Documentation

◆ description()

template<typename R >
std::string uhal::Rule< R >::description ( ) const

A function to return a string description of the rule.

Returns
a string description of the rule

Definition at line 135 of file XmlParser.hxx.

References uhal::Rule< R >::mForbidden, uhal::Rule< R >::mOptional, uhal::Rule< R >::mRequired, and uhal::Rule< R >::mRuleId.

Referenced by uhal::Parser< uhal::Node * >::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 114 of file XmlParser.hxx.

References uhal::Rule< R >::mForbidden, uhal::Rule< R >::mRequired, 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 207 of file XmlParser.hxx.

References uhal::Rule< R >::mFuncPtr.

◆ 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 128 of file XmlParser.hxx.

References uhal::Rule< R >::mOptional.

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 100 of file XmlParser.hxx.

References uhal::Rule< R >::mForbidden, uhal::Rule< R >::mRequired, 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 149 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 202 of file XmlParser.hpp.

Referenced by uhal::Rule< R >::description(), uhal::Rule< R >::forbid(), and uhal::Rule< R >::require().

◆ mForbiddenHash

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

The hash for forbidden attributes.

Definition at line 211 of file XmlParser.hpp.

◆ 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 214 of file XmlParser.hpp.

Referenced by uhal::Rule< R >::operator()(), and uhal::Rule< R >::~Rule().

◆ mOptional

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

The optional attributes for this rule.

Definition at line 204 of file XmlParser.hpp.

Referenced by uhal::Rule< R >::description(), and uhal::Rule< R >::optional().

◆ mRequired

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

The required attributes for this rule.

Definition at line 200 of file XmlParser.hpp.

Referenced by uhal::Rule< R >::description(), uhal::Rule< R >::forbid(), uhal::Parser< uhal::Node * >::operator()(), and uhal::Rule< R >::require().

◆ mRequiredHash

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

The hash for required attributes.

Definition at line 209 of file XmlParser.hpp.

◆ mRuleId

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

The ID of the rule.

Definition at line 207 of file XmlParser.hpp.

Referenced by uhal::Rule< R >::description().


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