Leosac  0.7.0
OpenSourceAccessControl
AccessPoint.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014-2016 Leosac
3 
4  This file is part of Leosac.
5 
6  Leosac is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Affero General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Leosac is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Affero General Public License for more details.
15 
16  You should have received a copy of the GNU Affero General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #pragma once
21 
22 #include "LeosacFwd.hpp"
24 
25 namespace Leosac
26 {
27 namespace Auth
28 {
29 #pragma db object optimistic polymorphic
30 class AccessPoint : public virtual IAccessPoint,
31  public std::enable_shared_from_this<AccessPoint>
32 {
33  public:
34  AccessPoint();
35  AccessPointId id() const override;
36 
37  const std::string &alias() const override;
38 
39  void alias(const std::string &new_alias) override;
40 
41  const std::string &description() const override;
42 
43  void description(const std::string &dsc) override;
44 
45  void controller_module(const std::string &ctrl_mod) override;
46 
47  std::string controller_module() const override;
48 
49  IDoorPtr door() const override;
50 
51  DoorId door_id() const override;
52 
60 
61  protected:
62 #pragma db id auto
64  std::string alias_;
65  std::string description_;
66 
67 #pragma db inverse(access_point_)
68  std::weak_ptr<Door> door_;
69 
73  std::string controller_module_;
74 
75 
79 #pragma db value_not_null
80  std::vector<AccessPointUpdateLPtr> updates_;
81 
82 #pragma db version
83  const size_t version_;
84 
85  private:
86  friend class odb::access;
87 
88  friend class Leosac::TestAccess;
89 
94  friend class Door;
95 };
96 }
97 }
98 
99 #ifdef ODB_COMPILER
101 #include "core/auth/Door.hpp"
102 #endif
std::string controller_module_
Which module is responsible for this access point.
Definition: AccessPoint.hpp:73
std::string controller_module() const override
The name of the module that manages the access point.
Definition: AccessPoint.cpp:58
unsigned long AccessPointId
Definition: AuthFwd.hpp:128
const std::string & description() const override
Definition: AccessPoint.cpp:48
This is the header file for a generated source file, GitSHA1.cpp.
void attach_update(AccessPointUpdatePtr)
Attach a new update object to the access-point.
Definition: AccessPoint.cpp:80
An interface for access point.
std::shared_ptr< AccessPointUpdate > AccessPointUpdatePtr
Definition: AuthFwd.hpp:136
std::shared_ptr< IDoor > IDoorPtr
Definition: AuthFwd.hpp:104
Represent a door.
Definition: Door.hpp:35
unsigned long DoorId
Definition: AuthFwd.hpp:107
DoorId door_id() const override
Definition: AccessPoint.cpp:73
std::vector< AccessPointUpdateLPtr > updates_
The history of the updates performed against the access-point.
Definition: AccessPoint.hpp:80
friend class odb::access
Definition: AccessPoint.hpp:86
std::weak_ptr< Door > door_
Definition: AccessPoint.hpp:68
IDoorPtr door() const override
Definition: AccessPoint.cpp:68
This is class that can be used to access some object&#39;s internal.
Definition: LeosacFwd.hpp:59
AccessPointId id() const override
Definition: AccessPoint.cpp:33
const std::string & alias() const override
Definition: AccessPoint.cpp:38