ArmNN
 25.11
Loading...
Searching...
No Matches
JsonUtils.hpp
Go to the documentation of this file.
1//
2// Copyright © 2021 Arm Ltd and Contributors. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
6#pragma once
7
8#include <iomanip>
9
10#include "armnn/Types.hpp"
12
13namespace armnn
14{
15
17{
18public:
19 JsonUtils(std::ostream& outputStream)
20 : m_NumTabs(0), m_OutputStream(outputStream)
21 {}
22
23 void PrintTabs()
24 {
25 unsigned int numTabs = m_NumTabs;
26 while ( numTabs-- > 0 )
27 {
28 m_OutputStream << "\t";
29 }
30 }
31
33 {
34 if ( m_NumTabs == 0 )
35 {
36 return;
37 }
38 --m_NumTabs;
39 }
40
42 {
43 ++m_NumTabs;
44 }
45
47 {
48 m_OutputStream << std::endl;
49 }
50
52 {
54 PrintTabs();
55 m_OutputStream << "}";
56 }
57
59 {
60 m_OutputStream << "{" << std::endl;
62 }
63
65 {
66 PrintTabs();
67 m_OutputStream << R"("ArmNN": {)" << std::endl;
69 }
71 {
72 m_OutputStream << ",";
73 }
74
75private:
76 unsigned int m_NumTabs;
77 std::ostream& m_OutputStream;
78};
79
80} // namespace armnn
void PrintSeparator()
Definition JsonUtils.hpp:70
JsonUtils(std::ostream &outputStream)
Definition JsonUtils.hpp:19
void DecrementNumberOfTabs()
Definition JsonUtils.hpp:32
void IncrementNumberOfTabs()
Definition JsonUtils.hpp:41
void PrintArmNNHeader()
Definition JsonUtils.hpp:64
Copyright (c) 2021 ARM Limited and Contributors.