Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
ConfigurableChannelMaskConfig.cpp
1 /*
2  * The MIT License (MIT)
3  *
4  * Copyright (c) 2016 The SKA organisation
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all
14  * copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
24 #include "cheetah/channel_mask/ConfigurableChannelMaskConfig.h"
25 
26 
27 namespace ska {
28 namespace cheetah {
29 namespace channel_mask {
30 
31 
32 template<typename NumericalRep>
33 ConfigurableChannelMaskConfig<NumericalRep>::ConfigurableChannelMaskConfig(std::string const& tag_name)
34  : BaseT(tag_name)
35  , _policy_type("replace_constant")
36  , _factory(_policy_configs)
37 {
38  this->add(_policy_configs);
39 }
40 
41 template<typename NumericalRep>
42 ConfigurableChannelMaskConfig<NumericalRep>::~ConfigurableChannelMaskConfig()
43 {
44 }
45 
46 template<typename NumericalRep>
48 {
49  return _policy_type;
50 }
51 
52 template<typename NumericalRep>
54 {
55  return _policy_type;
56 }
57 
58 template<typename NumericalRep>
59 void ConfigurableChannelMaskConfig<NumericalRep>::add_options(OptionsDescriptionEasyInit& add_options)
60 {
61  add_options
62  ("policy", boost::program_options::value<std::string>(&_policy_type)->default_value(_policy_type),
63  "the policy to apply to flagged channels. Leave blank to deactivate.");
64  BaseT::add_options(add_options);
65 }
66 
67 template<typename NumericalRep>
69 {
70  if(!_policy) {
71  _policy.reset(_policy_type==""?(new Policy<NumericalRep>()):_factory.create(_policy_type));
72  }
73  return *_policy;
74 }
75 
76 } // namespace channel_mask
77 } // namespace cheetah
78 } // namespace ska
std::string const & policy_name() const
the policy to apply to flagged channels
Configuration for the Configurable ChannelMask module.
Some limits and constants for FLDO.
Definition: Brdz.h:35
PolicyFactory Base class type.
Definition: Policy.h:41
PolicyType & policy() const
return the Policy object matching the configuration