FEDEM Model Database  R8.0
Source code of the FEDEM model database
FFaInitialisation.H
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2023 SAP SE
2 //
3 // SPDX-License-Identifier: Apache-2.0
4 //
5 // This file is part of FEDEM - https://openfedem.org
7 
13 #ifndef FFA_INITIALISATION_H
14 #define FFA_INITIALISATION_H
15 
16 
24 template<class T> class FFaInitialisation
25 {
26 public:
28  FFaInitialisation() { if (++count == 1) T::init(); }
30  ~FFaInitialisation() { --count; } // No generic uninitialization, maybe later
31 
32 private:
33  static int count;
34 };
35 
36 template<class T> int FFaInitialisation<T>::count = 0;
37 
38 #endif
Template for static class initialisation on start-up.
Definition: FFaInitialisation.H:25
static int count
Keeps track of the number of invokations for class T.
Definition: FFaInitialisation.H:33
~FFaInitialisation()
The destructor decrements the counter.
Definition: FFaInitialisation.H:30
FFaInitialisation()
The constructor invokes the T::init() method in the first call.
Definition: FFaInitialisation.H:28
void init()
Definition: FmDB.C:518