QMCPACK
ListenerVector< T > Class Template Reference

An object of this type is a listener expecting a callback to the report function with a vector of values, the convention being 1 per particle, called once per walker per component. More...

+ Collaboration diagram for ListenerVector< T >:

Public Types

using ReportingFunction = std::function< void(const int walker_index, const std::string &name, const Vector< T > &values)>
 "Callback" function type for an operator to report a vector of values to a listener More...
 

Public Member Functions

 ListenerVector (const std::string &name, ReportingFunction report_func)
 constructor that should appear in the code More...
 
const std::string & get_name () const
 

Public Attributes

ReportingFunction report
 

Private Attributes

const std::string name_
 

Detailed Description

template<typename T>
class qmcplusplus::ListenerVector< T >

An object of this type is a listener expecting a callback to the report function with a vector of values, the convention being 1 per particle, called once per walker per component.

The name is primarily for debugging purposes, if have decided against having the QMCHamiltonian use it to estable routing. Instead the register functions in the QMCHamiltonian are specfic to the sort of value that the listener wants to listen to.

Definition at line 38 of file Listener.hpp.

Member Typedef Documentation

◆ ReportingFunction

using ReportingFunction = std::function<void(const int walker_index, const std::string& name, const Vector<T>& values)>

"Callback" function type for an operator to report a vector of values to a listener

Parameters
[in]walker_indexa numeric walker id, could be important to listener
[in]nameof operator reporting, could be important to listener
[in]valuesvector of values, per particle by convention. Also by convention the receiver should not assume the reference values have any persistence beyond the scope of the callback.

Definition at line 49 of file Listener.hpp.

Constructor & Destructor Documentation

◆ ListenerVector()

ListenerVector ( const std::string &  name,
ReportingFunction  report_func 
)
inline

constructor that should appear in the code

Parameters
[in]nameintended to be strictly information
[in]report_funcintended to be a lambda callback function that will be used to report.

Definition at line 54 of file Listener.hpp.

54 : report(report_func), name_(name) {}
ReportingFunction report
Definition: Listener.hpp:55
const std::string name_
Definition: Listener.hpp:59

Member Function Documentation

◆ get_name()

const std::string& get_name ( ) const
inline

Definition at line 56 of file Listener.hpp.

References ListenerVector< T >::name_.

56 { return name_; }
const std::string name_
Definition: Listener.hpp:59

Member Data Documentation

◆ name_

const std::string name_
private

Definition at line 59 of file Listener.hpp.

Referenced by ListenerVector< T >::get_name().

◆ report


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