Dependencies check in debug mode

Some common resources can depend on each other - this checks that the requirements are consistent
This commit is contained in:
Lukas Matena 2020-04-06 08:06:07 +02:00
parent 3db3a61520
commit 7e797eaaf8
2 changed files with 33 additions and 7 deletions

View file

@ -85,13 +85,22 @@ public:
// Returns whether the resource is currently maintained.
bool is_valid() const { return m_is_valid; }
#ifndef NDEBUG
// Return a bitmask of all resources that this one relies on.
// The dependent resource must have higher ID than the one
// it depends on.
virtual CommonGizmosDataID get_dependencies() const { return CommonGizmosDataID::None; }
#endif // NDEBUG
protected:
CommonGizmosDataPool* m_common = nullptr;
virtual void on_release() = 0;
virtual void on_update() = 0;
CommonGizmosDataPool* get_pool() const { return m_common; }
private:
bool m_is_valid = false;
CommonGizmosDataPool* m_common = nullptr;
};
@ -125,6 +134,10 @@ class InstancesHider : public CommonGizmosDataBase
public:
explicit InstancesHider(CommonGizmosDataPool* cgdp)
: CommonGizmosDataBase(cgdp) {}
#ifndef NDEBUG
CommonGizmosDataID get_dependencies() const override { return CommonGizmosDataID::SelectionInfo; }
#endif // NDEBUG
protected:
void on_update() override;
void on_release() override;