MCPcopy Create free account
hub / github.com/OriginQ/QPanda-2 / push_back_node

Method push_back_node

Core/QuantumCircuit/QNodeManager.cpp:34–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34void QNodeManager::push_back_node(std::shared_ptr<QNode> node)
35{
36 if (!node)
37 {
38 QCERR("node is null");
39 throw std::runtime_error("node is null");
40 }
41
42 if (m_parent == node.get())
43 {
44 throw std::runtime_error("Error: Cann't inserte to node-self.");
45 }
46
47 auto copy_node = /*deepCopyQNode*/(node);
48
49 WriteLock wl(m_sm);
50
51 {
52 auto last_node = m_end->getPre();
53
54 Item *iter = new OriginItem();
55 iter->setNode(copy_node);
56 iter->setNext(m_end);
57 iter->setPre(last_node);
58
59 last_node->setNext(iter);
60 m_end->setPre(iter);
61 }
62}
63
64NodeIter QNodeManager::get_first_node_iter()
65{

Callers 2

pushBackNodeMethod · 0.80
pushBackNodeMethod · 0.80

Calls 5

getPreMethod · 0.80
setNodeMethod · 0.80
setNextMethod · 0.80
setPreMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected