carl  24.04
Computer ARithmetic Library
initialize.h
Go to the documentation of this file.
1 /**
2  * @file: initialize.h
3  * @author Sebastian Junges
4 
5  * This file should be the first included header from the CArL library
6  * in order to make sure some initilization is done right.
7  * Created: 20/11/2012
8  * Version: 23/11/2012
9  */
10 
11 #pragma once
12 
14 #include <carl-common/config.h>
16 
17 #ifdef USE_COCOA
18 #include <CoCoA/GlobalManager.H>
19 #endif
20 
21 #include <iomanip>
22 #include <iostream>
23 
24 namespace carl
25 {
26  /**
27  * The routine for initializing the carl library.
28  * Which is called automatically by including this header.
29  * TODO prevent outside access.
30  */
31  inline int init()
32  {
33  // initializing the logging library.
35  // initialize anything else here!
37 
38 #ifdef USE_COCOA
39  static CoCoA::GlobalManager CoCoAFoundations;
40 #endif
41 
42  return 0;
43  }
44 
45  /**
46  * Method to ensure that upon inclusion, init() is called exactly once.
47  * TODO prevent outside access.
48  */
49  inline int initialize()
50  {
51  static int initvariable = init();
52  do { (void)(initvariable); } while (false);
53  return 0;
54  }
55 
56  /// Call to initialize.
57  static int initvariable = initialize();
58  // TODO Suppress unused variable.
59 }
A small wrapper that configures logging for carl.
carl is the main namespace for the library.
int initialize()
Method to ensure that upon inclusion, init() is called exactly once.
Definition: initialize.h:49
int init()
The routine for initializing the carl library.
Definition: initialize.h:31
static int initvariable
Call to initialize.
Definition: initialize.h:57
void configureLogging()
Definition: carl-logging.h:61
static MonomialPool & getInstance()
Returns the single instance of this class by reference.
Definition: Singleton.h:45