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"
18
#include "
odc/codec/CodecOptimizer.h
"
19
20
//
21
22
namespace
odc
{
23
namespace
codec {
24
25
//----------------------------------------------------------------------------------------------------------------------
26
27
std::map<api::ColumnType, std::string>
CodecOptimizer::defaultCodec_
;
28
29
CodecOptimizer::CodecOptimizer
()
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);
45
defaultCodec_
[
core::Column::type
(
S::trim
(
a
[0]))] =
S::trim
(
a
[1]);
46
}
47
}
48
}
49
50
//----------------------------------------------------------------------------------------------------------------------
51
52
}
// namespace core
53
}
// namespace odc
CodecOptimizer.h
S
StringTools S
Definition:
TextReaderIterator.cc:31
odc::codec::CodecOptimizer::CodecOptimizer
CodecOptimizer()
Definition:
CodecOptimizer.cc:29
odc::codec::CodecOptimizer::defaultCodec_
static std::map< api::ColumnType, std::string > defaultCodec_
Definition:
CodecOptimizer.h:36
odc::core::Column::type
api::ColumnType type() const
Definition:
Column.h:64
dcmip_initial_conditions_test_1_2_3::a
real(8), parameter a
Definition:
dcmip_initial_conditions_test_1_2_3_v5.f90:61
ioda::test::trim
std::string trim(const std::string &str)
Definition:
ioda/test/ioda/ObsDataVector.h:57
odc::api::INTEGER
@ INTEGER
Definition:
ColumnType.h:24
odc::api::REAL
@ REAL
Definition:
ColumnType.h:25
odc::api::BITFIELD
@ BITFIELD
Definition:
ColumnType.h:27
odc::api::DOUBLE
@ DOUBLE
Definition:
ColumnType.h:28
odc::api::STRING
@ STRING
Definition:
ColumnType.h:26
odc
Definition:
ColumnInfo.h:23
proc_gsi_ncdiag.i
i
Definition:
proc_gsi_ncdiag.py:155
odc
src
odc
codec
CodecOptimizer.cc
Generated on Fri Aug 20 2021 11:49:02 for IODA Bundle by
1.9.1