2 * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "ir/OperandIndexSequence.h"
27 OperandIndexSequence::OperandIndexSequence(std::initializer_list<OperandIndex> list) : _vec(list)
32 OperandIndexSequence::OperandIndexSequence(std::initializer_list<int32_t> list)
36 _vec.emplace_back(static_cast<uint32_t>(val));
40 OperandIndexSequence::OperandIndexSequence(std::initializer_list<uint32_t> list)
44 _vec.emplace_back(val);
48 bool OperandIndexSequence::contains(const OperandIndex &index) const
50 return std::find(_vec.begin(), _vec.end(), index) != _vec.end();
53 void OperandIndexSequence::replace(const OperandIndex &from, const OperandIndex &to)
55 std::replace(_vec.begin(), _vec.end(), from, to);
58 OperandIndexSequence OperandIndexSequence::operator+(const OperandIndexSequence &other) const
60 OperandIndexSequence ret = *this;
65 std::ostream &operator<<(std::ostream &o, const OperandIndexSequence &operand_seq)
67 std::string delimeter;
68 for (const auto &ind : operand_seq._vec)
70 o << delimeter << ind;