Leosac  0.7.0
OpenSourceAccessControl
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
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
unsigned long AccessPointId
Definition: AuthFwd.hpp:128
This is the header file for a generated source file, GitSHA1.cpp.
virtual AccessPointId access_point_id() const override
Definition: Door.cpp:79
std::shared_ptr< ScheduleMapping > ScheduleMappingPtr
Definition: ToolsFwd.hpp:41
std::shared_ptr< IAccessPoint > IAccessPointPtr
Definition: AuthFwd.hpp:127
Represent a door.
Definition: Door.hpp:35
const size_t version_
Definition: Door.hpp:87
std::string alias_
Definition: Door.hpp:70
unsigned long DoorId
Definition: AuthFwd.hpp:107
virtual std::string description() const override
Definition: Door.cpp:41
friend class odb::access
Definition: Door.hpp:90
std::vector< Tools::ScheduleMappingLWPtr > schedules_mapping_
ScheduleMapping that maps this door.
Definition: Door.hpp:84
virtual std::string alias() const override
Definition: Door.cpp:36
std::string desc_
Definition: Door.hpp:71
virtual DoorId id() const override
Definition: Door.cpp:31
virtual IAccessPointPtr access_point() const override
Definition: Door.cpp:56
std::shared_ptr< AccessPoint > access_point_
The access point that controls the door.
Definition: Door.hpp:78
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
This is class that can be used to access some object&#39;s internal.
Definition: LeosacFwd.hpp:59