| 111 | } // namespace |
| 112 | |
| 113 | const NodeDef* LIFOManager::GetCurrNode() { |
| 114 | CHECK(!nodes_.empty()) << "GetCurrNode(), but there's no ready node"; |
| 115 | if (curr_pos_ == nodes_.end()) { |
| 116 | curr_pos_ = --(nodes_.rbegin().base()); // Last one in the list. |
| 117 | } |
| 118 | // Once curr_pos_ is set to a valid entry in the list, we keep using the |
| 119 | // cached curr_pos_ until RemoveCurrNode() is called. AddNode() will not |
| 120 | // change the GetCurrNode() return value. |
| 121 | return *curr_pos_; |
| 122 | } |
| 123 | |
| 124 | void LIFOManager::RemoveCurrNode() { |
| 125 | // Make sure we have curr_pos_ ready to be removed. |