#include <string>
#include <fstream>
+#include <boost/filesystem/fstream.hpp>
namespace armnn
{
void JSONTimelineDecoder::PrintJSON(JSONTimelineDecoder::JSONEntity& rootEntity)
{
std::string jsonString = GetJSONString(rootEntity);
- std::ofstream outfile;
- outfile.open(this->outputJSONFile);
- outfile << jsonString;
+ boost::filesystem::ofstream ofs{this->outputJSONFile};
+ ofs << jsonString;
+ ofs.close();
}
std::string JSONTimelineDecoder::GetJSONString(JSONTimelineDecoder::JSONEntity& rootEntity)
#include <map>
#include <vector>
+#include <boost/filesystem/path.hpp>
+#include <boost/filesystem.hpp>
namespace armnn
{
private:
Model m_Model;
- std::string outputJSONFile = "/tmp/output.json";
+ boost::filesystem::path fileDir = boost::filesystem::temp_directory_path();
+ boost::filesystem::path p{fileDir / boost::filesystem::unique_path("output.json")};
+
+ std::string outputJSONFile = p.string();
void HandleRetentionLink(const Relationship& relationship);
void HandleLabelLink(const Relationship& relationship);
#include <boost/test/unit_test_suite.hpp>
#include <fstream>
+#include <boost/filesystem.hpp>
BOOST_AUTO_TEST_SUITE(JSONTimelineDecoderTests)
timelineDecoder.PrintJSON(rootEntity);
- std::ifstream inFile;
- inFile.open("/tmp/output.json"); //open the input file
+ boost::filesystem::ifstream inFile;
+ boost::filesystem::path fileDir = boost::filesystem::temp_directory_path();
+ boost::filesystem::path p{fileDir / boost::filesystem::unique_path("output.json")};
+
+ inFile.open(p); //open the input file
std::stringstream strStream;
strStream << inFile.rdbuf(); //read the file