17 #ifndef ATTRS_GENERATOR_H 18 #define ATTRS_GENERATOR_H 23 #include "attributes.h" 24 #include "attributerange.h" 29 class AGSameFuncForAll;
30 class AGDiffFunctions;
32 using AttrsGeneratorPtr = std::unique_ptr<AttrsGenerator>;
51 virtual SetOfAttributes
create(
int size=-1, std::function<
void(
int)> progress = [](
int){}) = 0;
87 const QString &cmd, QString& error);
95 inline AttributesScope
attrsScope()
const {
return m_attrsScope; }
100 inline const QString&
command() {
return m_command; }
105 inline int size()
const {
return m_size; }
116 const AttributesScope m_attrsScope;
129 static std::unique_ptr<AGSameFuncForAll> parseStarCmd(
131 const QStringList& cmds, QString& error);
134 static std::unique_ptr<AGDiffFunctions> parseHashCmd(
136 const QStringList& cmds, QString& error);
156 const Function& func,
const Value& funcInput);
160 std::function<
void(
int)> progress = [](
int){})
override;
165 inline Function
function()
const {
return m_function; }
172 const Function m_function;
173 const Value m_functionInput;
175 std::function<Value(AttributeRangePtr)> f_value;
205 const std::vector<AttrCmd>&
attrCmds);
209 std::function<
void(
int)> progress = [](
int){})
override;
214 inline const std::vector<AttrCmd>&
attrCmds()
const {
return m_attrCmds; }
217 const std::vector<AttrCmd> m_attrCmds;
221 #endif // ATTRS_GENERATOR_H SetOfAttributes create(int size=-1, std::function< void(int)> progress=[](int){}) override
Creates a set of attributes.
A class for variant data types (tagged union).
Definition: value.h:56
This class is used to generate a set of Attributes using different functions for each attribute...
Definition: attrsgenerator.h:184
QString attrName
attribute's name
Definition: attrsgenerator.h:192
AGDiffFunctions(const AttributesScope &attrsScope, const int size, const std::vector< AttrCmd > &attrCmds)
Constructor.
The attribute's command struct.
Definition: attrsgenerator.h:190
SetOfAttributes create(int size=-1, std::function< void(int)> progress=[](int){}) override
Creates a set of attributes.
const QString & command()
Gets the source command for the AttrsGenerator object.
Definition: attrsgenerator.h:100
static AttrsGeneratorPtr parse(const AttributesScope &attrsScope, const QString &cmd, QString &error)
Creates a AttrsGenerator object from a command.
AttrsGenerator(const AttributesScope &attrsScope, const int size)
Constructor.
Function func
attribute's function
Definition: attrsgenerator.h:193
int size() const
Gets the size of the set of attributes.
Definition: attrsgenerator.h:105
AttributesScope attrsScope() const
Gets the attribute's scope.
Definition: attrsgenerator.h:95
const std::vector< AttrCmd > & attrCmds() const
Gets the attribute's commands.
Definition: attrsgenerator.h:214
virtual ~AttrsGeneratorInterface()=default
Destructor.
Generates a set of Attributes.
Definition: attrsgenerator.h:58
Value funcInput
function's input
Definition: attrsgenerator.h:194
virtual ~AttrsGenerator()=default
Destructor.
Pseudo-random number generator.
Definition: prg.h:29
A common interface for the attributes' generators classes.
Definition: attrsgenerator.h:38
int attrId
attribute's id
Definition: attrsgenerator.h:191
const Value & functionInput() const
Gets the input of the function used by this attributes generator.
Definition: attrsgenerator.h:169
AGSameFuncForAll(const AttributesScope &attrsScope, const int size, const Function &func, const Value &funcInput)
Constructor.
This class is used to generate a set of Attributes using the same function for all attributes...
Definition: attrsgenerator.h:144
Definition: abstractgraph.h:29
virtual SetOfAttributes create(int size=-1, std::function< void(int)> progress=[](int){})=0
Creates a set of attributes.
static Value parseRandSeed(QString seedStr)
Parse a 'rand_seed' command.