summary refs log tree commit diff stats
path: root/generator/role.h
blob: fccfa98522fdbb382ef984cbdb9b171849f64341 (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
#ifndef ROLE_H_249F9A9C
#define ROLE_H_249F9A9C

#include <stdexcept>
#include <string>
#include <set>

namespace verbly {

  class role {
  public:

    // Default constructor

    role() = default;

    // Constructor

    role(
      std::string name,
      std::set<std::string> selrestrs = {}) :
        valid_(true),
        name_(name),
        selrestrs_(selrestrs)
    {
    }

    // Accessors

    const std::string& getName() const
    {
      if (!valid_)
      {
        throw std::domain_error("Bad access to invalid role");
      }

      return name_;
    }

    const std::set<std::string>& getSelrestrs() const
    {
      if (!valid_)
      {
        throw std::domain_error("Bad access to invalid role");
      }

      return selrestrs_;
    }

  private:

    bool valid_ = false;
    std::string name_;
    std::set<std::string> selrestrs_;

  };

};

#endif /* end of include guard: ROLE_H_249F9A9C */