IODA Bundle
LibOdc.cc
Go to the documentation of this file.
1 /*
2  * (C) Copyright 1996-2017 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 nor
8  * does it submit to any jurisdiction.
9  */
10 
11 /// @author Simon Smart
12 /// @date June 2017
13 
14 #include <algorithm>
15 #include <string>
16 
17 #include "odc/LibOdc.h"
18 
19 #include "odc/ODBAPIVersion.h"
20 
21 namespace odc {
22 
23 //----------------------------------------------------------------------------------------------------------------------
24 
25 LibOdc::LibOdc() : Library("odc") {}
26 
28  static LibOdc theinstance;
29  return theinstance;;
30 }
31 
32 const void* LibOdc::addr() const { return this; }
33 
34 std::string LibOdc::version() const { return ODBAPIVersion::version(); }
35 
36 std::string LibOdc::gitsha1(unsigned int count) const {
37  std::string sha1(ODBAPIVersion::gitsha1());
38  if(sha1.empty()) {
39  return "not available";
40  }
41 
42  return sha1.substr(0,std::min(count,40u));
43 }
44 
45 //----------------------------------------------------------------------------------------------------------------------
46 
47 } // namespace eckit
48 
static void count(void *counter, const double *data, size_t n)
Definition: UnitTests.cc:531
static const LibOdc & instance()
Definition: LibOdc.cc:27
virtual std::string gitsha1(unsigned int count) const
Definition: LibOdc.cc:36
virtual std::string version() const
Definition: LibOdc.cc:34
const void * addr() const
Definition: LibOdc.cc:32
static const char * version()
static const char * gitsha1()
Definition: ColumnInfo.h:23