IVGCVSW-5298 Remove boost::format from Android-nn-driver
* Replaced with stringstream, string or filesystem::path
Signed-off-by: Colm Donelan <Colm.Donelan@arm.com>
Signed-off-by: Jan Eilers <jan.eilers@arm.com>
Change-Id: I2aa80d88cc0eaff5de4dc6a121370ebf41dcb0a8
diff --git a/Utils.cpp b/Utils.cpp
index 77575d7..895278a 100644
--- a/Utils.cpp
+++ b/Utils.cpp
@@ -12,6 +12,8 @@
#include <armnn/Utils.hpp>
#include <armnn/utility/Assert.hpp>
+#include <Filesystem.hpp>
+#include <log/log.h>
#include <cassert>
#include <cerrno>
@@ -374,10 +376,11 @@
const armnn::ConstTensor& tensor)
{
// The dump directory must exist in advance.
- const std::string fileName = boost::str(boost::format("%1%/%2%_%3%.dump") % dumpDir % requestName % tensorName);
+ fs::path dumpPath = dumpDir;
+ const fs::path fileName = dumpPath / (requestName + "_" + tensorName + ".dump");
std::ofstream fileStream;
- fileStream.open(fileName, std::ofstream::out | std::ofstream::trunc);
+ fileStream.open(fileName.c_str(), std::ofstream::out | std::ofstream::trunc);
if (!fileStream.good())
{
@@ -512,14 +515,12 @@
ARMNN_ASSERT(profiler);
// Set the name of the output profiling file.
- const std::string fileName = boost::str(boost::format("%1%/%2%_%3%.json")
- % dumpDir
- % std::to_string(networkId)
- % "profiling");
+ fs::path dumpPath = dumpDir;
+ const fs::path fileName = dumpPath / (std::to_string(networkId) + "_profiling.json");
// Open the ouput file for writing.
std::ofstream fileStream;
- fileStream.open(fileName, std::ofstream::out | std::ofstream::trunc);
+ fileStream.open(fileName.c_str(), std::ofstream::out | std::ofstream::trunc);
if (!fileStream.good())
{
@@ -548,9 +549,9 @@
}
// Set the name of the output .dot file.
- fileName = boost::str(boost::format("%1%/%2%_networkgraph.dot")
- % dumpDir
- % timestamp);
+ fs::path dumpPath = dumpDir;
+ fs::path tempFilePath = dumpPath / (timestamp + "_networkgraph.dot");
+ fileName = tempFilePath.string();
ALOGV("Exporting the optimized network graph to file: %s", fileName.c_str());
@@ -622,9 +623,9 @@
{
return;
}
- const std::string newFileName = boost::str(boost::format("%1%/%2%_networkgraph.dot")
- % dumpDir
- % std::to_string(networkId));
+ fs::path dumpPath = dumpDir;
+ const fs::path newFileName = dumpPath / (std::to_string(networkId) + "_networkgraph.dot");
+
int iRet = rename(oldName.c_str(), newFileName.c_str());
if (iRet != 0)
{