_module->operation()->create(code, inputs, outputs);
}
+public:
+ // @brief Identify a sequence of coco::Bag * as subnet's inputs
+ //
+ // NOTE 1. This method takes input iterator over coco::Bag * values
+ // NOTE 2. All the identifyInputs class except the last one will be ignored if there are
+ // multiple identifyInputs calls
+ template <typename It> void identifyInputs(It beg, It end)
+ {
+ _inputs.clear();
+ _module->input()->clear();
+
+ for (auto it = beg; it != end; ++it)
+ {
+ auto const bag = *it;
+ _inputs.emplace_back(*it);
+ _module->input()->emplace_back(_operands.at(bag));
+ }
+ }
+
+ template <typename T> void identifyInputs(T &&values)
+ {
+ identifyInputs(std::begin(values), std::end(values));
+ }
+
+public:
+ // @brief Identify a sequence of coco::Bag * as subnet's outputs
+ //
+ // NOTE 1. This method takes input iterator over coco::Bag * values
+ // NOTE 2. All the identifyOutputs class except the last one will be ignored if there are
+ // multiple identifyOutputs calls
+ template <typename It> void identifyOutputs(It beg, It end)
+ {
+ _outputs.clear();
+ _module->output()->clear();
+
+ for (auto it = beg; it != end; ++it)
+ {
+ auto const bag = *it;
+ _outputs.emplace_back(bag);
+ _module->output()->emplace_back(_operands.at(bag));
+ }
+ }
+
+ template <typename T> void identifyOutputs(T &&values)
+ {
+ identifyOutputs(std::begin(values), std::end(values));
+ }
+
+public:
+ coco::Bag *input(uint32_t n) const { return _inputs.at(n); }
+ coco::Bag *output(uint32_t n) const { return _outputs.at(n); }
+
private:
uint32_t const _id;
coco::Block *const _block;
std::unique_ptr<ann::Module> _module;
private:
+ std::vector<coco::Bag *> _inputs;
+ std::vector<coco::Bag *> _outputs;
+
+private:
// @brief Operand ID assigned for each coco::Bag
std::map<const coco::Bag *, ann::OperandID> _operands;
};