Leosac  0.8.0
Open Source Access Control
CoreUtils.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 "CoreAPI.hpp"
23 #include "LeosacFwd.hpp"
24 #include "tools/db/db_fwd.hpp"
26 
27 namespace zmqpp
28 {
29 class context;
30 }
31 
32 namespace Leosac
33 {
43 class CoreUtils
44 {
45  public:
46  CoreUtils();
47  CoreUtils(Kernel *kptr, SchedulerPtr sched, ConfigCheckerPtr cfgcheck,
48  bool strict_mode);
49 
50  CoreUtils(const CoreUtils &) = delete;
51  CoreUtils(CoreUtils &&) = delete;
52  CoreUtils &operator=(const CoreUtils &) = delete;
53  CoreUtils &operator=(CoreUtils &&) = delete;
54  virtual ~CoreUtils()
55  {
56  }
57 
58  zmqpp::context &zmqpp_context();
61  Kernel &kernel();
62  DBPtr database();
64 
68  CoreAPI core_api();
69 
73  bool is_strict() const;
74 
75  private:
80 
84  friend class Kernel;
85 };
86 }
Leosac::CoreUtils::core_api
CoreAPI core_api()
Instantiate a new, ready to use, CoreAPI object.
Definition: CoreUtils.cpp:68
Leosac::CoreUtils::kernel
Kernel & kernel()
Definition: CoreUtils.cpp:62
Leosac::ConfigCheckerPtr
std::shared_ptr< ConfigChecker > ConfigCheckerPtr
Definition: LeosacFwd.hpp:32
zmqpp
Definition: CoreUtils.hpp:27
Leosac::CoreUtils::CoreUtils
CoreUtils()
Definition: CoreUtils.cpp:34
LeosacFwd.hpp
Leosac::DBPtr
std::shared_ptr< odb::database > DBPtr
Definition: db_fwd.hpp:31
Leosac::CoreUtils::scheduler
Scheduler & scheduler()
Definition: CoreUtils.cpp:40
Leosac::CoreUtils::kptr_
Kernel * kptr_
Definition: CoreUtils.hpp:76
Leosac::CoreUtils::is_strict
bool is_strict() const
Are we running in strict mode ?
Definition: CoreUtils.cpp:57
Leosac::CoreUtils::scheduler_
SchedulerPtr scheduler_
Definition: CoreUtils.hpp:77
Leosac
This is the header file for a generated source file, GitSHA1.cpp.
Definition: APIStatusCode.hpp:22
Leosac::CoreUtils::~CoreUtils
virtual ~CoreUtils()
Definition: CoreUtils.hpp:54
Leosac::ConfigChecker
This class is here to help check the validity of the configuration.
Definition: ConfigChecker.hpp:46
ServiceFwd.hpp
Leosac::Scheduler
This is a scheduler that is used internally to schedule asynchronous / long running tasks.
Definition: Scheduler.hpp:47
Leosac::ServiceRegistry
A class that manages services.
Definition: ServiceRegistry.hpp:110
Leosac::CoreUtils::database
DBPtr database()
Definition: CoreUtils.cpp:52
CoreAPI.hpp
Leosac::CoreUtils
This class is part of Leosac::Kernel, but it only exposes thread-safe functionalities that may be use...
Definition: CoreUtils.hpp:43
Leosac::CoreUtils::operator=
CoreUtils & operator=(const CoreUtils &)=delete
Leosac::Kernel
Core of Leosac.
Definition: kernel.hpp:73
Leosac::SchedulerPtr
std::shared_ptr< Scheduler > SchedulerPtr
Definition: LeosacFwd.hpp:31
db_fwd.hpp
Leosac::CoreUtils::config_checker
ConfigChecker & config_checker()
Definition: CoreUtils.cpp:46
Leosac::CoreUtils::config_checker_
ConfigCheckerPtr config_checker_
Definition: CoreUtils.hpp:78
Leosac::CoreUtils::zmqpp_context
zmqpp::context & zmqpp_context()
Definition: CoreUtils.cpp:73
Leosac::CoreUtils::service_registry
ServiceRegistry & service_registry()
Definition: CoreUtils.cpp:78
Leosac::CoreAPI
CoreAPI is a class for interact with Leosac's core.
Definition: CoreAPI.hpp:47
Leosac::CoreUtils::strict_mode_
bool strict_mode_
Definition: CoreUtils.hpp:79