blob: d2f0f9256dccbbbe0b3b16e43e51ce301e3361e6 (
plain) (
blame)
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
63
64
65
66
67
68
69
|
#ifndef ORDER_H_0EC669D5
#define ORDER_H_0EC669D5
#include <stdexcept>
#include "field.h"
namespace verbly {
class order {
public:
enum class type {
random,
field
};
// Type
type getType() const
{
return type_;
}
// Random
order() : type_(type::random)
{
}
// Field
order(
field arg,
bool asc = true) :
type_(type::field),
sortField_(std::move(arg)),
ascending_(asc)
{
}
field getSortField() const
{
if (type_ != type::field)
{
throw std::domain_error("Invalid access to non-field order");
}
return sortField_;
}
bool isAscending() const
{
if (type_ != type::field)
{
throw std::domain_error("Invalid access to non-field order");
}
return ascending_;
}
private:
type type_;
field sortField_;
bool ascending_;
};
};
#endif /* end of include guard: ORDER_H_0EC669D5 */
|