class ANNBinder
{
public:
- ANNBinder(uint32_t id, coco::Block *block, std::unique_ptr<ann::Module> &&module)
- : _id{id}, _block{block}, _module{std::move(module)}
+ ANNBinder(coco::Block *block, std::unique_ptr<ann::Module> &&module)
+ : _block{block}, _module{std::move(module)}
{
// DO NOTHING
}
public:
- uint32_t id(void) const { return _id; }
-
-public:
const coco::Block *block(void) const { return _block; }
coco::Block *block(void) { return _block; }
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;
ANNBinder *ANNContext::create(coco::Block *blk)
{
- const uint32_t id = _binders.size();
-
auto mod = nncc::foundation::make_unique<ann::Module>();
- auto obj = nncc::foundation::make_unique<ANNBinder>(id, blk, std::move(mod));
+ auto obj = nncc::foundation::make_unique<ANNBinder>(blk, std::move(mod));
auto ptr = obj.get();
_binders.emplace_back(std::move(obj));
ASSERT_NE(binder, nullptr);
}
-TEST_F(ANNContextTest, create_distinct_id)
-{
- const uint32_t count = 32;
-
- ANNContext ann_ctx;
-
- std::set<uint32_t> ids;
-
- for (uint32_t n = 0; n < count; ++n)
- {
- auto blk = m->entity()->block()->create();
- auto binder = ann_ctx.create(blk);
- ids.insert(binder->id());
- }
-
- ASSERT_EQ(ids.size(), count);
-}
-
TEST_F(ANNContextTest, find)
{
ANNContext ann_ctx;