Evoplex  0.2.1
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
evoplex::AttrsGenerator Class Reference

Generates a set of Attributes. More...

#include <attrsgenerator.h>

Inheritance diagram for evoplex::AttrsGenerator:
evoplex::AttrsGeneratorInterface evoplex::AGDiffFunctions evoplex::AGSameFuncForAll

Public Member Functions

virtual ~AttrsGenerator ()=default
 Destructor.
 
AttributesScope attrsScope () const
 Gets the attribute's scope.
 
const QString & command ()
 Gets the source command for the AttrsGenerator object.
 
int size () const
 Gets the size of the set of attributes.
 
- Public Member Functions inherited from evoplex::AttrsGeneratorInterface
virtual ~AttrsGeneratorInterface ()=default
 Destructor.
 
virtual SetOfAttributes create (int size=-1, std::function< void(int)> progress=[](int){})=0
 Creates a set of attributes. More...
 

Static Public Member Functions

static AttrsGeneratorPtr parse (const AttributesScope &attrsScope, const QString &cmd, QString &error)
 Creates a AttrsGenerator object from a command. More...
 
static Value parseRandSeed (QString seedStr)
 Parse a 'rand_seed' command. More...
 

Protected Member Functions

 AttrsGenerator (const AttributesScope &attrsScope, const int size)
 Constructor. More...
 

Protected Attributes

const AttributesScope m_attrsScope
 
const int m_size
 
QString m_command
 

Detailed Description

Generates a set of Attributes.

See also
AGSameFuncForAll, AGDiffFunctions

Constructor & Destructor Documentation

◆ AttrsGenerator()

evoplex::AttrsGenerator::AttrsGenerator ( const AttributesScope &  attrsScope,
const int  size 
)
explicitprotected

Constructor.

Parameters
attrsScopeThe attribute's scope.
sizeThe size of the generated set of attributes.

Member Function Documentation

◆ parse()

static AttrsGeneratorPtr evoplex::AttrsGenerator::parse ( const AttributesScope &  attrsScope,
const QString &  cmd,
QString &  error 
)
static

Creates a AttrsGenerator object from a command.

Parameters
[in]attrsScopeThe attribute's scope.
[in]cmdThe command.
[out]errorThe error message.

The valid commands (cmd) are described below. In those commands, the 'integer' corresponds to the size of the set of attributes to be returned.

  • integer
    • "*integer;min" alias
  • same function for all attributes:
    • "*integer;min"
    • "*integer;max"
    • "*integer;rand_seed" - seed is an integer
    • "*min" - alias for "*1;min"
    • "*max" - alias for "*1;max"
    • "*rand_seed" - alias for "*1;rand_seed", where seed is an integer
  • specific function for each attribute:
    • "#integer;attrName1_func;...;attrNameN_func"
      • attrName: The attribute name.
      • func: min, max, rand_seed or value_val (val is the input).
    • "#attrName_func;..." - alias for "#1;attrName_func;..."
      • func: min, max, rand_seed or value_val (val is the input).

◆ parseRandSeed()

static Value evoplex::AttrsGenerator::parseRandSeed ( QString  seedStr)
static

Parse a 'rand_seed' command.

Parameters
seedStrA 'rand_seed' command, where seed is a positive integer. If seed is a positive int, it returns this number as a Value object. Else, it returns an invalid Value.

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