Leosac  0.8.0
Open Source Access Control
RFIDCardPin.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 
21 #include "tools/log.hpp"
22 
23 namespace Leosac
24 {
25 namespace Cred
26 {
27 
29  : RFIDCardPin(std::make_shared<RFIDCard>(), std::make_shared<PinCode>())
30 {
31 }
32 
34  : card_(card)
35  , pin_(pin)
36 {
37  ASSERT_LOG(card, "Cannot create an RFIDCardPin with null RFIDCard");
38  ASSERT_LOG(pin, "Cannot create an RFIDCardPin with null PinCode");
39 }
40 
41 const PinCode &RFIDCardPin::pin() const
42 {
43  return *pin_;
44 }
45 
47 {
48  return *card_;
49 }
50 
52 {
53  return *card_;
54 }
55 
56 PinCode &RFIDCardPin::pin()
57 {
58  return *pin_;
59 }
60 }
61 }
Leosac::Cred::PinCode
A PinCode credential.
Definition: PinCode.hpp:33
Leosac::Cred::RFIDCardPin::pin_
PinCodePtr pin_
Definition: RFIDCardPin.hpp:62
Leosac::Cred::RFIDCardPin
Credentials composed of an RFIDCard and a PIN code.
Definition: RFIDCardPin.hpp:37
Leosac::Cred::RFIDCardPtr
std::shared_ptr< RFIDCard > RFIDCardPtr
Definition: CredentialFwd.hpp:43
ASSERT_LOG
#define ASSERT_LOG(cond, msg)
Definition: log.hpp:190
Leosac::Cred::RFIDCard
An RFID card credential.
Definition: RFIDCard.hpp:33
Leosac::Cred::RFIDCardPin::RFIDCardPin
RFIDCardPin()
Create an RFIDCardPin object with default initialized RFIDCard and PinCode object.
Definition: RFIDCardPin.cpp:28
Leosac
This is the header file for a generated source file, GitSHA1.cpp.
Definition: APIStatusCode.hpp:22
RFIDCardPin.hpp
Leosac::Cred::PinCodePtr
std::shared_ptr< PinCode > PinCodePtr
Definition: CredentialFwd.hpp:47
Leosac::Cred::RFIDCardPin::card
const RFIDCard & card() const
Definition: RFIDCardPin.cpp:46
Leosac::Cred::RFIDCardPin::pin
const PinCode & pin() const
Definition: RFIDCardPin.cpp:41
log.hpp
Leosac::Cred::RFIDCardPin::card_
RFIDCardPtr card_
Definition: RFIDCardPin.hpp:61