`neurun::graph::operand::IndexSet` is a list of `Index`.
Signed-off-by: Hanjoung Lee <hanjoung.lee@samsung.com>
--- /dev/null
+#include "IndexSet.h"
+
+#include <algorithm>
+
+namespace neurun
+{
+namespace graph
+{
+namespace operand
+{
+
+IndexSet::IndexSet(std::initializer_list<Index> list) : _set(list)
+{
+ // DO NOTHING
+}
+
+IndexSet::IndexSet(std::initializer_list<int32_t> list)
+{
+ for (auto val : list)
+ {
+ _set.emplace_back(static_cast<uint32_t>(val));
+ }
+}
+
+} // namespace operand
+} // namespace graph
+} // namespace neurun
--- /dev/null
+#ifndef __NEURUN_GRAPH_OPERAND_INDEX_SET_H__
+#define __NEURUN_GRAPH_OPERAND_INDEX_SET_H__
+
+#include <initializer_list>
+#include <vector>
+
+#include "graph/operand/Index.h"
+
+namespace neurun
+{
+namespace graph
+{
+namespace operand
+{
+
+class IndexSet
+{
+public:
+ IndexSet(void) = default;
+ IndexSet(std::initializer_list<Index> list);
+ IndexSet(std::initializer_list<int32_t> list);
+
+public:
+ void append(const Index &index) { _set.emplace_back(index); }
+
+public:
+ uint32_t size() const { return static_cast<uint32_t>(_set.size()); }
+ const Index &at(uint32_t set_index) const { return _set.at(set_index); }
+ const std::vector<Index> &list() const { return _set; }
+
+private:
+ std::vector<Index> _set;
+};
+
+} // namespace operand
+} // namespace graph
+} // namespace neurun
+
+#endif // __NEURUN_GRAPH_OPERAND_INDEX_SET_H__
--- /dev/null
+#include <gtest/gtest.h>
+
+#include "graph/operand/IndexSet.h"
+
+using neurun::graph::operand::Index;
+using neurun::graph::operand::IndexSet;
+
+TEST(graph_operand_IndexSet, index_set_test)
+{
+ IndexSet iset{0, 1, 2, 3};
+
+ ASSERT_EQ(iset.size(), 4);
+
+ iset.append(Index{4});
+
+ ASSERT_EQ(iset.size(), 5);
+
+ ASSERT_EQ(iset.at(0), 0);
+ ASSERT_EQ(iset.at(4), 4);
+}