public:
~FeatureObject();
-private:
- void get(ObjectInfo **) const override;
-
public:
FeatureObject *asFeature(void) override { return this; }
const FeatureObject *asFeature(void) const override { return this; }
#ifndef __COCO_IR_FEATURE_OBJECT_INFO_H__
#define __COCO_IR_FEATURE_OBJECT_INFO_H__
-#include "coco/IR/ObjectInfo.h"
-
#include <nncc/core/ADT/feature/Shape.h>
namespace coco
{
-class FeatureObjectInfo final : public ObjectInfo
+class FeatureObjectInfo final
{
public:
FeatureObjectInfo(const nncc::core::ADT::feature::Shape &shape) : _shape{shape}
public:
virtual ~KernelObject();
-private:
- void get(ObjectInfo **) const override;
-
public:
KernelObject *asKernel(void) override { return this; }
const KernelObject *asKernel(void) const override { return this; }
#ifndef __COCO_IR_KERNEL_OBJECT_INFO_H__
#define __COCO_IR_KERNEL_OBJECT_INFO_H__
-#include "coco/IR/ObjectInfo.h"
-
#include <nncc/core/ADT/kernel/Shape.h>
namespace coco
{
-class KernelObjectInfo final : public ObjectInfo
+class KernelObjectInfo final
{
public:
KernelObjectInfo(const nncc::core::ADT::kernel::Shape &shape) : _shape{shape}
public:
virtual ~Object() = default;
-protected:
- virtual void get(ObjectInfo **) const = 0;
-
public:
coco::Bag *bag(void) const { return _dep.bag(); }
void bag(coco::Bag *bag) { _dep.bag(bag); }
+++ /dev/null
-#ifndef __COCO_IR_OBJECT_INFO_H__
-#define __COCO_IR_OBJECT_INFO_H__
-
-#include "coco/IR/Object.h"
-#include "coco/IR/Def.forward.h"
-#include "coco/IR/UseSet.h"
-
-namespace coco
-{
-
-class ObjectInfo
-{
-public:
- ObjectInfo() = default;
-
-public:
- virtual ~ObjectInfo() = default;
-
-public:
- Object::ConsumerSet *user(void) { return &_user; }
- const Object::ConsumerSet *user(void) const { return &_user; }
-
-private:
- Def *_def = nullptr;
- Object::ConsumerSet _user;
-};
-
-} // namespace coco
-
-#endif // __COCO_IR_OBJECT_INFO_H__
#define __COCO_IR_OBJECT_MANAGER_H__
#include "coco/IR/Object.h"
-#include "coco/IR/ObjectInfo.h"
#include "coco/IR/FeatureObject.forward.h"
#include "coco/IR/KernelObject.forward.h"
#include "coco/IR/EntityBuilder.h"
#include "coco/IR/Def.h"
-#include "coco/IR/ObjectInfo.h"
#include "coco/IR/ObjectManager.h"
#include "coco/IR/FeatureObject.h"
#include "coco/IR/BagManager.h"
-#include "coco/IR/ObjectInfo.h"
#include "coco/IR/ObjectManager.h"
#include "coco/IR/FeatureObject.h"
// DO NOTHING
}
-void FeatureObject::get(ObjectInfo **out) const { *out = _info.get(); }
-
const nncc::core::ADT::feature::Shape &FeatureObject::shape(void) const { return _info->shape(); }
ElemID &FeatureObject::at(uint32_t ch, uint32_t row, uint32_t col)
// DO NOTHING
}
-void KernelObject::get(ObjectInfo **out) const { *out = _info.get(); }
-
const nncc::core::ADT::kernel::Shape &KernelObject::shape(void) const { return _info->shape(); }
ElemID &KernelObject::at(uint32_t n, uint32_t ch, uint32_t row, uint32_t col)
#include "coco/IR/Object.h"
-#include "coco/IR/ObjectInfo.h"
#include "coco/IR/Def.h"
#include "coco/IR/Use.h"
_dep.object(this);
}
-ObjectInfo *Object::info(void) const
-{
- ObjectInfo *res = nullptr;
- get(&res);
- return res;
-}
-
Def *Object::def(void) const { return _def; }
void Object::def(Def *d)
#include "coco/IR/Object.h"
-#include "coco/IR/ObjectInfo.h"
#include "coco/IR/BagManager.h"
#include <nncc/foundation/Memory.h>
{
public:
virtual ~Object() = default;
-
-public:
- std::unique_ptr<coco::ObjectInfo> info;
-
-private:
- void get(coco::ObjectInfo **out) const override { *out = info.get(); }
};
} // namespace mock
} // namespace
{
::mock::Object obj;
- obj.info = make_unique<coco::ObjectInfo>();
-
// Newly created object should not have a backing bag
ASSERT_EQ(obj.bag(), nullptr);
// Test 'Object' class through a mock-up object
::mock::Object obj;
- obj.info = make_unique<coco::ObjectInfo>();
-
obj.bag(bag);
// 'bag(Bag *)' should affect the return of 'bag(void)'
{
::mock::Object obj;
- obj.info = make_unique<coco::ObjectInfo>();
-
obj.bag(bag);
}
+++ /dev/null
-#include "coco/IR/ObjectInfo.h"
-
-#include <cassert>
-
-namespace coco
-{
-
-} // namespace coco
+++ /dev/null
-#include "coco/IR/ObjectInfo.h"
-
-#include <gtest/gtest.h>
-
-namespace
-{
-class ObjectInfoTest : public ::testing::Test
-{
-};
-} // namespace
-
-TEST_F(ObjectInfoTest, constructor)
-{
- coco::ObjectInfo info;
-
- ASSERT_EQ(info.user()->size(), 0);
-}
#include "coco/IR/Use.h"
-#include "coco/IR/ObjectInfo.h"
#include <cassert>
{
// TODO Remove unnecessary indentation
{
- auto info = _value->info();
- assert(info != nullptr);
- info->user()->erase(_consumer);
_value->mutable_uses()->erase(this);
}
_value = nullptr;
_value = value;
// TODO Remove unnecessary indentation
{
- auto info = _value->info();
- assert(info != nullptr);
_value->mutable_uses()->insert(this);
- info->user()->insert(_consumer);
}
}
#include "coco/IR/Use.h"
-#include "coco/IR/ObjectInfo.h"
#include "coco/IR/ObjectManager.h"
#include "coco/IR/FeatureObject.h"