IODA Bundle
CodecOptimizer.cc
Go to the documentation of this file.
1 /*
2  * (C) Copyright 1996-2012 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 ///
12 /// \file CodecOptimizer.cc
13 ///
14 /// @author Piotr Kuchta, Jan 2010
15 
16 #include "eckit/config/Resource.h"
17 #include "eckit/utils/StringTools.h"
19 
20 //
21 
22 namespace odc {
23 namespace codec {
24 
25 //----------------------------------------------------------------------------------------------------------------------
26 
27 std::map<api::ColumnType, std::string> CodecOptimizer::defaultCodec_;
28 
30 {
31  if (defaultCodec_.empty()) {
32  defaultCodec_[api::REAL] = "short_real2";
33  defaultCodec_[api::DOUBLE] = "long_real";
34  defaultCodec_[api::STRING] = "chars";
35  defaultCodec_[api::INTEGER] = "int32";
36  defaultCodec_[api::BITFIELD] = "int32";
37 
38  typedef eckit::StringTools S;
39  std::vector<std::string> mappings (S::split(",", eckit::Resource<std::string>("$ODC_DEFAULT_CODEC", "")));
40 
41  for (size_t i = 0; i < mappings.size(); ++i)
42  {
43  std::vector<std::string> a(S::split(":", mappings[i]));
44  ASSERT("Wrong format of $ODC_DEFAULT_CODEC" && a.size() == 2);
46  }
47  }
48 }
49 
50 //----------------------------------------------------------------------------------------------------------------------
51 
52 } // namespace core
53 } // namespace odc
StringTools S
static std::map< api::ColumnType, std::string > defaultCodec_
api::ColumnType type() const
Definition: Column.h:64
std::string trim(const std::string &str)
@ BITFIELD
Definition: ColumnType.h:27
Definition: ColumnInfo.h:23