rngtest::Battery class

Battery.

This class uses runtime polymorphism without client-side inheritance: inheritance is confined to the internals of the this class, invisible to client-code. The class exclusively deals with ownership enabling client-side value semantics. Credit goes to Sean Parent at Adobe: https://github.com/sean-parent/sean-parent.github.com/wiki/ Papers-and-Presentations. For example client code that models a Battery, see rngtest::TestU01Suite.

Constructors, destructors, conversion operators

template<typename T>
Battery(T x) explicit
Constructor taking an object modeling Concept.
template<typename T, typename std::enable_if<!tk::HasTypedefProxy<T>::value, int>::type = 0>
Battery(std::function<T()> x) explicit
Constructor taking a std::function holding a constructor bound to its arguments of an object modeling Concept.
template<typename T, typename... ConstrArgs, typename std::enable_if<tk::HasTypedefProxy<T>::value, int>::type = 0>
Battery(std::function<T()> c, ConstrArgs... args) explicit
Constructor taking a function pointer to a constructor of an object modeling Concept.
Battery(const Battery& x)
Copy constructor.
Battery(Battery&&) noexcept defaulted
Move constructor.

Public functions

void evaluate(std::vector<std::vector<std::string>> status) const
Public interface to evaluating a statistical test.
void npval(std::size_t n) const
Public interface to collecting the number of statistics from a test.
void names(std::vector<std::string> n) const
Public interface to collecting test name(s) from a test.
auto operator=(const Battery& x) -> Battery&
Copy assignment.
auto operator=(Battery&&) noexcept -> Battery& defaulted
Move assignment.

Function documentation

template<typename T>
rngtest::Battery::Battery(T x) explicit

Constructor taking an object modeling Concept.

Parameters
in Instantiated object of type T given by the template argument.

The object of class T comes pre-constructed.

template<typename T, typename std::enable_if<!tk::HasTypedefProxy<T>::value, int>::type = 0>
rngtest::Battery::Battery(std::function<T()> x) explicit

Constructor taking a std::function holding a constructor bound to its arguments of an object modeling Concept.

Passing std::function allows late execution of the constructor of T (given by the template argument), i.e., as late as inside this class' constructor, and thus usage from a factory. Object of T is constructed here. This overload is disabled for Charm++ chare objects defining typedef 'Proxy', see also below.

template<typename T, typename... ConstrArgs, typename std::enable_if<tk::HasTypedefProxy<T>::value, int>::type = 0>
rngtest::Battery::Battery(std::function<T()> c, ConstrArgs... args) explicit

Constructor taking a function pointer to a constructor of an object modeling Concept.

Parameters
in Function pointer to a constructor of an object modeling Concept.
args in Constructor arguments

Passing std::function allows late execution of the constructor of T, i.e., at some future time, and thus usage from a factory. Note that the value of the first function argument, std::function<T()>, is not used here, but its constructor type, T, is used to enable the compiler to deduce the model constructor type, used to create its Charm proxy, defined by T::Proxy. The actual constructor of T is not called here but at some future time by the Charm++ runtime system, here only an asynchrounous ckNew() is called, i.e., a message (or request) for a future call to T's constructor. This overload is only enabled for Charm++ chare objects defining typedef 'Proxy', which must define the Charm++ proxy. All optional constructor arguments are forwarded to ckNew() and thus to T's constructor. If it was somehow possible to obtain all bound arguments' types and values from an already-bound std::function, we could use those instead of having to explicitly forward the model constructor arguments via this host constructor.