Transformation pass to set attribute names and types in IO operations.  
 More...
#include <IOAttributes.h>
Transformation pass to set attribute names and types in IO operations. 
Definition at line 60 of file IOAttributes.h.
◆ clone()
◆ getAlgebraicDataTypes()
Get sum types info for IO. 
If they don't exists - create them.
The structure of JSON is approximately: {"ADTs" : {ADT_NAME : {"branches" : [branch..]}, {"arity": ...}}} branch = {{"types": [types ...]}, ["name": ...]} 
Definition at line 202 of file IOAttributes.h.
  204                     dynamic_cast<const analysis::AlgebraicDataType&
>(typeEnv.getType(astAlgebraicDataType));
 
  206             auto& branches = sumType.getBranches();
 
  208             std::vector<json11::Json> branchesInfo;
 
  210             for (
const auto& branch : branches) {
 
  211                 std::vector<json11::Json> branchTypes;
 
  212                 for (
auto* 
type : branch.types) {
 
  218                 branchesInfo.push_back(std::move(branchInfo));
 
  223                     {
"arity", 
static_cast<long long>(branches.size())}, {
"enum", 
isADTEnum(sumType)}}};
 
  224             sumTypes.emplace(std::move(typeQualifier), std::move(sumInfo));
 
  234         if (!ramRecordTypes.
is_null()) {
 
  235             return ramRecordTypes;
 
  238         Program& program = translationUnit.getProgram();
 
  240                 &translationUnit.getAnalysis<analysis::TypeEnvironmentAnalysis>()->getTypeEnvironment();
 
  241         std::vector<std::string> elementTypes;
 
  242         std::map<std::string, json11::Json> records;
 
 
 
 
◆ getName()
  
  | 
        
          | std::string souffle::ast::transform::IOAttributesTransformer::getName | ( |  | ) | const |  | inlineoverridevirtual | 
 
 
◆ getRecordsParams()
Definition at line 278 of file IOAttributes.h.
  280                                       : as<ast::RecordType>(astType)->getFields()) {
 
  281                     elementParams.push_back(field->getName());
 
  283                 const size_t recordArity = elementParams.size();
 
  285                         {
"params", std::move(elementParams)}, {
"arity", 
static_cast<long long>(recordArity)}};
 
  286                 records.emplace(astType->getQualifiedName().toString(), std::move(recordInfo));
 
  291         return ramRecordParams;
 
 
 
◆ getRecordsTypes()
Definition at line 245 of file IOAttributes.h.
  245                            : program.getTypes()) {
 
  246             const auto& 
type = typeEnv->getType(*astType);
 
  247             if (isA<analysis::RecordType>(
type)) {
 
  248                 elementTypes.clear();
 
  250                 for (
const analysis::Type* field : as<analysis::RecordType>(
type)->getFields()) {
 
  253                 const size_t recordArity = elementTypes.size();
 
  255                         {
"types", std::move(elementTypes)}, {
"arity", 
static_cast<long long>(recordArity)}};
 
  261         return ramRecordTypes;
 
  267         if (!ramRecordParams.
is_null()) {
 
  268             return ramRecordParams;
 
  271         Program& program = translationUnit.getProgram();
 
  272         std::vector<std::string> elementParams;
 
  273         std::map<std::string, json11::Json> records;
 
  276         for (
auto* astType : program.getTypes()) {
 
References souffle::ast::analysis::getTypeQualifier().
 
 
◆ getRelationName()
  
  | 
        
          | std::string souffle::ast::transform::IOAttributesTransformer::getRelationName | ( | const Directive * | node | ) |  |  | inlineprivate | 
 
 
◆ setAttributeNames()
  
  | 
        
          | bool souffle::ast::transform::IOAttributesTransformer::setAttributeNames | ( | TranslationUnit & | translationUnit | ) |  |  | inlineprivate | 
 
Definition at line 121 of file IOAttributes.h.
  124                                        : 
rel->getAttributes()) {
 
  125                 attributeNames.push_back(attribute->getName());
 
  129                 auto auxArityAnalysis = translationUnit.getAnalysis<analysis::AuxiliaryArityAnalysis>();
 
  130                 std::vector<std::string> originalAttributeNames(
 
  131                         attributeNames.begin(), attributeNames.end() - auxArityAnalysis->getArity(
rel));
 
  132                 io->addParameter(
"attributeNames", 
toString(
join(originalAttributeNames, delimiter)));
 
  134                 io->addParameter(
"attributeNames", 
toString(
join(attributeNames, delimiter)));
 
  142         bool changed = 
false;
 
  143         Program& program = translationUnit.getProgram();
 
  144         auto auxArityAnalysis = translationUnit.getAnalysis<analysis::AuxiliaryArityAnalysis>();
 
  146                 &translationUnit.getAnalysis<analysis::TypeEnvironmentAnalysis>()->getTypeEnvironment();
 
  148         for (Directive* io : program.getDirectives()) {
 
  151             std::vector<std::string> attributesTypes;
 
  153             for (
const auto* attribute : 
rel->getAttributes()) {
 
 
 
◆ setAttributeParams()
  
  | 
        
          | bool souffle::ast::transform::IOAttributesTransformer::setAttributeParams | ( | TranslationUnit & | translationUnit | ) |  |  | inlineprivate | 
 
Definition at line 88 of file IOAttributes.h.
   92                            {
static_cast<long long>(
rel->getArity() - auxArityAnalysis->getArity(
rel))};
 
   93             long long auxArity{
static_cast<long long>(auxArityAnalysis->getArity(
rel))};
 
  101             io->addParameter(
"params", params.
dump());
 
  108         bool changed = 
false;
 
  109         Program& program = translationUnit.getProgram();
 
  110         for (Directive* io : program.getDirectives()) {
 
  114             if (io->hasParameter(
"attributeNames")) {
 
  118             std::string delimiter(
"\t");
 
  119             if (io->hasParameter(
"delimiter")) {
 
 
 
◆ setAttributeTypes()
  
  | 
        
          | bool souffle::ast::transform::IOAttributesTransformer::setAttributeTypes | ( | TranslationUnit & | translationUnit | ) |  |  | inlineprivate | 
 
Definition at line 155 of file IOAttributes.h.
  160                            {
static_cast<long long>(
rel->getArity() - auxArityAnalysis->getArity(
rel))};
 
  161             long long auxArity{
static_cast<long long>(auxArityAnalysis->getArity(
rel))};
 
  170             io->addParameter(
"types", 
types.dump());
 
  177         return toString(
join(node->getQualifiedName().getQualifiers(), 
"."));
 
 
 
◆ transform()
  
  | 
        
          | bool souffle::ast::transform::IOAttributesTransformer::transform | ( | TranslationUnit & | translationUnit | ) |  |  | inlineoverrideprivatevirtual | 
 
 
The documentation for this class was generated from the following file:
 
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...