# Hurricane VLSI Database

Initializer.h
1 // -*- C++ -*-
2 //
3 // Copyright (c) BULL S.A. 2015-2018, All Rights Reserved
4 //
5 // This file is part of Hurricane.
6 //
7 // Hurricane is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Lesser General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
11 //
12 // Hurricane is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-
14 // TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the Lesser GNU General Public
18 // License along with Hurricane. If not, see
19 // <http://www.gnu.org/licenses/>.
20 //
21 // +-----------------------------------------------------------------+
22 // | H U R R I C A N E |
23 // | V L S I B a c k e n d D a t a - B a s e |
24 // | |
25 // | Authors : Jean-Paul Chaput |
26 // | E-mail : Jean-Paul.Chaput@lip6.fr |
27 // | =============================================================== |
28 // | C++ Header : "./hurricane/Initializer.h" |
29 // +-----------------------------------------------------------------+
30
31
32 #ifndef HURRICANE_INITIALIZER_H
33 #define HURRICANE_INITIALIZER_H
34
35 #include <functional>
36 #include <map>
37
38
39 namespace Hurricane {
40
41
42 // -------------------------------------------------------------------
43 // Class : "Init".
44
45 class Init {
46 public:
47 typedef std::function<void(void)> initializer_t;
48 typedef std::multimap<unsigned int,initializer_t> InitializerMap;
49 public:
50 static void destroy ();
51 static InitializerMap& initializers ();
52 static void addInitializer ( unsigned int order, initializer_t );
53 static bool runOnce ();
54 private:
55 static bool _run;
56 static InitializerMap* _initializers;
57 };
58
59
60 // -------------------------------------------------------------------
61 // Class : "Initializer".
62
63 template<typename T>
64 class Initializer {
65 public:
66 inline Initializer ( unsigned int order ) { Init::addInitializer( order, T::initialize ); }
67 };
68
69
70 } // Hurricane namespace.
71
72 #endif // HURRICANE_INITIALIZER_H
Hurricane::Initializer::Initializer
Initializer(unsigned int order)
Definition: Initializer.h:66
Hurricane
The namespace dedicated to Hurricane.
Definition: Generalities.dox:5
Hurricane::Initializer
Register a static initialization function.
Definition: Initializer.h:64

Generated by doxygen 1.8.14 on Tue Jul 21 2020 | Return to top of page

Hurricane VLSI Database | Copyright © 2000-2016 Bull S.A. All rights reserved