Disk ARchive  2.6.8
Full featured and portable backup and archiving tool
get_version.hpp
Go to the documentation of this file.
1 /*********************************************************************/
2 // dar - disk archive - a backup/restoration program
3 // Copyright (C) 2002-2020 Denis Corbin
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 //
19 // to contact the author : http://dar.linux.free.fr/email.html
20 /*********************************************************************/
21 
25 
26 
27 
28 #ifndef GET_VERSION_HPP
29 #define GET_VERSION_HPP
30 
31 #include "../my_config.h"
32 
33 extern "C"
34 {
35 #if MUTEX_WORKS
36 #if HAVE_PTHREAD_H
37 #include <pthread.h>
38 #endif
39 #endif
40 }
41 
42 #include <string>
43 #include "integers.hpp"
44 
46 
47 namespace libdar
48 {
49 
52 
54  constexpr U_I LIBDAR_COMPILE_TIME_MAJOR = 6;
56  constexpr U_I LIBDAR_COMPILE_TIME_MEDIUM = 2;
58  constexpr U_I LIBDAR_COMPILE_TIME_MINOR = 2;
59 
60 
62  // LIBDAR INITIALIZATION METHODS //
63  // //
64  // A FUNCTION OF THE get_version*() FAMILY *MUST* BE CALLED //
65  // BEFORE ANY OTHER FUNCTION OF THIS LIBRARY //
66  // //
67  // CLIENT PROGRAM MUST CHECK THAT THE MAJOR NUMBER RETURNED //
68  // BY THIS CALL IS NOT GREATER THAN THE VERSION USED AT COMPILATION //
69  // TIME. IF SO, THE PROGRAM MUST ABORT AND RETURN A WARNING TO THE //
70  // USER TELLING THE DYNAMICALLY LINKED VERSION IS TOO RECENT AND NOT //
71  // COMPATIBLE WITH THIS SOFTWARE. THE MESSAGE MUST INVITE THE USER //
72  // TO UPGRADE HIS SOFTWARE WITH A MORE RECENT VERSION COMPATIBLE WITH //
73  // THIS LIBDAR RELEASE. //
75 
77 
86  extern void get_version(U_I & major, U_I & medium, U_I & minor, bool init_libgcrypt = true);
87 
88 
90 
98  extern void get_version(U_I & major, U_I & medium, U_I & minor, bool init_libgcrypt, bool init_gpgme);
99 
101  extern void get_version(bool init_libgcrypt = true);
102 
104  // CLOSING/CLEANING LIBDAR //
106 
107  // while libdar has only a single boolean as global variable
108  // that defines whether the library is initialized or not
109  // it must proceed to mutex, and dependent libraries initializations
110  // (liblzo, libgcrypt, etc.), which is done during the get_version() call
111  // Some library also need to clear some data so the following call
112  // is provided in that aim and must be called when libdar will no more
113  // be used by the application.
114 
115  extern void close_and_clean();
116 
118  // THREAD CANCELLATION ROUTINES //
120 
121 #if MUTEX_WORKS
122 
129  extern void cancel_thread(pthread_t tid, bool immediate = true, U_64 flag = 0);
130 
132 
135  extern bool cancel_status(pthread_t tid);
136 
138 
142  extern bool cancel_clear(pthread_t tid);
143 
145  extern U_I get_thread_count();
146 #endif
147 
148 
150 
151 } // end of namespace
152 
153 #endif
libdar::LIBDAR_COMPILE_TIME_MEDIUM
constexpr U_I LIBDAR_COMPILE_TIME_MEDIUM
libdar Medium version defined at compilation time
Definition: get_version.hpp:56
integers.hpp
are defined here basic integer types that tend to be portable
libdar::get_version
void get_version(U_I &major, U_I &medium, U_I &minor, bool init_libgcrypt=true)
return the libdar version, and make libdar initialization (may throw Exceptions)
libdar::LIBDAR_COMPILE_TIME_MAJOR
constexpr U_I LIBDAR_COMPILE_TIME_MAJOR
libdar Major version defined at compilation time
Definition: get_version.hpp:54
libdar::LIBDAR_COMPILE_TIME_MINOR
constexpr U_I LIBDAR_COMPILE_TIME_MINOR
libdar Minor version defined at compilation time
Definition: get_version.hpp:58
libdar
libdar namespace encapsulate all libdar symbols
Definition: archive.hpp:46