-
Notifications
You must be signed in to change notification settings - Fork 2
/
cl_brute.h
52 lines (39 loc) · 1.28 KB
/
cl_brute.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
//cl_brute.h
/*
Copyright (C) 2013 AIDEUS
authors: Sergey Rodionov ([email protected])
Alexey Potapov ([email protected])
aideus.com
This file is part of cl-lab.
cl-lab is released under the GNU General Public License (GNU GPL).
Please read the included file COPYING for more information.
*/
#ifndef __CL_BRUTE_H__
#define __CL_BRUTE_H__
#include "cl_base.h"
#include <vector>
using namespace std;
//algorithm generate all possible brackets (in CL sense!)
void cl_brute_all_brackets(int i1, int i2, vector< vector< pair<int,int> > >& allb);
void cl_brute_apply_brackets(string s, const vector< pair<int,int> >& brackets, string& rez);
//class to generate sequence of random cl expressions of given lengt
class cl_brute_generator
{
public:
void init(int l, string alphabet);
bool get_next(string& s);
//generate random string
//(state of get_next function will be changed)
string create_random();
size_t get_allb_size(){return allb.size();};
private:
bool get_next_cs();
void generate_string(string& s);
private:
int l;
string alphabet;
vector< vector< pair<int,int> > > allb; //all possible brackets for given l
vector<size_t> cs; //current "string"
size_t cb; //current bracket set
};
#endif