} // namespace coco
+#include "coco/IR/FeatureObject.h"
+
+/**
+ * @brief Explicit computation step that emits a feature map from another feature map
+ *
+ * TODO Decide source code layout policy and extract this class if necessary
+ */
+namespace coco
+{
+
+class FeatureInstr : public Instr
+{
+public:
+ FeatureInstr(const PtrLink<Instr, Block> *link) : Instr{link}, _ifm{nullptr}, _ofm{nullptr}
+ {
+ // DO NOTHING
+ }
+
+public:
+ virtual ~FeatureInstr() = default;
+
+private:
+ FeatureObject *_ifm;
+
+public:
+ FeatureObject *ifm(void) const { return _ifm; }
+ void ifm(FeatureObject *ifm);
+
+private:
+ FeatureObject *_ofm;
+
+public:
+ FeatureObject *ofm(void) const { return _ofm; }
+ void ofm(FeatureObject *ofm);
+};
+
+} // namespace coco
+
#endif // __COCO_IR_INSTR_H__
ASSERT_EQ(ins.prev(), nullptr);
ASSERT_EQ(ins.next(), nullptr);
}
+
+TEST(IR_FEATURE_INSTR, ctor)
+{
+ coco::PtrLink<coco::Instr, coco::Block> link;
+ coco::FeatureInstr ins{&link};
+
+ // IFM and OFM should be initialized as nullptr
+ ASSERT_EQ(ins.ifm(), nullptr);
+ ASSERT_EQ(ins.ofm(), nullptr);
+}
+
+TEST(IR_FEATURE_INSTR, ifm_update)
+{
+ coco::PtrLink<coco::Instr, coco::Block> link;
+ coco::FeatureInstr ins{&link};
+ coco::FeatureObject obj{nncc::core::ADT::feature::Shape{1, 3, 3}};
+
+ // 'ifm(FeatureObject *)' method should affect 'ifm()' method
+ ins.ifm(&obj);
+ ASSERT_EQ(ins.ifm(), &obj);
+}
+
+TEST(IR_FEATURE_INSTR, ofm_update)
+{
+ coco::PtrLink<coco::Instr, coco::Block> link;
+ coco::FeatureInstr ins{&link};
+ coco::FeatureObject obj{nncc::core::ADT::feature::Shape{1, 3, 3}};
+
+ // 'ofm(FeatureObject *)' method should affect 'ofm()' method
+ ins.ofm(&obj);
+ ASSERT_EQ(ins.ofm(), &obj);
+}