NEST main@caf0ae8
 
Loading...
Searching...
No Matches
module_manager.h
Go to the documentation of this file.
1/*
2 * module_manager.h
3 *
4 * This file is part of NEST.
5 *
6 * Copyright (C) 2004 The NEST Initiative
7 *
8 * NEST is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * NEST is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with NEST. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23#ifndef MODULE_MANAGER_H
24#define MODULE_MANAGER_H
25
26// Generated includes:
27#include "config.h"
28
29// C++ includes:
30#include <map>
31#include <string>
32
33// Includes from nestkernel:
34#include "manager_interface.h"
35
36// DynamicLoaderModule defined only if libltdl is available
37#ifdef HAVE_LIBLTDL
38#include <ltdl.h>
39
40namespace nest
41{
42class NESTExtensionInterface;
43
44class ModuleManager : public ManagerInterface
45{
46public:
48 ~ModuleManager() override;
49
50 void initialize( const bool ) override;
51
53 void finalize( const bool adjust_number_of_threads_or_rng_only ) override;
54
57
58 void get_status( Dictionary& ) override;
59 void set_status( const Dictionary& ) override;
60
61 void install( const std::string& name );
62
63private:
64 struct ModuleMapEntry_
65 {
66 ModuleMapEntry_() = default;
67 ModuleMapEntry_( lt_dlhandle hndl, NESTExtensionInterface* ext )
68 : handle( hndl )
69 , extension( ext )
70 {
71 }
72
73 lt_dlhandle handle;
74 NESTExtensionInterface* extension;
75 };
76
77 std::map< std::string, ModuleMapEntry_ > modules_;
78};
79}
80
81#else
82
83#include "exceptions.h"
84
85namespace nest
86{
88{
89public:
91 {
92 }
93 ~ModuleManager() override
94 {
95 }
96
97 void
98 initialize( const bool ) override
99 {
100 }
101 void
102 finalize( const bool ) override
103 {
104 }
105
106 void
110
111 void
113 {
114 }
115 void
116 set_status( const Dictionary& ) override
117 {
118 }
119
120 void
121 install( const std::string& )
122 {
123 throw KernelException( "Dynamic modules not supported without libltdl." );
124 }
125};
126}
127
128#endif // HAVE_LIBLTDL
129
130#endif // #ifndef MODULE_MANAGER_H
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
Base class for all Kernel exceptions.
Definition exceptions.h:65
Interface for kernel manager classes.
Definition manager_interface.h:46
Definition module_manager.h:88
void get_status(Dictionary &) override
Retrieve the status of the manager.
Definition module_manager.h:112
void reinitialize_dynamic_modules()
Definition module_manager.h:107
void set_status(const Dictionary &) override
Set the status of the manager.
Definition module_manager.h:116
ModuleManager()
Definition module_manager.h:90
void install(const std::string &)
Definition module_manager.h:121
~ModuleManager() override
Definition module_manager.h:93
void initialize(const bool) override
Prepare manager for operation.
Definition module_manager.h:98
void finalize(const bool) override
Take down manager after operation.
Definition module_manager.h:102
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33