UFO
ObsFunctionBase.cc
Go to the documentation of this file.
1
/*
2
* (C) Copyright 2019 UCAR
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
*/
7
8
#include "
ufo/filters/obsfunctions/ObsFunctionBase.h
"
9
10
#include <map>
11
#include <string>
12
13
#include "oops/util/abor1_cpp.h"
14
#include "oops/util/Logger.h"
15
16
namespace
ufo
{
17
18
// -----------------------------------------------------------------------------
19
20
ObsFunctionFactory::ObsFunctionFactory
(
const
std::string & name) {
21
if
(
getMakers
().find(name) !=
getMakers
().end()) {
22
oops::Log::error() << name <<
" already registered in ufo::ObsFunctionFactory."
<< std::endl;
23
ABORT(
"Element already registered in ufo::ObsFunctionFactory."
);
24
}
25
getMakers
()[name] =
this
;
26
}
27
28
// -----------------------------------------------------------------------------
29
30
ObsFunctionBase
*
ObsFunctionFactory::create
(
const
Variable
& var) {
31
oops::Log::trace() <<
"ObsFunctionBase::create starting"
<< std::endl;
32
typename
std::map<std::string, ObsFunctionFactory*>::iterator jloc =
33
getMakers
().find(var.
variable
());
34
if
(jloc ==
getMakers
().end()) {
35
oops::Log::error() << var.
variable
() <<
" does not exist in ufo::ObsFunctionFactory."
36
<< std::endl;
37
ABORT(
"Element does not exist in ufo::ObsFunctionFactory."
);
38
}
39
ObsFunctionBase
* ptr = jloc->second->make(var.
options
());
40
oops::Log::trace() <<
"ObsFunctionBase::create done"
<< std::endl;
41
return
ptr;
42
}
43
44
// -----------------------------------------------------------------------------
45
46
bool
ObsFunctionFactory::functionExists
(
const
std::string & name) {
47
return
(
getMakers
().find(name) !=
getMakers
().end());
48
}
49
50
// -----------------------------------------------------------------------------
51
52
}
// namespace ufo
ObsFunctionBase.h
ufo::ObsFunctionFactory::functionExists
static bool functionExists(const std::string &)
Definition:
ObsFunctionBase.cc:46
ufo::ObsFunctionBase
Base class for computing functions on observation data.
Definition:
ObsFunctionBase.h:26
ufo::Variable::options
const eckit::LocalConfiguration & options() const
Definition:
Variable.h:43
ufo
Definition:
RunCRTM.h:27
ufo::ObsFunctionFactory::ObsFunctionFactory
ObsFunctionFactory(const std::string &)
Definition:
ObsFunctionBase.cc:20
ufo::ObsFunctionFactory::getMakers
static std::map< std::string, ObsFunctionFactory * > & getMakers()
Definition:
ObsFunctionBase.h:51
ufo::Variable::variable
const std::string & variable() const
Definition:
Variable.cc:100
ufo::Variable
Definition:
Variable.h:23
ufo::ObsFunctionFactory::create
static ObsFunctionBase * create(const Variable &)
Definition:
ObsFunctionBase.cc:30
fv3-bundle
ufo
src
ufo
filters
obsfunctions
ObsFunctionBase.cc
Generated on Sat Oct 24 2020 19:14:55 for UFO by
1.8.18