#include <WriteStreamJSON.h>
|  | 
| void | writeNextTupleJSON (std::ostream &destination, const RamDomain *tuple) | 
|  | 
| void | writeNextTupleList (std::ostream &destination, const std::string &name, const RamDomain value) | 
|  | 
| void | writeNextTupleObject (std::ostream &destination, const std::string &name, const RamDomain value) | 
|  | 
|  | WriteStreamJSON (const std::map< std::string, std::string > &rwOperation, const SymbolTable &symbolTable, const RecordTable &recordTable) | 
|  | 
| void | outputADT (std::ostream &destination, const RamDomain value, const std::string &name) | 
|  | 
| void | outputRecord (std::ostream &destination, const RamDomain value, const std::string &name) | 
|  | 
| template<typename Tuple > | 
| void | writeNext (const Tuple tuple) | 
|  | 
| virtual void | writeNextTuple (const RamDomain *tuple)=0 | 
|  | 
| virtual void | writeNullary ()=0 | 
|  | 
| virtual void | writeSize (std::size_t) | 
|  | 
|  | SerialisationStream (RO< SymbolTable > &symTab, RO< RecordTable > &recTab, const std::map< std::string, std::string > &rwOperation) | 
|  | 
|  | SerialisationStream (RO< SymbolTable > &symTab, RO< RecordTable > &recTab, Json types) | 
|  | 
|  | SerialisationStream (RO< SymbolTable > &symTab, RO< RecordTable > &recTab, Json types, std::vector< std::string > relTypes, size_t auxArity=0) | 
|  | 
Definition at line 37 of file WriteStreamJSON.h.
 
◆ WriteStreamJSON()
  
  | 
        
          | souffle::WriteStreamJSON::WriteStreamJSON | ( | const std::map< std::string, std::string > & | rwOperation, |  
          |  |  | const SymbolTable & | symbolTable, |  
          |  |  | const RecordTable & | recordTable |  
          |  | ) |  |  |  | inlineprotected | 
 
Definition at line 43 of file WriteStreamJSON.h.
   48     const bool useObjects; 
   51     void writeNextTupleJSON(std::ostream& destination, const RamDomain* tuple) { 
   52         std::vector<Json> result; 
 
 
 
◆ writeNextTupleJSON()
  
  | 
        
          | void souffle::WriteStreamJSON::writeNextTupleJSON | ( | std::ostream & | destination, |  
          |  |  | const RamDomain * | tuple |  
          |  | ) |  |  |  | inlineprotected | 
 
 
◆ writeNextTupleList()
  
  | 
        
          | void souffle::WriteStreamJSON::writeNextTupleList | ( | std::ostream & | destination, |  
          |  |  | const std::string & | name, |  
          |  |  | const RamDomain | value |  
          |  | ) |  |  |  | inlineprotected | 
 
Definition at line 86 of file WriteStreamJSON.h.
   90                 destination << std::get<std::string>(curr);
 
   94             const std::string& currType = std::get<ValueTuple>(curr).first;
 
   95             const RamDomain currValue = std::get<ValueTuple>(curr).second;
 
   96             assert(currType.length() > 2 && 
"Invalid type length");
 
   97             switch (currType[0]) {
 
   99                 case 's': destination << Json(
symbolTable.unsafeResolve(currValue)).dump(); 
break;
 
  100                 case 'i': destination << currValue; 
break;
 
  101                 case 'u': destination << (int)ramBitCast<RamUnsigned>(currValue); 
break;
 
  102                 case 'f': destination << ramBitCast<RamFloat>(currValue); 
break;
 
  104                     auto&& recordInfo = 
types[
"records"][currType];
 
  105                     assert(!recordInfo.is_null() && 
"Missing record type information");
 
  106                     if (currValue == 0) {
 
  107                         destination << 
"null";
 
  111                     auto&& recordTypes = recordInfo[
"types"];
 
  112                     const size_t recordArity = recordInfo[
"arity"].long_value();
 
  115                     for (
auto i = (
long long)(recordArity - 1); 
i >= 0; --
i) {
 
  116                         if (
i != (
long long)(recordArity - 1)) {
 
  119                         const std::string& recordType = recordTypes[
i].string_value();
 
  121                         worklist.push(std::make_pair(recordType, recordValue));
 
  127                 default: 
fatal(
"unsupported type attribute: `%c`", currType[0]);
 
  133         using ValueTuple = std::pair<const std::string, const RamDomain>;
 
  134         std::stack<std::variant<ValueTuple, std::string>> worklist;
 
  135         worklist.push(std::make_pair(name, value));
 
 
Referenced by writeNextTupleJSON().
 
 
◆ writeNextTupleObject()
  
  | 
        
          | void souffle::WriteStreamJSON::writeNextTupleObject | ( | std::ostream & | destination, |  
          |  |  | const std::string & | name, |  
          |  |  | const RamDomain | value |  
          |  | ) |  |  |  | inlineprotected | 
 
Definition at line 140 of file WriteStreamJSON.h.
  144                 destination << std::get<std::string>(curr);
 
  148             const std::string& currType = std::get<ValueTuple>(curr).first;
 
  149             const RamDomain currValue = std::get<ValueTuple>(curr).second;
 
  150             const std::string& typeName = currType.substr(2);
 
  151             assert(currType.length() > 2 && 
"Invalid type length");
 
  152             switch (currType[0]) {
 
  154                 case 's': destination << Json(
symbolTable.unsafeResolve(currValue)).dump(); 
break;
 
  155                 case 'i': destination << currValue; 
break;
 
  156                 case 'u': destination << (int)ramBitCast<RamUnsigned>(currValue); 
break;
 
  157                 case 'f': destination << ramBitCast<RamFloat>(currValue); 
break;
 
  159                     auto&& recordInfo = 
types[
"records"][currType];
 
  160                     assert(!recordInfo.is_null() && 
"Missing record type information");
 
  161                     if (currValue == 0) {
 
  162                         destination << 
"null";
 
  166                     auto&& recordTypes = recordInfo[
"types"];
 
  167                     const size_t recordArity = recordInfo[
"arity"].long_value();
 
  170                     for (
auto i = (
long long)(recordArity - 1); 
i >= 0; --
i) {
 
  171                         if (
i != (
long long)(recordArity - 1)) {
 
  174                         const std::string& recordType = recordTypes[
i].string_value();
 
  176                         worklist.push(std::make_pair(recordType, recordValue));
 
  179                         auto&& recordParam = 
params[
"records"][typeName][
"params"][
i];
 
  180                         assert(recordParam.is_string());
 
  181                         worklist.push(recordParam.dump());
 
  187                 default: 
fatal(
"unsupported type attribute: `%c`", currType[0]);
 
  195     WriteFileJSON(
const std::map<std::string, std::string>& rwOperation, 
const SymbolTable& 
symbolTable,
 
  198               file(getFileName(rwOperation), 
std::ios::out | 
std::ios::binary) {
 
 
Referenced by writeNextTupleJSON().
 
 
◆ params
  
  | 
        
          | Json souffle::WriteStreamJSON::params |  | protected | 
 
 
◆ useObjects
  
  | 
        
          | const bool souffle::WriteStreamJSON::useObjects |  | protected | 
 
 
The documentation for this class was generated from the following file: