}
}
-inst::Trigger* TriggerTrie::getTrigger(std::vector<Node>& nodes)
+inst::Trigger* TriggerTrie::getTrigger(const std::vector<Node>& nodes)
{
std::vector<Node> temp;
temp.insert(temp.begin(), nodes.begin(), nodes.end());
TriggerTrie* tt = this;
for (const Node& n : temp)
{
- std::map<TNode, TriggerTrie>::iterator itt = tt->d_children.find(n);
+ std::map<Node, TriggerTrie>::iterator itt = tt->d_children.find(n);
if (itt == tt->d_children.end())
{
return nullptr;
return tt->d_tr.empty() ? nullptr : tt->d_tr[0];
}
-void TriggerTrie::addTrigger(std::vector<Node>& nodes, inst::Trigger* t)
+void TriggerTrie::addTrigger(const std::vector<Node>& nodes, inst::Trigger* t)
{
std::vector<Node> temp(nodes.begin(), nodes.end());
std::sort(temp.begin(), temp.end());
TriggerTrie* tt = this;
for (const Node& n : temp)
{
- std::map<TNode, TriggerTrie>::iterator itt = tt->d_children.find(n);
+ std::map<Node, TriggerTrie>::iterator itt = tt->d_children.find(n);
if (itt == tt->d_children.end())
{
TriggerTrie* ttn = &tt->d_children[n];
/**
* This returns a Trigger t that is indexed by nodes, or nullptr otherwise.
*/
- Trigger* getTrigger(std::vector<Node>& nodes);
+ Trigger* getTrigger(const std::vector<Node>& nodes);
/**
* This adds t to the trie, indexed by nodes. In typical use cases, nodes i
* t->d_nodes.
*/
- void addTrigger(std::vector<Node>& nodes, Trigger* t);
+ void addTrigger(const std::vector<Node>& nodes, Trigger* t);
private:
/** The trigger at this node in the trie. */
std::vector<Trigger*> d_tr;
/** The children of this node in the trie. */
- std::map<TNode, TriggerTrie> d_children;
+ std::map<Node, TriggerTrie> d_children;
}; /* class inst::Trigger::TriggerTrie */
} // namespace inst