Debian Codegraph @

src/atlas_f/internals/Library.cc

raw
1 /*
2 * (C) Copyright 2013 ECMWF.
3 *
4 * This software is licensed under the terms of the Apache Licence Version 2.0
5 * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6 * In applying this licence, ECMWF does not waive the privileges and immunities
7 * granted to it by virtue of its status as an intergovernmental organisation
8 * nor does it submit to any jurisdiction.
9 */
10
11 #include "eckit/eckit_version.h"
12
13 #include "atlas/library/Library.h"
14 #include "atlas_f/internals/Library.h"
15
16 //----------------------------------------------------------------------------------------------------------------------
17 extern "C" {
18
19 void atlas__atlas_init_noargs() {
20 atlas::initialize();
21 }
22
23 void atlas__atlas_finalize() {
24 atlas::finalize();
25 }
26
27 const char* atlas__eckit_version() {
28 return eckit_version();
29 }
30
31 const char* atlas__eckit_git_sha1() {
32 return eckit_git_sha1();
33 }
34
35 const char* atlas__eckit_git_sha1_abbrev(int length) {
36 static std::string git_sha1(eckit_git_sha1());
37 if (git_sha1.empty()) {
38 git_sha1 = "not available";
39 }
40 else {
41 git_sha1 = git_sha1.substr(0, std::min(length, 40));
42 }
43 return git_sha1.c_str();
44 }
45
46 const char* atlas__atlas_version() {
47 static std::string str = atlas::Library::instance().version();
48 return str.c_str();
49 }
50
51 const char* atlas__atlas_git_sha1() {
52 static std::string str = atlas::Library::instance().gitsha1();
53 return str.c_str();
54 }
55
56 const char* atlas__atlas_git_sha1_abbrev(int length) {
57 static std::string s = atlas::Library::instance().gitsha1(length);
58 return s.c_str();
59 }
60
61 } // extern "C"