MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / insert

Method insert

src/openms/source/DATASTRUCTURES/Param.cpp:302–351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

300 }
301
302 void Param::ParamNode::insert(const ParamNode& node, const std::string& prefix)
303 {
304 //std::cerr << "INSERT NODE " << node.name << " (" << prefix << ")" << std::endl;
305 std::string prefix2 = prefix + node.name;
306
307 ParamNode* insert_node = this;
308 while (prefix2.find(':') != std::string::npos)
309 {
310 size_t pos = prefix2.find(':');
311 std::string local_name = prefix2.substr(0, pos);
312 //check if the node already exists
313 NodeIterator it = insert_node->findNode(local_name);
314 if (it != insert_node->nodes.end()) //exists
315 {
316 insert_node = &(*it);
317 }
318 else //create it
319 {
320 insert_node->nodes.emplace_back(local_name, "");
321 insert_node = &(insert_node->nodes.back());
322 //std::cerr << " - Created new node: " << insert_node->name << std::endl;
323 }
324 //remove prefix
325 prefix2 = prefix2.substr(local_name.size() + 1);
326 }
327
328 //check if the node already exists
329 NodeIterator it = insert_node->findNode(prefix2);
330 if (it != insert_node->nodes.end()) //append nodes and entries
331 {
332 for (ConstNodeIterator it2 = node.nodes.begin(); it2 != node.nodes.end(); ++it2)
333 {
334 it->insert(*it2);
335 }
336 for (ConstEntryIterator it2 = node.entries.begin(); it2 != node.entries.end(); ++it2)
337 {
338 it->insert(*it2);
339 }
340 if (it->description.empty() || !node.description.empty()) //replace description if not empty in new node
341 {
342 it->description = node.description;
343 }
344 }
345 else //insert it
346 {
347 Param::ParamNode tmp(node);
348 tmp.name = prefix2;
349 insert_node->nodes.push_back(tmp);
350 }
351 }
352
353 void Param::ParamNode::insert(const ParamEntry& entry, const std::string& prefix)
354 {

Callers 15

operator+Method · 0.45
addRowMethod · 0.45
addColumnMethod · 0.45
compressMethod · 0.45
GridFeatureMethod · 0.45
addMethod · 0.45
ParamEntryMethod · 0.45
setValueMethod · 0.45
setDefaultsMethod · 0.45
copySubsetMethod · 0.45
copyMethod · 0.45
parseCommandLineMethod · 0.45

Calls 11

substrMethod · 0.80
findNodeMethod · 0.80
emplace_backMethod · 0.80
backMethod · 0.80
findEntryMethod · 0.80
findMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
emptyMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected