@@ -128,7 +128,9 @@ BranchConfig BranchConfig::CloneAndMerge(const BranchConfig& attached) const {
128128 result.AddField <bool >(name2 + " _" + field.first , name2 + " : " + field.second .title_ );
129129 }
130130
131- result.AddField <int >(" matching_case" , " 0 - both present, 1 - only first present, 2 - only second present" );
131+ if (type1 != DetType::kEventHeader && attached.GetType () != DetType::kEventHeader ) {
132+ result.AddField <int >(" matching_case" , " 0 - both present, 1 - only first present, 2 - only second present" );
133+ }
132134
133135 return result;
134136}
@@ -150,6 +152,31 @@ std::vector<std::string> VectorConfig<T>::SplitString(const std::string& input)
150152 return result;
151153}
152154
155+ template <typename T>
156+ void VectorConfig<T>::RemoveField(const std::string& name, int id) {
157+ auto iter = map_.find (name);
158+ map_.erase (iter);
159+ for (auto & m : map_) {
160+ if (m.second .id_ > id) {
161+ m.second .id_ --;
162+ }
163+ }
164+ }
165+
166+ void BranchConfig::RemoveField (const std::string& name) {
167+ if (!HasField (name)) {
168+ throw std::runtime_error (" BranchConfig::RemoveField(): no field " + name + " to be removed" );
169+ }
170+ auto field_type = GetFieldType (name);
171+ auto field_id = GetFieldId (name);
172+ if (field_id < 0 ) {
173+ throw std::runtime_error (" BranchConfig::RemoveField(): default field " + name + " cannot be removed" );
174+ }
175+ if (field_type == Types::kInteger ) VectorConfig<int >::RemoveField (name, field_id);
176+ if (field_type == Types::kFloat ) VectorConfig<float >::RemoveField (name, field_id);
177+ if (field_type == Types::kBool ) VectorConfig<bool >::RemoveField (name, field_id);
178+ }
179+
153180void BranchConfig::GuaranteeFieldNameVacancy (const std::string& name) const {
154181 if (HasField (name)) {
155182 throw std::runtime_error (" BranchConfig::GuaranteeFieldNameVacancy(): field " + name + " already exists" );
0 commit comments