| Disk ARchive 2.7.12 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-2023 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, see the AUTHOR file
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 = 7;
58 constexpr U_I LIBDAR_COMPILE_TIME_MINOR = 0;
59
61 // LIBDAR INITIALIZATION METHODS //
62 // //
63 // A FUNCTION OF THE get_version*() FAMILY *MUST* BE CALLED //
64 // BEFORE ANY OTHER FUNCTION OF THIS LIBRARY //
65 // //
66 // CLIENT PROGRAM MUST CHECK THAT THE MAJOR NUMBER RETURNED //
67 // BY THIS CALL IS NOT GREATER THAN THE VERSION USED AT COMPILATION //
68 // TIME. IF SO, THE PROGRAM MUST ABORT AND RETURN A WARNING TO THE //
69 // USER TELLING THE DYNAMICALLY LINKED VERSION IS TOO RECENT AND NOT //
70 // COMPATIBLE WITH THIS SOFTWARE. THE MESSAGE MUST INVITE THE USER //
71 // TO UPGRADE HIS SOFTWARE WITH A MORE RECENT VERSION COMPATIBLE WITH //
72 // THIS LIBDAR RELEASE. //
74
76
85 extern void get_version(U_I & major, U_I & medium, U_I & minor, bool init_libgcrypt = true);
86
87
89
97 extern void get_version(U_I & major, U_I & medium, U_I & minor, bool init_libgcrypt, bool init_gpgme);
98
100 extern void get_version(bool init_libgcrypt = true);
101
103 // CLOSING/CLEANING LIBDAR //
105
106 // while libdar has only a single boolean as global variable
107 // that defines whether the library is initialized or not
108 // it must proceed to mutex, and dependent libraries initializations
109 // (liblzo, libgcrypt, etc.), which is done during the get_version() call
110 // Some library also need to clear some data so the following call
111 // is provided in that aim and must be called when libdar will no more
112 // be used by the application.
113
114 extern void close_and_clean();
115
117 // THREAD CANCELLATION ROUTINES //
119
120#if MUTEX_WORKS
122
128 extern void cancel_thread(pthread_t tid, bool immediate = true, U_64 flag = 0);
129
131
134 extern bool cancel_status(pthread_t tid);
135
137
141 extern bool cancel_clear(pthread_t tid);
142
144 extern U_I get_thread_count();
145#endif
146
147
149
150} // end of namespace
151
152#endif
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_MEDIUM
constexpr U_I LIBDAR_COMPILE_TIME_MEDIUM
libdar Medium version defined at compilation time
Definition: get_version.hpp:56
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
integers.hpp
are defined here basic integer types that tend to be portable
libdar
libdar namespace encapsulate all libdar symbols
Definition: archive.hpp:47