Leosac  0.8.0
Open Source Access Control
Door.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"
23 #include "core/auth/AuthFwd.hpp"
24 #include "core/auth/IDoor.hpp"
25 
26 namespace Leosac
27 {
28 namespace Auth
29 {
30 
34 #pragma db object optimistic
35 class Door : public virtual IDoor
36 {
37  public:
38  Door();
39  virtual DoorId id() const override;
40 
41  virtual std::string alias() const override;
42 
43  virtual std::string description() const override;
44 
45  virtual void alias(const std::string &alias) override;
46 
47  virtual void description(const std::string &desc) override;
48 
49  virtual IAccessPointPtr access_point() const override;
50 
51  virtual AccessPointId access_point_id() const override;
52 
53  virtual void access_point(IAccessPointPtr ptr) override;
54 
55  virtual std::vector<Tools::ScheduleMappingLWPtr> lazy_mapping() const override;
56 
64  void schedule_mapping_added(const Tools::ScheduleMappingPtr &sched_mapping);
65 
66  protected:
67 #pragma db id auto
69 
70  std::string alias_;
71  std::string desc_;
72 
77 #pragma db unique
78  std::shared_ptr<AccessPoint> access_point_;
79 
83 #pragma db value_not_null inverse(doors_)
84  std::vector<Tools::ScheduleMappingLWPtr> schedules_mapping_;
85 
86 #pragma db version
87  const size_t version_;
88 
89  private:
90  friend class odb::access;
91  friend class Leosac::TestAccess;
92 };
93 }
94 }
95 
96 #ifdef ODB_COMPILER
98 #endif
Leosac::Auth::Door::access_point_
std::shared_ptr< AccessPoint > access_point_
The access point that controls the door.
Definition: Door.hpp:78
AccessPoint.hpp
Leosac::Auth::Door::desc_
std::string desc_
Definition: Door.hpp:71
IDoor.hpp
Leosac::Auth::Door::description
virtual std::string description() const override
Definition: Door.cpp:41
Leosac::Auth::Door::schedule_mapping_added
void schedule_mapping_added(const Tools::ScheduleMappingPtr &sched_mapping)
A ScheduleMapping object has added this door as part of its mapping.
Definition: Door.cpp:73
AuthFwd.hpp
LeosacFwd.hpp
Leosac::Auth::Door::access_point_id
virtual AccessPointId access_point_id() const override
Definition: Door.cpp:79
Leosac::Auth::Door::schedules_mapping_
std::vector< Tools::ScheduleMappingLWPtr > schedules_mapping_
ScheduleMapping that maps this door.
Definition: Door.hpp:84
Leosac::Tools::ScheduleMappingPtr
std::shared_ptr< ScheduleMapping > ScheduleMappingPtr
Definition: ToolsFwd.hpp:41
Leosac::Auth::IAccessPointPtr
std::shared_ptr< IAccessPoint > IAccessPointPtr
Definition: AuthFwd.hpp:127
Leosac
This is the header file for a generated source file, GitSHA1.cpp.
Definition: APIStatusCode.hpp:22
Leosac::Auth::Door::lazy_mapping
virtual std::vector< Tools::ScheduleMappingLWPtr > lazy_mapping() const override
Retrieve the lazy pointers to the ScheduleMapping objects that map this door.
Definition: Door.cpp:68
Leosac::Auth::DoorId
unsigned long DoorId
Definition: AuthFwd.hpp:107
Leosac::Auth::Door::version_
const size_t version_
Definition: Door.hpp:87
Leosac::Auth::Door
Represent a door.
Definition: Door.hpp:35
Leosac::Auth::Door::id_
DoorId id_
Definition: Door.hpp:68
Leosac::Auth::Door::id
virtual DoorId id() const override
Definition: Door.cpp:31
Leosac::Auth::Door::alias
virtual std::string alias() const override
Definition: Door.cpp:36
Leosac::TestAccess
This is class that can be used to access some object's internal.
Definition: LeosacFwd.hpp:59
Leosac::Auth::Door::alias_
std::string alias_
Definition: Door.hpp:70
Leosac::Auth::Door::access
friend class odb::access
Definition: Door.hpp:90
Leosac::Auth::Door::Door
Door()
Definition: Door.cpp:26
Leosac::Auth::IDoor
A door.
Definition: IDoor.hpp:38
Leosac::Auth::Door::access_point
virtual IAccessPointPtr access_point() const override
Definition: Door.cpp:56
Leosac::Auth::AccessPointId
unsigned long AccessPointId
Definition: AuthFwd.hpp:128