-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSetArguments.h
62 lines (53 loc) · 1.79 KB
/
SetArguments.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
62
/*
* SetArguments.h
*
* Created on: 3 Jun 2013
* Author: geryo
*/
#ifndef SETARGUMENTS_H_
#define SETARGUMENTS_H_
#include <map>
#include <string>
#include <iterator>
#include <algorithm>
using namespace std;
#include "Argument.h"
/**
* @brief Class defining a const iterator for the elements of a set of arguments
*/
class SetArgumentsIterator : public map<string, Argument *>::const_iterator
{
public:
SetArgumentsIterator() : map<string, Argument *>::const_iterator() {};
SetArgumentsIterator(map<string, Argument *>::const_iterator it) : map<string, Argument *>::const_iterator(it) {};
Argument ** operator->() {return (Argument ** const)&(map<string, Argument *>::const_iterator::operator->()->second); };
Argument* operator*() { return map<string, Argument *>::const_iterator::operator*().second; }
SetArgumentsIterator &operator=(const SetArgumentsIterator ¶m) { map<string, Argument *>::const_iterator::operator = (param); return *this; }
};
class SetArguments
{
map<string, Argument *> arguments;
map<int, string> key_assoc;
public:
SetArguments();
void add_Argument(Argument *);
virtual ~SetArguments();
Argument *getArgumentByName(string);
Argument *getArgumentByNumber(int num);
int cardinality() const;
bool empty();
SetArgumentsIterator begin() const;
SetArgumentsIterator end() const;
bool exists(Argument *);
bool is_subset_equal(SetArguments *);
bool is_subset(SetArguments *);
void intersect(SetArguments *, SetArguments *);
void setminus(SetArguments *, SetArguments *);
void setunion(SetArguments *, SetArguments *);
void remove(Argument *);
void clone(SetArguments *);
bool operator==(const SetArguments &other) const;
SetArguments * adjust_set(SetArguments * set_correct);
};
ostream& operator<<(ostream& , const SetArguments& );
#endif /* SETARGUMENTS_H_ */