souffle
2.0.2-371-g6315b36
|
Go to the documentation of this file.
43 class Relation :
public Node {
62 assert(attr &&
"Undefined attribute");
121 cur =
map(std::move(cur));
126 std::vector<const Node*> res;
128 res.push_back(cur.get());
134 void print(std::ostream& os)
const override {
139 bool equal(
const Node& node)
const override {
140 const auto& other =
static_cast<const Relation&
>(node);
166 if (x !=
nullptr && y !=
nullptr) {
167 return x->getQualifiedName() < y->getQualifiedName();
174 using RelationSet = std::set<const Relation*, NameComparison>;
void setAttributes(VecOwn< Attribute > attrs)
Set relation attributes.
QualifiedName name
Name of relation.
VecOwn< Attribute > attributes
Attributes of the relation.
RelationRepresentation getRepresentation() const
Get relation representation.
void print(std::ostream &os) const override
Output to a given output stream.
Comparator for relations.
An abstract class for manipulating AST Nodes by substitution.
auto map(const std::vector< A > &xs, F &&f)
Applies a function to each element of a vector and returns the results.
bool operator()(const Relation *x, const Relation *y) const
Defines a relation with a name, attributes, qualifiers, and internal representation.
std::vector< Attribute * > getAttributes() const
Get relation attributes.
void setRepresentation(RelationRepresentation representation)
Set relation representation.
void addQualifier(RelationQualifier q)
Add qualifier to this relation.
void addAttribute(Own< Attribute > attr)
Add a new used type to this relation.
const std::set< RelationQualifier > & getQualifiers() const
Get relation qualifiers.
auto clone(const std::vector< A * > &xs)
bool equal(const Node &node) const override
Abstract equality check for two AST nodes.
detail::joined_sequence< Iter, Printer > join(const Iter &a, const Iter &b, const std::string &sep, const Printer &p)
Creates an object to be forwarded to some output stream for printing sequences of elements interspers...
bool equal_targets(const Container &a, const Container &b, const Comparator &comp)
A function testing whether two containers are equal with the given Comparator.
std::set< const Relation *, NameComparison > RelationSet
Relation set.
a horizontalBars(j=m=void 0===a.axisX.type?new c.AutoScaleAxis(c.Axis.units.x, b.normalized.series, o, c.extend({}, a.axisX,{highLow:d, referenceValue:0})):a.axisX.type.call(c, c.Axis.units.x, b.normalized.series, o, c.extend({}, a.axisX,{highLow:d, referenceValue:0})), l=n=void 0===a.axisY.type?new c.StepAxis(c.Axis.units.y, b.normalized.series, o,{ticks:k}):a.axisY.type.call(c, c.Axis.units.y, b.normalized.series, o, a.axisY)) var q
bool hasQualifier(RelationQualifier q) const
Check for a relation qualifier.
RelationRepresentation representation
Datastructure to use for this relation.
size_t getArity() const
Return the arity of this relation.
std::vector< const Node * > getChildNodes() const override
Obtain a list of all embedded AST child nodes.
const QualifiedName & getQualifiedName() const
Get qualified relation name.
void setSrcLoc(SrcLocation l)
Set source location for the Node.
std::set< RelationQualifier > qualifiers
Qualifiers of relation.
void apply(const NodeMapper &map) override
Apply the mapper to all child nodes.
const SrcLocation & getSrcLoc() const
Return source location of the Node.
Qualified Name class defines fully/partially qualified names to identify objects in components.
RelationRepresentation
Space of internal representations that a relation can have.
void setQualifiedName(QualifiedName n)
Set name for this relation.
RelationQualifier
Space of qualifiers that a relation can have.
std::vector< T * > toPtrVector(const std::vector< std::unique_ptr< T >> &v)
A utility function enabling the creation of a vector of pointers.
std::vector< Own< A > > VecOwn
void removeQualifier(RelationQualifier q)
Remove qualifier from this relation.
Relation * clone() const override
Create a clone (i.e.