node: fixed issue with "taking" values from input tables

As opposed to simply leaving all values in the table, nodes can now "take"
values that they use to free up memory (e.g. "taking" input buffers if they're
used to produce an output buffer).

This is a fairly large change, expect regressions.
This commit is contained in:
itsmattkc
2020-04-16 23:12:05 +10:00
parent cc8699c0bc
commit 2f80be437a
30 changed files with 179 additions and 101 deletions
+11 -2
View File
@@ -37,6 +37,8 @@ public:
const QVariant& data() const;
const QString& tag() const;
bool operator==(const NodeValue& rhs) const;
private:
NodeParam::DataType type_;
QVariant data_;
@@ -52,13 +54,16 @@ public:
QVariant Get(const NodeParam::DataType& type, const QString& tag = QString()) const;
NodeValue GetWithMeta(const NodeParam::DataType& type, const QString& tag = QString()) const;
QVariant Take(const NodeParam::DataType& type, const QString& tag = QString());
NodeValue TakeWithMeta(const NodeParam::DataType& type, const QString& tag = QString());
void Push(const NodeValue& value);
void Push(const NodeParam::DataType& type, const QVariant& data, const QString& tag = QString());
void Prepend(const NodeValue& value);
void Prepend(const NodeParam::DataType& type, const QVariant& data, const QString& tag = QString());
const NodeValue& At(int index) const;
NodeValue TakeAt(int index);
int Count() const;
bool Has(const NodeParam::DataType& type) const;
void Remove(const NodeValue& v);
bool isEmpty() const;
@@ -76,8 +81,11 @@ class NodeValueDatabase
public:
NodeValueDatabase() = default;
NodeValueTable operator[](const QString& input_id) const;
NodeValueTable operator[](const NodeInput* input) const;
NodeValueTable& operator[](const QString& input_id);
NodeValueTable& operator[](const NodeInput* input);
const NodeValueTable operator[](const QString& input_id) const;
const NodeValueTable operator[](const NodeInput* input) const;
void Insert(const QString& key, const NodeValueTable &value);
void Insert(const NodeInput* key, const NodeValueTable& value);
@@ -92,5 +100,6 @@ private:
OLIVE_NAMESPACE_EXIT
Q_DECLARE_METATYPE(OLIVE_NAMESPACE::NodeValueTable)
Q_DECLARE_METATYPE(OLIVE_NAMESPACE::NodeValueDatabase)
#endif // VALUE_H