36 lines
687 B
C++
36 lines
687 B
C++
#pragma once
|
|
|
|
#include <QtCore/QObject>
|
|
#include <QtCore/QString>
|
|
|
|
/**
|
|
* `id` represents an internal unique data type for the given port.
|
|
* `name` is a normal text description.
|
|
*/
|
|
struct NodeDataType
|
|
{
|
|
QString id;
|
|
QString name;
|
|
};
|
|
|
|
/**
|
|
* Class represents data transferred between nodes.
|
|
* @param type is used for comparing the types
|
|
* The actual data is stored in subtypes
|
|
*/
|
|
class NodeData
|
|
{
|
|
public:
|
|
virtual ~NodeData() = default;
|
|
|
|
virtual bool sameType(NodeData const &nodeData) const
|
|
{
|
|
return (this->type().id == nodeData.type().id);
|
|
}
|
|
|
|
/// Type for inner use
|
|
virtual NodeDataType type() const = 0;
|
|
};
|
|
|
|
Q_DECLARE_METATYPE(NodeDataType);
|