ZeroErr
Loading...
Searching...
No Matches
zeroerr::AggregateOf< T, Inner > Class Template Reference

AggregateOf is a domain that combines multiple inner domains into a tuple or aggregate type. More...

#include <aggregate_of.h>

Inheritance diagram for zeroerr::AggregateOf< T, Inner >:
Collaboration diagram for zeroerr::AggregateOf< T, Inner >:

Classes

struct  GetTupleDomainMapValue

Public Types

using ValueType = T
using CorpusType = std::tuple<typename Inner::CorpusType...>

Public Member Functions

 AggregateOf (Inner &&... inner)
CorpusType GetRandomCorpus (Rng &rng) const override
ValueType GetValue (const CorpusType &v) const override
CorpusType FromValue (const ValueType &v) const override
void Mutate (Rng &rng, CorpusType &v, bool only_shrink) const override
Public Member Functions inherited from zeroerr::Domain< T, std::tuple< Inner::CorpusType... > >
virtual ~Domain ()=default
virtual T GetRandomValue (Rng &rng) const
virtual T GetValue (const CorpusType &v) const=0
virtual CorpusType ParseCorpus (IRObject v) const
virtual IRObject SerializeCorpus (const CorpusType &v) const
virtual void Mutate (Rng &rng, CorpusType &v, bool only_shrink=false) const=0

Detailed Description

template<typename T, typename... Inner>
class zeroerr::AggregateOf< T, Inner >

AggregateOf is a domain that combines multiple inner domains into a tuple or aggregate type.

Template Parameters
TThe aggregate type to generate (e.g. struct or tuple)
InnerThe inner domain types that will generate each field

This domain allows generating structured data by composing multiple inner domains. Each inner domain generates one field of the aggregate type.

Example:

struct Point {
int x;
int y;
};
auto domain = AggregateOf<Point>(
InRange(0, 100), // Domain for x
InRange(0, 100) // Domain for y
);
AggregateOf(Inner &&... inner)
Definition aggregate_of.h:65
InRange is a domain that generates random values within a specified range.
Definition in_range.h:31

Member Typedef Documentation

◆ CorpusType

template<typename T, typename... Inner>
using zeroerr::AggregateOf< T, Inner >::CorpusType = std::tuple<typename Inner::CorpusType...>

◆ ValueType

template<typename T, typename... Inner>
using zeroerr::AggregateOf< T, Inner >::ValueType = T

Constructor & Destructor Documentation

◆ AggregateOf()

template<typename T, typename... Inner>
zeroerr::AggregateOf< T, Inner >::AggregateOf ( Inner &&... inner)
inline

Member Function Documentation

◆ FromValue()

template<typename T, typename... Inner>
CorpusType zeroerr::AggregateOf< T, Inner >::FromValue ( const ValueType & v) const
inlineoverridevirtual

◆ GetRandomCorpus()

template<typename T, typename... Inner>
CorpusType zeroerr::AggregateOf< T, Inner >::GetRandomCorpus ( Rng & rng) const
inlineoverridevirtual

◆ GetValue()

template<typename T, typename... Inner>
ValueType zeroerr::AggregateOf< T, Inner >::GetValue ( const CorpusType & v) const
inlineoverride

◆ Mutate()

template<typename T, typename... Inner>
void zeroerr::AggregateOf< T, Inner >::Mutate ( Rng & rng,
CorpusType & v,
bool only_shrink ) const
inlineoverride

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