1 #ifndef MHO_SamplerLabeler_HH__
2 #define MHO_SamplerLabeler_HH__
40 fChannelLabelKey =
"channel_label";
41 fRefSamplerIndexKey =
"ref_sampler_index";
42 fRemSamplerIndexKey =
"rem_sampler_index";
54 fRefSamplerChanSets = channel_sets;
64 fRemSamplerChanSets = channel_sets;
79 ConstructChannelToSamplerIDMap(fRefSamplerChanSets, fRefChanToSamplerID);
80 ConstructChannelToSamplerIDMap(fRemSamplerChanSets, fRemChanToSamplerID);
86 auto chan_axis_ptr = &(std::get< CHANNEL_AXIS >(*in));
87 std::size_t nchans = chan_axis_ptr->GetSize();
89 for(std::size_t ch = 0; ch < nchans; ch++)
91 std::string chan_label =
"";
92 chan_axis_ptr->RetrieveIndexLabelKeyValue(ch, fChannelLabelKey, chan_label);
94 if(fRefChanToSamplerID.find(chan_label) != fRefChanToSamplerID.end())
96 int ref_id = fRefChanToSamplerID[chan_label];
97 chan_axis_ptr->InsertIndexLabelKeyValue(ch, fRefSamplerIndexKey, ref_id);
99 if(fRemChanToSamplerID.find(chan_label) != fRemChanToSamplerID.end())
101 int rem_id = fRemChanToSamplerID[chan_label];
102 chan_axis_ptr->InsertIndexLabelKeyValue(ch, fRemSamplerIndexKey, rem_id);
112 std::vector< std::string > fRefSamplerChanSets;
113 std::vector< std::string > fRemSamplerChanSets;
114 std::map< std::string, int > fRefChanToSamplerID;
115 std::map< std::string, int > fRemChanToSamplerID;
118 std::string fChannelLabelKey;
119 std::string fRefSamplerIndexKey;
120 std::string fRemSamplerIndexKey;
129 void ConstructChannelToSamplerIDMap(std::vector< std::string >& chan_set, std::map< std::string, int >& chan2id)
132 for(std::size_t sampler_id = 0; sampler_id < chan_set.size(); sampler_id++)
134 std::string chans = chan_set[sampler_id];
135 std::vector< std::string > split_chans = SplitChannelLabels(chans);
136 for(
auto it = split_chans.begin(); it != split_chans.end(); it++)
138 chan2id[*it] = (int)sampler_id;
149 std::vector< std::string > SplitChannelLabels(std::string channels)
151 std::vector< std::string > split_chans;
155 if((channels.find(
',') != std::string::npos))
168 for(std::size_t i = 0; i < channels.size(); i++)
170 split_chans.push_back(std::string(1, channels[i]));
Class MHO_SamplerLabeler.
Definition: MHO_SamplerLabeler.hh:35
virtual bool ExecuteInPlace(XArrayType *in) override
Function ExecuteInPlace - actual implementation, map channel label (e.g. 'a', 'b',...
Definition: MHO_SamplerLabeler.hh:76
void SetReferenceStationSamplerChannelSets(const std::vector< std::string > &channel_sets)
Setter for reference station sampler channel sets.
Definition: MHO_SamplerLabeler.hh:52
virtual ~MHO_SamplerLabeler()
Definition: MHO_SamplerLabeler.hh:45
MHO_SamplerLabeler()
Definition: MHO_SamplerLabeler.hh:37
void SetRemoteStationSamplerChannelSets(const std::vector< std::string > &channel_sets)
Setter for remote station sampler channel sets.
Definition: MHO_SamplerLabeler.hh:62
Class MHO_Tokenizer.
Definition: MHO_Tokenizer.hh:24
void SetUseMulticharacterDelimiterFalse()
Definition: MHO_Tokenizer.cc:40
void SetIncludeEmptyTokensFalse()
Definition: MHO_Tokenizer.cc:30
void SetString(const std::string *aString)
Definition: MHO_Tokenizer.cc:65
void GetTokens(std::vector< std::string > *tokens)
Definition: MHO_Tokenizer.cc:75
void SetRemoveLeadingTrailingWhitespaceTrue()
Setter for remove leading trailing whitespace true.
Definition: MHO_Tokenizer.cc:55
void SetDelimiter(const std::string &aDelim)
Definition: MHO_Tokenizer.cc:70
Class MHO_UnaryOperator.
Definition: MHO_UnaryOperator.hh:24
Definition: MHO_AdhocFlagging.hh:18