Leosac  0.8.0
Open Source Access Control
ISchedule.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 #include "tools/ToolsFwd.hpp"
21 #include <chrono>
22 #include <string>
23 #include <vector>
24 
25 #pragma once
26 
27 namespace Leosac
28 {
29 namespace Tools
30 {
31 /*
32  * The interface for Schedule object.
33  *
34  * This class is not "ODB aware". Its main purpose
35  * is to prevent too many includes for clients that do not need
36  * to interact with the database.
37  */
38 class ISchedule : public std::enable_shared_from_this<ISchedule>
39 {
40  public:
41  virtual ~ISchedule() = default;
42 
43  virtual ScheduleId id() const = 0;
44 
48  virtual const std::string &name() const = 0;
49 
50  virtual void name(const std::string &) = 0;
51 
52  virtual const std::string &description() const = 0;
53 
54  virtual void description(const std::string &) = 0;
55 
59  virtual bool
60  is_in_schedule(const std::chrono::system_clock::time_point &tp) const = 0;
61 
65  virtual void add_timeframe(const SingleTimeFrame &tf) = 0;
66 
70  virtual void clear_timeframes() = 0;
71 
76  virtual std::vector<SingleTimeFrame> timeframes() const = 0;
77 
78  virtual void add_mapping(const Tools::ScheduleMappingPtr &map) = 0;
79 
80  virtual void clear_mapping() = 0;
81 
82  virtual std::vector<Tools::ScheduleMappingPtr> mapping() const = 0;
83 
84 
85  virtual size_t odb_version() const = 0;
86 };
87 }
88 }
Leosac::Tools::ISchedule::add_mapping
virtual void add_mapping(const Tools::ScheduleMappingPtr &map)=0
Leosac::Tools::ISchedule::timeframes
virtual std::vector< SingleTimeFrame > timeframes() const =0
Retrieves the list of timesframes that compose this schedule.
Leosac::Tools::ISchedule::clear_timeframes
virtual void clear_timeframes()=0
Remove all the timeframes from this schedule.
Leosac::Tools::ScheduleMappingPtr
std::shared_ptr< ScheduleMapping > ScheduleMappingPtr
Definition: ToolsFwd.hpp:41
Leosac::Tools::ISchedule::id
virtual ScheduleId id() const =0
Leosac::Tools::ISchedule::name
virtual const std::string & name() const =0
Retrieve the name of the schedule.
Leosac::Tools::ISchedule::odb_version
virtual size_t odb_version() const =0
ToolsFwd.hpp
Leosac::Tools::ISchedule::add_timeframe
virtual void add_timeframe(const SingleTimeFrame &tf)=0
Add the given timeframe to this schedule;.
Leosac
This is the header file for a generated source file, GitSHA1.cpp.
Definition: APIStatusCode.hpp:22
Leosac::Tools::ScheduleId
unsigned long ScheduleId
Definition: ToolsFwd.hpp:33
Leosac::Tools::ISchedule::~ISchedule
virtual ~ISchedule()=default
Leosac::Tools::ISchedule::clear_mapping
virtual void clear_mapping()=0
Leosac::Tools::ISchedule::mapping
virtual std::vector< Tools::ScheduleMappingPtr > mapping() const =0
Leosac::Tools::ISchedule
Definition: ISchedule.hpp:38
Leosac::Tools::SingleTimeFrame
This struct abstracts what we call a single time frame.
Definition: SingleTimeFrame.hpp:38
Leosac::Tools::ISchedule::is_in_schedule
virtual bool is_in_schedule(const std::chrono::system_clock::time_point &tp) const =0
Check whether or not the given time point can be found in the schedule.
Leosac::Tools::ISchedule::description
virtual const std::string & description() const =0