lib_settings.h
Go to the documentation of this file.
1 /*
2  -------------------------------------------------------------------
3 
4  Copyright (C) 2006-2020, Andrew W. Steiner
5 
6  This file is part of O2scl.
7 
8  O2scl 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 3 of the License, or
11  (at your option) any later version.
12 
13  O2scl 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 O2scl. If not, see <http://www.gnu.org/licenses/>.
20 
21  -------------------------------------------------------------------
22 */
23 #ifndef O2SCL_LIB_SETTINGS_H
24 #define O2SCL_LIB_SETTINGS_H
25 #include <iostream>
26 #include <string>
27 
28 #include <o2scl/convert_units.h>
29 
30 /** \file lib_settings.h
31  \brief Library settings class and global settings object
32 */
33 
34 /** \brief The main \o2 namespace
35 
36  By default, all \o2 classes and functions which are not listed as
37  being in one of \o2's smaller specialized namespaces are in this
38  namespace.
39 
40  \comment
41  \htmlonly
42  For a full list of all the
43  O<span style='position: relative; top: 0.3em; font-size: 0.8em'>2</span>scl
44  classes, see
45  <a href="annotated.html">Data Structures</a>.
46  \endhtmlonly
47  \endcomment
48 
49  This namespace documentation is in the file
50  <tt>src/base/lib_settings.h</tt>
51 */
52 /*
53  \comment
54  For a full list of all the
55  O<span style='position: relative; top: 0.3em; font-size: 0.8em'>2</span>scl
56  global objects which are not
57  classes, see <a href="globals.html">Files::Globals</a>.
58  \endcomment
59 */
60 namespace o2scl {
61 }
62 
63 #ifndef DOXYGEN_NO_O2NS
64 namespace o2scl {
65 #endif
66 
67  /** \brief A class to manage global library settings
68 
69  This class reports global \o2 settings such as the current
70  version, whether or not sub-libraries were installed and what
71  the current parent directory for \o2 data files is.
72 
73  A global object of this type is defined in
74  <tt>lib_settings.h</tt> named \ref o2scl_settings .
75  */
77 
78  public:
79 
81 
83 
84  /** \brief Return the data directory */
85  std::string get_data_dir() {
86  return data_dir;
87  }
88 
89  /** \brief Set the data directory */
90  int set_data_dir(std::string dir) {
91  data_dir=dir;
92  return 0;
93  }
94 
95  /// Return true if the EOS library was installed
96  bool eos_installed();
97 
98  /// Return true if the particle library was installed
99  bool part_installed();
100 
101  /// Return true if \o2 was installed with HDF support
102  bool hdf_support();
103 
104  /// Return true if \o2 was installed with OpenMP support
105  bool openmp_support();
106 
107  /// Return true if \o2 was installed with support for GSL V2.0+
108  bool gsl2_support();
109 
110  /// Return true if \o2 was installed with Armadillo support
111  bool armadillo_support();
112 
113  /// Return true if \o2 was installed with Eigen support
114  bool eigen_support();
115 
116  /// Return true if \o2 was installed with FFTW support
117  bool fftw_support();
118 
119  /// Return true if \o2 was installed with Python support
120  bool python_support();
121 
122  /// Return true if \o2 was installed with HDF5 compression support
124 
125  /** \brief Return system type determined by autoconf
126 
127  Returns either "OSX", "Linux" or "unknown".
128  */
129  std::string system_type();
130 
131  /** \brief Return true if range checking was turned on during
132  installation (default true)
133  */
134  bool range_check();
135 
136  /// Return the time \o2 was compiled
137  std::string time_compiled();
138 
139  /// Return the date \o2 was compiled
140  std::string date_compiled();
141 
142  /// Return the library version
143  std::string o2scl_version();
144 
145  /// Report some of the settings from config.h
146  void config_h_report();
147 
148  /// Obtain HDF5 version
149  void hdf5_lib_version(unsigned &maj, unsigned &min, unsigned &rel);
150 
151  /// Obtain HDF5 version
152  void hdf5_header_version(unsigned &maj, unsigned &min, unsigned &rel);
153 
154  /// \name Miscellaneous config.h string properties
155  //@{
156  std::string o2scl_name();
157  std::string o2scl_package();
158  std::string o2scl_bugreport();
159  std::string o2scl_string();
160  std::string o2scl_tarname();
161  //@}
162 
163  /// Default convert units object
165 
166  /// Get the global convert_units object
168  return *cup;
169  }
170 
171  /// Set the global convert_units object
173  cup=&cu;
174  }
175 
176  protected:
177 
178 #ifndef DOXYGEN_INTERNAL
179 
180  /// The present data directory
181  std::string data_dir;
182 
183  /// Pointer to current \ref convert_units object
185 
186 #endif
187 
188  };
189 
190  /** \brief The global library settings object
191 
192  This global object is used by \ref polylog and some of the \o2e
193  classes to find data files. It may also be used by the end-user
194  to probe details of the \o2 installation.
195  */
197 
198 #ifndef DOXYGEN_NO_O2NS
199 }
200 #endif
201 
202 #endif
o2scl::lib_settings_class::part_installed
bool part_installed()
Return true if the particle library was installed.
o2scl::lib_settings_class::date_compiled
std::string date_compiled()
Return the date O<span style='position: relative; top: 0.3em; font-size: 0.8em'>2</span>scl O$_2$scl...
o2scl::lib_settings_class::range_check
bool range_check()
Return true if range checking was turned on during installation (default true)
o2scl::lib_settings_class::time_compiled
std::string time_compiled()
Return the time O<span style='position: relative; top: 0.3em; font-size: 0.8em'>2</span>scl O$_2$scl...
o2scl::lib_settings_class::get_data_dir
std::string get_data_dir()
Return the data directory.
Definition: lib_settings.h:85
o2scl
The main O<span style='position: relative; top: 0.3em; font-size: 0.8em'>2</span>scl O$_2$scl names...
Definition: anneal.h:42
o2scl::lib_settings_class
A class to manage global library settings.
Definition: lib_settings.h:76
o2scl::lib_settings_class::get_convert_units
convert_units< double > & get_convert_units()
Get the global convert_units object.
Definition: lib_settings.h:167
o2scl::lib_settings_class::config_h_report
void config_h_report()
Report some of the settings from config.h.
o2scl::lib_settings_class::o2scl_version
std::string o2scl_version()
Return the library version.
o2scl::lib_settings_class::eos_installed
bool eos_installed()
Return true if the EOS library was installed.
o2scl::o2scl_settings
lib_settings_class o2scl_settings
The global library settings object.
o2scl::lib_settings_class::hdf5_header_version
void hdf5_header_version(unsigned &maj, unsigned &min, unsigned &rel)
Obtain HDF5 version.
o2scl::lib_settings_class::cup
convert_units< double > * cup
Pointer to current convert_units object.
Definition: lib_settings.h:184
o2scl::lib_settings_class::system_type
std::string system_type()
Return system type determined by autoconf.
o2scl::lib_settings_class::data_dir
std::string data_dir
The present data directory.
Definition: lib_settings.h:181
o2scl::lib_settings_class::hdf5_lib_version
void hdf5_lib_version(unsigned &maj, unsigned &min, unsigned &rel)
Obtain HDF5 version.
o2scl::lib_settings_class::hdf5_compression_support
bool hdf5_compression_support()
Return true if O<span style='position: relative; top: 0.3em; font-size: 0.8em'>2</span>scl O$_2$scl ...
o2scl::lib_settings_class::def_cu
convert_units< double > def_cu
Default convert units object.
Definition: lib_settings.h:164
o2scl::lib_settings_class::hdf_support
bool hdf_support()
Return true if O<span style='position: relative; top: 0.3em; font-size: 0.8em'>2</span>scl O$_2$scl ...
o2scl::lib_settings_class::python_support
bool python_support()
Return true if O<span style='position: relative; top: 0.3em; font-size: 0.8em'>2</span>scl O$_2$scl ...
o2scl::lib_settings_class::set_convert_units
void set_convert_units(convert_units< double > &cu)
Set the global convert_units object.
Definition: lib_settings.h:172
o2scl::lib_settings_class::fftw_support
bool fftw_support()
Return true if O<span style='position: relative; top: 0.3em; font-size: 0.8em'>2</span>scl O$_2$scl ...
o2scl::convert_units< double >
o2scl::lib_settings_class::set_data_dir
int set_data_dir(std::string dir)
Set the data directory.
Definition: lib_settings.h:90
o2scl::lib_settings_class::gsl2_support
bool gsl2_support()
Return true if O<span style='position: relative; top: 0.3em; font-size: 0.8em'>2</span>scl O$_2$scl ...
o2scl::lib_settings_class::openmp_support
bool openmp_support()
Return true if O<span style='position: relative; top: 0.3em; font-size: 0.8em'>2</span>scl O$_2$scl ...
o2scl::lib_settings_class::eigen_support
bool eigen_support()
Return true if O<span style='position: relative; top: 0.3em; font-size: 0.8em'>2</span>scl O$_2$scl ...
o2scl::lib_settings_class::armadillo_support
bool armadillo_support()
Return true if O<span style='position: relative; top: 0.3em; font-size: 0.8em'>2</span>scl O$_2$scl ...

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).