Refactor: Remove need of OutgoingCaptureFile in JSONTimelineDecoder

 * moves ownership of the output file to caller of TimelineDecoder
 * by using ostream the output can be printed to std::cout or any other file stream
 * updated unit test accordingly

Signed-off-by: Jan Eilers <jan.eilers@arm.com>
Change-Id: Iaa8994e9997c674c1a026a65fcbd1ab8e3832d3e
diff --git a/src/timelineDecoder/JSONTimelineDecoder.cpp b/src/timelineDecoder/JSONTimelineDecoder.cpp
index a039214..c0e8137 100644
--- a/src/timelineDecoder/JSONTimelineDecoder.cpp
+++ b/src/timelineDecoder/JSONTimelineDecoder.cpp
@@ -1,5 +1,5 @@
 //
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
 // SPDX-License-Identifier: MIT
 //
 
@@ -242,12 +242,10 @@
     parent.childEntities.push_back(GetGuid());
 }
 
-void JSONTimelineDecoder::PrintJSON(JSONTimelineDecoder::JSONEntity& rootEntity)
+void JSONTimelineDecoder::PrintJSON(JSONTimelineDecoder::JSONEntity& rootEntity, std::ostream& os)
 {
     std::string jsonString = GetJSONString(rootEntity);
-    std::ofstream ofs{this->outputJSONFile};
-    ofs << jsonString;
-    ofs.close();
+    os << jsonString;
 }
 
 std::string JSONTimelineDecoder::GetJSONString(JSONTimelineDecoder::JSONEntity& rootEntity)
@@ -377,11 +375,6 @@
     return m_Model;
 }
 
-void JSONTimelineDecoder::SetOutgoingCaptureFile(const std::string& outgoingCaptureFile)
-{
-    this->outputJSONFile = outgoingCaptureFile;
-}
-
 void JSONTimelineDecoder::JSONEntity::SetName(std::string entityName)
 {
     this->name = entityName;