UFO
ProfileCheckBase.cc
Go to the documentation of this file.
1 /*
2  * (C) Crown copyright 2020, Met Office
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 
9 
10 #include <map>
11 #include <string>
12 
13 #include "oops/util/Logger.h"
14 
15 namespace ufo {
17  : options_(options)
18  {}
19 
20  ProfileCheckFactory::ProfileCheckFactory(const std::string & name)
21  {
22  if (getMakers().find(name) != getMakers().end())
23  throw eckit::BadParameter(name + " already registered in ufo::ProfileCheckFactory.", Here());
24  getMakers()[name] = this;
25  }
26 
27  std::unique_ptr<ProfileCheckBase>
28  ProfileCheckFactory::create(const std::string& name,
30  {
31  oops::Log::trace() << "ProfileCheckBase::create starting" << std::endl;
32  typename std::map<std::string, ProfileCheckFactory*>::iterator jloc =
33  getMakers().find(name);
34  if (jloc == getMakers().end()) {
35  std::string makerNameList;
36  for (const auto& makerDetails : getMakers()) makerNameList += "\n " + makerDetails.first;
37  throw eckit::BadParameter(name + " does not exist in ufo::ProfileCheckFactory. "
38  "Possible values:" + makerNameList, Here());
39  }
40  std::unique_ptr<ProfileCheckBase> ptr = jloc->second->make(options);
41  oops::Log::trace() << "ProfileCheckBase::create done" << std::endl;
42  return ptr;
43  }
44 } // namespace ufo
45 
Options controlling the operation of the ConventionalProfileProcessing filter.
ProfileCheckBase(const ConventionalProfileProcessingParameters &options)
ProfileCheckFactory(const std::string &)
static std::unique_ptr< ProfileCheckBase > create(const std::string &, const ConventionalProfileProcessingParameters &)
static std::map< std::string, ProfileCheckFactory * > & getMakers()
Definition: RunCRTM.h:27