AMF-Placer  2.0
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
dumpZip.cc
Go to the documentation of this file.
1 
25 #include "dumpZip.h"
26 #include <assert.h>
27 #include <sys/stat.h>
28 
29 void writeStrToGZip(std::string fileName, std::stringstream &data)
30 {
31  // we will use GZip from zlib
32  gzFile gz_file;
33  // open the file for writing in binary mode
34  gz_file = gzopen(fileName.c_str(), "wb");
35 
36  assert(Z_NULL != gz_file && "The zip file should be created successfully and please check your path settings.");
37  // Get the size of the stream
38  unsigned long int file_size = sizeof(char) * data.str().size();
39  // Write the data
40  gzwrite(gz_file, (void *)(data.str().data()), file_size);
41  // close the file
42  gzclose(gz_file);
43 }
44 
45 bool fileExists(const std::string &filename)
46 {
47  struct stat buf;
48  if (stat(filename.c_str(), &buf) != -1)
49  {
50  return true;
51  }
52  return false;
53 }
paintPlacement.filename
string filename
Definition: paintPlacement.py:141
delayVisualization.data
data
Definition: delayVisualization.py:76
fileExists
bool fileExists(const std::string &filename)
Definition: dumpZip.cc:45
dumpZip.h
writeStrToGZip
void writeStrToGZip(std::string fileName, std::stringstream &data)
Definition: dumpZip.cc:29