souffle
2.0.2-371-g6315b36
|
Go to the documentation of this file.
52 class Component :
public Node {
80 std::vector<Type*>
getTypes()
const {
166 cur = mapper(std::move(cur));
169 cur = mapper(std::move(cur));
172 cur = mapper(std::move(cur));
174 for (
auto& cur :
types) {
175 cur = mapper(std::move(cur));
178 cur = mapper(std::move(cur));
181 cur = mapper(std::move(cur));
184 cur = mapper(std::move(cur));
189 std::vector<const Node*> res;
193 res.push_back(cur.get());
196 res.push_back(cur.get());
199 res.push_back(cur.get());
201 for (
const auto& cur :
types) {
202 res.push_back(cur.get());
205 res.push_back(cur.get());
207 for (
const auto& cur :
clauses) {
208 res.push_back(cur.get());
211 res.push_back(cur.get());
217 void print(std::ostream& os)
const override {
218 auto show = [&](
auto&& xs,
char const* sep =
"\n",
char const* prefix =
"") {
219 if (xs.empty())
return;
220 os << prefix <<
join(xs, sep) <<
"\n";
236 bool equal(
const Node& node)
const override {
237 const auto& other =
static_cast<const Component&
>(node);
void copyBaseComponents(const Component &other)
Copy base components.
void setComponentType(Own< ComponentType > other)
Set component type.
void addComponent(Own< Component > c)
Add components.
An abstract class for manipulating AST Nodes by substitution.
std::vector< Directive * > getDirectives() const
Get directive statements.
VecOwn< Component > components
Nested components.
std::vector< Clause * > getClauses() const
Get clauses.
const std::set< std::string > & getOverridden() const
Get override.
std::vector< Relation * > getRelations() const
Get relations.
const std::vector< ComponentType * > getBaseComponents() const
Get base components.
void addInstantiation(Own< ComponentInit > i)
Add instantiation.
Component * clone() const override
Create a clone (i.e.
auto clone(const std::vector< A * > &xs)
std::vector< const Node * > getChildNodes() const override
Obtain a list of all embedded AST child nodes.
const ComponentType * getComponentType() const
Get component type.
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.
bool equal(const Node &node) const override
Abstract equality check for two AST nodes.
VecOwn< Type > types
Types declarations.
void addRelation(Own< Relation > r)
Add relation.
VecOwn< Clause > clauses
Clauses.
bool equal_ptr(const T *a, const T *b)
Compares two values referenced by a pointer where the case where both pointers are null is also consi...
Own< ComponentType > componentType
Name of component and its formal component arguments.
std::vector< ComponentInit * > getInstantiations() const
Get instantiation.
void apply(const NodeMapper &mapper) override
Apply the mapper to all child nodes.
void addBaseComponent(Own< ComponentType > component)
Add base components.
void addClause(Own< Clause > c)
Add clause.
void addType(Own< Type > t)
Add type.
Abstract class for syntactic elements in an input program.
VecOwn< Directive > directives
I/O directives.
void addDirective(Own< Directive > directive)
Add directive.
VecOwn< ComponentInit > instantiations
Nested component instantiations.
std::set< std::string > overrideRules
Clauses of relations that are overwritten by this component.
void addOverride(const std::string &name)
Add override.
std::vector< Component * > getComponents() const
Get components.
void print(std::ostream &os) const override
Output to a given output stream.
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
std::vector< Type * > getTypes() const
Get types.
VecOwn< ComponentType > baseComponents
Base components of component.
VecOwn< Relation > relations
Relations.