Leosac  0.8.0
Open Source Access Control
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
Leosac::Auth::AccessPoint::id_
AccessPointId id_
Definition: AccessPoint.hpp:63
IAccessPoint.hpp
LeosacFwd.hpp
Leosac::Auth::AccessPoint::door_id
DoorId door_id() const override
Definition: AccessPoint.cpp:73
Leosac::Auth::AccessPoint::version_
const size_t version_
Definition: AccessPoint.hpp:83
Leosac::Auth::AccessPoint::access
friend class odb::access
Definition: AccessPoint.hpp:86
Leosac::Auth::AccessPointUpdatePtr
std::shared_ptr< AccessPointUpdate > AccessPointUpdatePtr
Definition: AuthFwd.hpp:136
Leosac::Auth::AccessPoint::description_
std::string description_
Definition: AccessPoint.hpp:65
Leosac::Auth::AccessPoint::controller_module
std::string controller_module() const override
The name of the module that manages the access point.
Definition: AccessPoint.cpp:58
Door.hpp
Leosac
This is the header file for a generated source file, GitSHA1.cpp.
Definition: APIStatusCode.hpp:22
Leosac::Auth::AccessPoint::door_
std::weak_ptr< Door > door_
Definition: AccessPoint.hpp:68
Leosac::Auth::DoorId
unsigned long DoorId
Definition: AuthFwd.hpp:107
Leosac::Auth::Door
Represent a door.
Definition: Door.hpp:35
Leosac::Auth::IDoorPtr
std::shared_ptr< IDoor > IDoorPtr
Definition: AuthFwd.hpp:104
Leosac::Auth::AccessPoint::door
IDoorPtr door() const override
Definition: AccessPoint.cpp:68
AccessPointUpdate.hpp
Leosac::Auth::AccessPoint::alias_
std::string alias_
Definition: AccessPoint.hpp:64
Leosac::Auth::AccessPoint::id
AccessPointId id() const override
Definition: AccessPoint.cpp:33
Leosac::TestAccess
This is class that can be used to access some object's internal.
Definition: LeosacFwd.hpp:59
Leosac::Auth::AccessPoint::alias
const std::string & alias() const override
Definition: AccessPoint.cpp:38
Leosac::Auth::AccessPoint::AccessPoint
AccessPoint()
Definition: AccessPoint.cpp:28
Leosac::Auth::AccessPoint::updates_
std::vector< AccessPointUpdateLPtr > updates_
The history of the updates performed against the access-point.
Definition: AccessPoint.hpp:80
Leosac::Auth::AccessPoint::controller_module_
std::string controller_module_
Which module is responsible for this access point.
Definition: AccessPoint.hpp:73
Leosac::Auth::AccessPoint::description
const std::string & description() const override
Definition: AccessPoint.cpp:48
Leosac::Auth::AccessPoint
Definition: AccessPoint.hpp:30
Leosac::Auth::IAccessPoint
An interface for access point.
Definition: IAccessPoint.hpp:35
Leosac::Auth::AccessPoint::attach_update
void attach_update(AccessPointUpdatePtr)
Attach a new update object to the access-point.
Definition: AccessPoint.cpp:80
Leosac::Auth::AccessPointId
unsigned long AccessPointId
Definition: AuthFwd.hpp:128