souffle  2.0.2-371-g6315b36
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes
souffle::WriteFileJSON Class Reference

#include <WriteStreamJSON.h>

Inheritance diagram for souffle::WriteFileJSON:
Inheritance graph
Collaboration diagram for souffle::WriteFileJSON:
Collaboration graph

Public Member Functions

 WriteFileJSON (const std::map< std::string, std::string > &rwOperation, const SymbolTable &symbolTable, const RecordTable &recordTable)
 
 ~WriteFileJSON () override
 
- Public Member Functions inherited from souffle::WriteStream
template<typename T >
void writeAll (const T &relation)
 
template<>
void writeNext (const RamDomain *tuple)
 
template<typename T >
void writeSize (const T &relation)
 
 WriteStream (const std::map< std::string, std::string > &rwOperation, const SymbolTable &symbolTable, const RecordTable &recordTable)
 
- Public Member Functions inherited from souffle::SerialisationStream< true >
virtual ~SerialisationStream ()=default
 

Protected Member Functions

void writeNextTuple (const RamDomain *tuple) override
 
void writeNullary () override
 
- Protected Member Functions inherited from souffle::WriteStreamJSON
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)
 
- Protected Member Functions inherited from souffle::WriteStream
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 writeSize (std::size_t)
 
- Protected Member Functions inherited from souffle::SerialisationStream< true >
 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)
 

Static Protected Member Functions

static std::string getFileName (const std::map< std::string, std::string > &rwOperation)
 Return given filename or construct from relation name. More...
 

Protected Attributes

std::ofstream file
 
bool isFirst
 
- Protected Attributes inherited from souffle::WriteStreamJSON
Json params
 
const bool useObjects
 
- Protected Attributes inherited from souffle::WriteStream
const bool summary
 
- Protected Attributes inherited from souffle::SerialisationStream< true >
size_t arity
 
size_t auxiliaryArity
 
RO< RecordTable > & recordTable
 
RO< SymbolTable > & symbolTable
 
std::vector< std::string > typeAttributes
 
Json types
 

Additional Inherited Members

- Protected Types inherited from souffle::SerialisationStream< true >
using RO = std::conditional_t< readOnlyTables, const A, A >
 

Detailed Description

Definition at line 197 of file WriteStreamJSON.h.

Constructor & Destructor Documentation

◆ WriteFileJSON()

souffle::WriteFileJSON::WriteFileJSON ( const std::map< std::string, std::string > &  rwOperation,
const SymbolTable symbolTable,
const RecordTable recordTable 
)
inline

Definition at line 199 of file WriteStreamJSON.h.

202  {
203  file << "]\n";
204  file.close();

◆ ~WriteFileJSON()

souffle::WriteFileJSON::~WriteFileJSON ( )
inlineoverride

Definition at line 206 of file WriteStreamJSON.h.

207  :
208  bool isFirst;
209  std::ofstream file;

Member Function Documentation

◆ getFileName()

static std::string souffle::WriteFileJSON::getFileName ( const std::map< std::string, std::string > &  rwOperation)
inlinestaticprotected

Return given filename or construct from relation name.

Default name is [configured path]/[relation name].json

Parameters
rwOperationmap of IO configuration options
Returns
input filename

Definition at line 235 of file WriteStreamJSON.h.

240  : public WriteStreamJSON {
241 public:

◆ writeNextTuple()

void souffle::WriteFileJSON::writeNextTuple ( const RamDomain tuple)
inlineoverrideprotectedvirtual

Implements souffle::WriteStream.

Definition at line 219 of file WriteStreamJSON.h.

◆ writeNullary()

void souffle::WriteFileJSON::writeNullary ( )
inlineoverrideprotectedvirtual

Implements souffle::WriteStream.

Definition at line 215 of file WriteStreamJSON.h.

215  {
216  if (!isFirst) {
217  file << ",\n";

References file, and isFirst.

Field Documentation

◆ file

std::ofstream souffle::WriteFileJSON::file
protected

Definition at line 213 of file WriteStreamJSON.h.

Referenced by writeNullary().

◆ isFirst

bool souffle::WriteFileJSON::isFirst
protected

Definition at line 212 of file WriteStreamJSON.h.

Referenced by writeNullary().


The documentation for this class was generated from the following file:
souffle::WriteFileJSON::isFirst
bool isFirst
Definition: WriteStreamJSON.h:212
souffle::WriteStreamJSON::WriteStreamJSON
WriteStreamJSON(const std::map< std::string, std::string > &rwOperation, const SymbolTable &symbolTable, const RecordTable &recordTable)
Definition: WriteStreamJSON.h:43
souffle::WriteFileJSON::file
std::ofstream file
Definition: WriteStreamJSON.h:213