Leosac  0.8.0
Open Source Access Control
AccessPoint.cpp
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 #include "AccessPoint.hpp"
21 #include "AccessPointUpdate.hpp"
22 #include "Door.hpp"
23 #include "tools/log.hpp"
24 
25 using namespace Leosac;
26 using namespace Leosac::Auth;
27 
29  : version_(0)
30 {
31 }
32 
34 {
35  return id_;
36 }
37 
38 const std::string &AccessPoint::alias() const
39 {
40  return alias_;
41 }
42 
43 void AccessPoint::alias(const std::string &new_alias)
44 {
45  alias_ = new_alias;
46 }
47 
48 const std::string &AccessPoint::description() const
49 {
50  return description_;
51 }
52 
53 void AccessPoint::description(const std::string &dsc)
54 {
55  description_ = dsc;
56 }
57 
58 std::string AccessPoint::controller_module() const
59 {
60  return controller_module_;
61 }
62 
63 void AccessPoint::controller_module(const std::string &ctrl_mod)
64 {
65  controller_module_ = ctrl_mod;
66 }
67 
69 {
70  return door_.lock();
71 }
72 
74 {
75  if (door_.lock())
76  return door_.lock()->id();
77  return 0;
78 }
79 
81 {
82  ASSERT_LOG(ap_update, "Cannot attach a null update.");
83  updates_.push_back(ap_update);
84  ap_update->access_point(shared_from_this());
85 }
AccessPoint.hpp
Leosac::Auth
Holds classes relevant to the Authentication and Authorization subsystem.
Definition: AccessPoint.hpp:27
Leosac::Auth::AccessPoint::id_
AccessPointId id_
Definition: AccessPoint.hpp:63
ASSERT_LOG
#define ASSERT_LOG(cond, msg)
Definition: log.hpp:190
Leosac::Auth::AccessPoint::door_id
DoorId door_id() const override
Definition: AccessPoint.cpp:73
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::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::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
log.hpp
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::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