-
Notifications
You must be signed in to change notification settings - Fork 139
/
Attribute.h
61 lines (53 loc) · 1.48 KB
/
Attribute.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef ATTRIBUTE_H
#define ATTRIBUTE_H
#include <string>
#include <vector>
#include <sstream>
using namespace std;
class AttributeGenerator;
//Base class with pure virtual methods which will be derived as per different types of attribute generation
class Attribute
{
public:
//Name of attribute
string name;
//Attribute generation probability
int prob;
Attribute(string, int);
//Checks attribute probability and generate is accordingly
virtual string make_random() = 0;
};
//Generates Boolean attributes such as hot, cold, used, unused, deprecated, etc
class BooleanAttribute : public Attribute
{
public:
BooleanAttribute(string, int);
string make_random();
};
//Generates Multi Choice attributes such as visibility("option"), no_sanitize("option"), etc
class MultiChoiceAttribute : public Attribute
{
public:
//stores various options of attributes e.g. visibility options - default, hidden, internal and protected
vector<string> choices;
MultiChoiceAttribute(string, int, vector<string>);
string make_random();
};
//Generates alignment attribute
class AlignedAttribute : public Attribute
{
public:
//alignment factor - [functions] = 16 and [types] = 8 i.e. functions can take alignment upto 2^16 where as type can take upto 2^8
int alignment;
AlignedAttribute(string, int, int);
string make_random();
};
//Generates function and types attributes
class AttributeGenerator
{
public:
//stores instances of Attribute
vector<Attribute*> attributes;
void Output(std::ostream &);
};
#endif